bouton.ino
Los 76 E/S de la GIGA se manejan como en un Uno: INPUT_PULLUP, digitalRead, antirrebote. El modelo mental Arduino sigue valido; solo la tensión (3,3 V) cambia los montajes de 5 V.
Hardware necesario
Una placa Arduino Giga R1 (STM32H747 doble núcleo M7 a 480 MHz + M4, 76 E/S, 2 DAC, FDCAN) alimentada por USB-C o 5-24 V. 1 botón pulsador (D2 a GND).
Cableado
Botón entre D2 y GND, pull-up interna. Todos los pines son 3,3 V máx: revisad módulos de 5 V antes de conectar.
Funcionamiento
El patrón muestreo + ventana de estabilidad es independiente de la plataforma; la GIGA lo ejecuta a 480 MHz sin esfuerzo. En el Arduino IDE, instale la plataforma « Arduino Zephyr-based Boards » (o Mbed), elija « Arduino Giga R1 » y suba. Lógica de 3,3 V.
Para ir más lejos
Un bus de 8 botones en un port (lectura GPIO rápida), o un menú en pantalla vía el I2C del sketch OLED.
bouton.ino
// Bouton sur D2 (vers GND) + temoin LED 13, anti-rebond.
const int BOUTON = D2;
const unsigned long ANTI_REBOND = 30;
bool dernier = HIGH, stable = HIGH;
unsigned long bord = 0;
void setup() {
pinMode(BOUTON, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
}
void loop() {
bool lu = digitalRead(BOUTON);
unsigned long t = millis();
if (lu != dernier) bord = t;
if (t - bord >= ANTI_REBOND && lu != stable) {
stable = lu;
digitalWrite(LED_BUILTIN, !stable);
Serial.println(stable == LOW ? "APPUIE" : "relache");
}
dernier = lu;
}