bouton.ino

Arduino GIGA R1 · File : bouton.ino · Language : Arduino · Use case : Lire un bouton avec résistance interne

The GIGA's 76 I/O pins work exactly like an Uno's: INPUT_PULLUP, digitalRead, debounce. The Arduino mental model holds; only the voltage (3.3 V) changes 5 V circuits.

Hardware required

An Arduino Giga R1 board (STM32H747 dual-core M7 at 480 MHz + M4, 76 I/O pins, 2 DACs, FDCAN) powered over USB-C or 5-24 V. 1 push button (D2 to GND).

Wiring

Button between D2 and GND, internal pull-up. All pins are 3.3 V max — check 5 V modules before plugging.

How it works

The sampling + stability-window pattern is platform-independent; the GIGA runs it at 480 MHz effortlessly. In the Arduino IDE, install the « Arduino Zephyr-based Boards » (or Mbed) platform, select « Arduino Giga R1 », then Upload. 3.3 V logic.

Going further

An 8-button bus on one port (fast GPIO read), or an on-screen menu via the OLED sketch's I2C.

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;
}

← Back to the board