Created
September 29, 2016 20:28
-
-
Save peverett/d844766ea22b27fc6eee284cffd5fdeb to your computer and use it in GitHub Desktop.
Interrupt Blinky Arduino Sketch for Maple Leaf Mini STM32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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