From feac085d7a6977101f7507af5e0a393d610c2ad9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 18 May 2014 23:41:07 +0300 Subject: [PATCH] Added Embedded-Blink example (works with Wiring based frameworks, like Arduino or Energia) --- examples/embedded-blink/platformio.ini | 13 ++++++++++++ examples/embedded-blink/src/blink.cpp | 29 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 examples/embedded-blink/platformio.ini create mode 100644 examples/embedded-blink/src/blink.cpp diff --git a/examples/embedded-blink/platformio.ini b/examples/embedded-blink/platformio.ini new file mode 100644 index 00000000..30b333bf --- /dev/null +++ b/examples/embedded-blink/platformio.ini @@ -0,0 +1,13 @@ +[env:arduino_pro5v] +platform = atmelavr +board = pro5v +upload_port = /dev/tty.SLAB_USBtoUART +targets = upload + +[env:launchpad_msp430g2] +platform = timsp430 +board = lpmsp430g2553 + +[env:launchpad_lm4f120] +platform = titiva +board = lplm4f120h5qr diff --git a/examples/embedded-blink/src/blink.cpp b/examples/embedded-blink/src/blink.cpp new file mode 100644 index 00000000..9a51e5a0 --- /dev/null +++ b/examples/embedded-blink/src/blink.cpp @@ -0,0 +1,29 @@ +/* + Turns ON and OFF the Wiring compatible board LED, with intervals of 1 second (1000 milliseconds) + + */ + +#ifdef ENERGIA + +#include "Energia.h" +#define WLED RED_LED + +#else + +#include "Arduino.h" +#define WLED 13 // Most Arduino boards already have an LED attached to pin 13 on the board itself + +#endif + +void setup() +{ + pinMode(WLED, OUTPUT); // set pin as output +} + +void loop() +{ + digitalWrite(WLED, HIGH); // set the LED on + delay(1000); // wait for a second + digitalWrite(WLED, LOW); // set the LED off + delay(1000); // wait for a second +} \ No newline at end of file