The code for this project is INCREDIBLE simple, we only have to turn ON/OFF LEDs
I mainly follow the example that it is given in the arudino software and add some lines, so here is the code:
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
modified January 2015
by CAIS
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pins 7,8,9,10 as an output.
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for half a second
digitalWrite(9, HIGH);
delay(500);
digitalWrite(8, HIGH);
delay(500);
digitalWrite(7, HIGH);
delay(500);
digitalWrite(10, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for half a second
digitalWrite(9, LOW);
delay(500);
digitalWrite(8, LOW);
delay(500);
digitalWrite(7, LOW);
delay(500);
}
That is it!!!
Compile and send to your lilipad.
In this example, we are utilizing pins 7,8,9 and 10, therefore those are the pins we stitched on the lilipad ;)
Next step, for me, is to decorate my final product, but should be done on the next weekend!
====
F4E by CAIS
No comments:
Post a Comment