Mercury V1 手册
了解如何快速轻松地飞行,将您的 altimeter 连接到 Altimeter 云网站上传,以及所有高级功能。如果您遇到困难或刚刚开始,这是最佳去处。

代码示例:NeoPixel 状态 LED

PDF

Mercury 有 1 个"Neopixel"类型状态 LED,或从修订版 3 开始有 4 个排成正方形的 LED。
使用这些 LED 的最简单方法是打开它们(请参阅电源控制页面),然后使用标准库。 
在此示例中,您可以将其更改为 4 或 1 像素,我们默认设置为 4 像素。 

使用 Arduino IDE?我们的在线编程器默认包含 Mercury_Pins.h,因此引脚名称可以正常工作。如果您使用 Arduino IDE 或其他编程器,请复制 Mercury_Pins.h 选项卡内容并将其粘贴到程序顶部。
/*
 * Mercury V1 (ESP32-C6) Status LED example
 * Cycles the Neopixel(s) through various colours
 */
#include "Mercury_Pins.h"
#include "Adafruit_NeoPixel.h"

Adafruit_NeoPixel pixels(4, LED, NEO_GRB + NEO_KHZ800);

void setup() {
    Serial.begin(115200);

    // Enable the NeoPixel power rail
    pinMode(LEDPOWER, OUTPUT);
    digitalWrite(LEDPOWER, HIGH);
    delay(10);

    pixels.begin();
    pixels.setBrightness(140);  // Keep brightness low (0-255)
    pixels.show();

    Serial.println("NeoPixel colour cycle started");
}

// Smoothly cycle all pixels through the colour wheel
void rainbow(int wait) {
    static uint16_t hue = 0;
    for (int i = 0; i < pixels.numPixels(); i++) {
        uint16_t pixelHue = hue + (i * 65536L / pixels.numPixels());
        pixels.setPixelColor(i, pixels.gamma32(pixels.ColorHSV(pixelHue)));
    }
    pixels.show();
    hue += 256;
    delay(wait);
}

void loop() {
    rainbow(20);
}



#pragma once
/*
 * Mercury (ESP32-C6) Pin Definitions
 * Board-specific GPIO assignments
 */

// ── Status LED (NeoPixel) ──
#define LEDPOWER      3    // NeoPixel power (drive HIGH to enable)
#define LED           2    // NeoPixel data signal

// ── I2C Bus ──
#define SDA           21   // I2C data
#define SCL           22   // I2C clock

// ── Sensor Power ──
#define VACC          20   // Sensor power rail (drive HIGH to enable)

// ── General Purpose Ports ──
#define GP06          6    // GP06 port
#define GP07          7    // GP07 port

// ── High Current Output ──
#define OUT1          5    // High current output (e.g. pyro / relay)

// ── Battery Bar LEDs ──
#define BL1           4    // Battery LED 1 (lowest)
#define BL2           14   // Battery LED 2
#define BL3           15   // Battery LED 3
#define BL4           18   // Battery LED 4
#define BL5           19   // Battery LED 5 (highest)

// ── Indicators ──
#define DISK          8    // Disk activity LED

// ── Analogue / Detection ──
#define BATIN         0    // Battery voltage (1:1 divider)
#define USBDETECT     1    // USB power detect (HIGH = USB present)
#define BUTTON        9    // BUTTON on the board, boot button but can be used