forked from platformio/platformio-core
Added Embedded-Blink example (works with Wiring based frameworks, like Arduino or Energia)
This commit is contained in:
13
examples/embedded-blink/platformio.ini
Normal file
13
examples/embedded-blink/platformio.ini
Normal file
@@ -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
|
29
examples/embedded-blink/src/blink.cpp
Normal file
29
examples/embedded-blink/src/blink.cpp
Normal file
@@ -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
|
||||||
|
}
|
Reference in New Issue
Block a user