Created
August 5, 2017 02:03
-
-
Save C47D/a7ea9981236b126f7f4c3545d8ac0ad6 to your computer and use it in GitHub Desktop.
C++ lambdas in TI chip
This file contains hidden or 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
#define LED1 PN_1 | |
#define LED2 PN_0 | |
#define LED3 PF_4 | |
#define LED4 PF_0 | |
#define SW1 PJ_0 | |
#define SW2 PJ_1 | |
void setup() { | |
pinMode(LED1, OUTPUT); | |
pinMode(SW1, INPUT_PULLUP); | |
} | |
auto toggle = [](int pin) { | |
auto state = digitalRead(pin); | |
digitalWrite(pin, !state); | |
}; | |
void loop() { | |
toggle(LED1); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment