Skip to content

Instantly share code, notes, and snippets.

@C47D
Created August 5, 2017 02:03
Show Gist options
  • Save C47D/a7ea9981236b126f7f4c3545d8ac0ad6 to your computer and use it in GitHub Desktop.
Save C47D/a7ea9981236b126f7f4c3545d8ac0ad6 to your computer and use it in GitHub Desktop.
C++ lambdas in TI chip
#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