From 639ee9fc478225bf33974b88379ffa9090cd8202 Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 16 Feb 2015 17:35:40 +0200 Subject: [PATCH] Add example for teensy boards --- examples/teensy/teensy-blink/platformio.ini | 42 +++++++++++++++++++++ examples/teensy/teensy-blink/src/Blink.pde | 28 ++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 examples/teensy/teensy-blink/platformio.ini create mode 100644 examples/teensy/teensy-blink/src/Blink.pde diff --git a/examples/teensy/teensy-blink/platformio.ini b/examples/teensy/teensy-blink/platformio.ini new file mode 100644 index 00000000..ced3cf02 --- /dev/null +++ b/examples/teensy/teensy-blink/platformio.ini @@ -0,0 +1,42 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:teensy20] +platform = teensy +framework = arduino +board = teensy20 +build_flags = -DTEENSY20 + +[env:teensy20pp] +platform = teensy +framework = arduino +board = teensy20pp +build_flags = -DTEENSY20PP + +[env:teensy30] +platform = teensy +framework = arduino +board = teensy30 +build_flags = -DTEENSY30 + +[env:teensy31] +platform = teensy +framework = arduino +board = teensy31 +build_flags = -DTEENSY31 diff --git a/examples/teensy/teensy-blink/src/Blink.pde b/examples/teensy/teensy-blink/src/Blink.pde new file mode 100644 index 00000000..c111b45d --- /dev/null +++ b/examples/teensy/teensy-blink/src/Blink.pde @@ -0,0 +1,28 @@ +/* LED Blink, Teensyduino Tutorial #1 + http://www.pjrc.com/teensy/tutorial.html + + This example code is in the public domain. +*/ +#ifdef TEENSY20 + const int ledPin = 11; +#elif TEENSY20PP + const int ledPin = 6; +#else + const int ledPin = 13; +#endif + +void setup() { + // initialize the digital pin as an output. + pinMode(ledPin, OUTPUT); +} + +// the loop() methor runs over and over again, +// as long as the board has power + +void loop() { + digitalWrite(ledPin, HIGH); // set the LED on + delay(300); // wait for a second + digitalWrite(ledPin, LOW); // set the LED off + delay(100); // wait for a second +} +