Created
November 1, 2015 20:11
-
-
Save jnv/429946af67a1d9aefb4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
based on Blink, Arduino's "Hello World!" | |
Turns on an LED on for one second, then off for one second, repeatedly. | |
The Tinkerkit Led Modules (T010110-7) is hooked up on O0 | |
http://www.tinkerkit.com/led-red-10mm/ | |
created in Dec 2011 | |
by Federico Vanzati | |
This example code is in the public domain. | |
*/ | |
/* | |
modified for repeated fadein/fadeout light | |
and tested with TK Power LED module | |
in Oct 2015 | |
No rights reserved. | |
*/ | |
// include the TinkerKit library | |
#include <TinkerKit.h> | |
// creating the object 'led' that belongs to the 'TKLed' class | |
// and giving the value to the desired output pin | |
TKLed led(O0); | |
// delay between each step of setting brightness | |
int cycleDelay = 60; | |
void setup() { | |
//nothing here | |
} | |
void loop() | |
{ | |
// 1. light fade-in | |
for(int i = 0; i < 1023; i += 10) { | |
led.brightness(i); | |
delay(cycleDelay); | |
} | |
led.on(); // set the LED on for maximum brightness | |
delay(1000); // keep it on for one second | |
// 2. light fade-out | |
for(int i = 1023; i > 0; i -= 10) { | |
led.brightness(i); | |
delay(cycleDelay); | |
} | |
led.off(); // turn off the LED | |
delay(500); // wait for half a second | |
// ...and loop again! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment