diff --git a/examples/wiring-blink/platformio.ini b/examples/wiring-blink/platformio.ini index 33d4a63f..b079b0f6 100644 --- a/examples/wiring-blink/platformio.ini +++ b/examples/wiring-blink/platformio.ini @@ -1,15 +1,17 @@ -; ; Project Configuration File -; -; A detailed documentation with the EXAMPLES is located here: -; http://docs.platformio.org/en/latest/projectconf.html -; +; Docs: http://docs.platformio.org/en/latest/projectconf.html [env:uno] platform = atmelavr framework = arduino board = uno +[env:nodemcu] +platform = espressif +framework = arduino +board = nodemcu +build_flags = -D LED_BUILTIN=BUILTIN_LED + [env:teensy31] platform = teensy framework = arduino @@ -19,9 +21,4 @@ board = teensy31 platform = timsp430 framework = energia board = lpmsp430g2553 - -[env:lptm4c1230c3pm] -platform = titiva -framework = energia -board = lptm4c1230c3pm -build_flags = -DLED_PIN=GREEN_LED +build_flags = -D LED_BUILTIN=RED_LED diff --git a/examples/wiring-blink/src/main.cpp b/examples/wiring-blink/src/main.cpp index b1017a5e..ba4a75de 100644 --- a/examples/wiring-blink/src/main.cpp +++ b/examples/wiring-blink/src/main.cpp @@ -1,21 +1,25 @@ -#ifdef ENERGIA - #include "Energia.h" -#else - #include "Arduino.h" -#endif +/* + * Blink + * Turns on an LED on for one second, + * then off for one second, repeatedly. + */ -#ifndef LED_PIN - // Most Arduino boards already have a LED attached to pin 13 on the board itself - #define LED_PIN 13 -#endif +#include "Arduino.h" -void setup() { - pinMode(LED_PIN, OUTPUT); // set pin as output +void setup() +{ + // initialize digital pin 13 as an output. + pinMode(LED_BUILTIN, OUTPUT); } -void loop() { - digitalWrite(LED_PIN, HIGH); // set the LED on - delay(1000); // wait for a second - digitalWrite(LED_PIN, LOW); // set the LED off - delay(1000); // wait for a second +void loop() +{ + // turn the LED on (HIGH is the voltage level) + digitalWrite(LED_BUILTIN, HIGH); + // wait for a second + delay(1000); + // turn the LED off by making the voltage LOW + digitalWrite(LED_BUILTIN, LOW); + // wait for a second + delay(1000); }