Skip to content

Instantly share code, notes, and snippets.

@peverett
Created September 29, 2016 20:28
Show Gist options
  • Save peverett/d844766ea22b27fc6eee284cffd5fdeb to your computer and use it in GitHub Desktop.
Save peverett/d844766ea22b27fc6eee284cffd5fdeb to your computer and use it in GitHub Desktop.
Interrupt Blinky Arduino Sketch for Maple Leaf Mini STM32
/*
* This is an Interrupt Button Test for Maple Leaf Min STM32
*/
#define BOARD_BUTTON_PIN 32
#define BOARD_LED_PIN 33
volatile byte led_state = 0;
void interruptFunction() {
if (!led_state) led_state = 1;
}
void setup() {
pinMode(BOARD_BUTTON_PIN, INPUT);
pinMode(BOARD_LED_PIN, OUTPUT);
// put your setup code here, to run once:
attachInterrupt(BOARD_BUTTON_PIN, interruptFunction, RISING);
}
void loop() {
delay(200);
digitalWrite(BOARD_LED_PIN, led_state);
led_state = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment