Mercury 具有板载高电流输出,您可以使用它来为外部设备供电。短期内可以处理 10-12 安培,持续可以处理 2-3 安培。它还在输出上连接了一个 LED,因此为了测试输出并闪烁板载 LED,我们可以使用此示例代码。
使用 Arduino IDE?我们的在线编程器默认包含 Mercury_Pins.h,因此引脚名称可以正常工作。如果您使用 Arduino IDE 或其他编程器,请复制 Mercury_Pins.h 选项卡内容并将其粘贴到您程序的顶部。
/* * Mercury V1 (ESP32-C6) Output example
* 闪烁输出 LED 并打开/关闭高电流输出。 */ #include "Mercury_Pins.h" void setup() { pinMode(OUT1, OUTPUT); // 您需要上拉 BUTTON 输入,未按下时为 1,按下时为 0。 digitalWrite(OUT1, LOW); // 启动时始终关闭输出是良好的做法 } void loop() { digitalWrite(OUT1, HIGH); delay(500); digitalWrite(OUT1, LOW); delay(500); }#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