Log in to your Altimeter Cloud account
Don't have an account? Create one
We'll send a confirmation link to verify your email. Check your spam/junk folder if you don't see it.
Already have an account? Log in
The Mercury altimeter has two push buttons on the board. One is the reset button for the Mercury called POWER, and the other is the boot button called BUTTON.
You can use the BUTTON in your code as needed as a general push button, although the power button will reboot the board.
We use the reset button to remember if it was on or off on the previous run so it can act as a on/off switch. If the device was off last run it will now run and turn on. If the device was on last run it will go in to deep sleep mode.
The following code shows how you can use the general button though and print to Serial when you press it.
/* * Mercury V1 (ESP32-C6) Button example * Prints to Serial when you press the button.
* Connect the serial monitor after uploading to the device. */ #include "Mercury_Pins.h" void setup() { pinMode(BUTTON, INPUT_PULLUP); // You need to pullup the BUTTON input, it will be 1 when NOT pressed and 0 when pressed. Serial.begin(115200); delay(1000); Serial.println("Waiting for button..."); } void loop() { if(digitalRead(BUTTON) == 0){ // If the BUTTON pin = 0 then the button is pressed. Serial.println("Button pressed."); } 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