Hi, I'm new to lilypad and C and pretty much this whole thing. I did the tutorials on Leah's and thought I might have a shot at making this thing work. But I must have made a mistake somewhere.
What I want to do is have a series of three blinking lights: the board LED light, an "innerLED" light, and an "outerLED" light - with a switch, so that when you press the switch, the lights go on bling bling bling then stop then start again (1,2,3 stop, 1,2,3, stop). The board LED is already connected. The inner LED will have positive line to #11 and negative line to #10. The outer LED will have positive line to #9 and negative line (shared) to #10.
I'm sure I bit off more than I could chew, but if someone could help me with the basic premise of having multiple lights doing different things, that would be grand.
Stareyes
int boardLED = 13; // LED is connected to digital pin 13
int outerLED = 9; //outerLED is connected to 7
int innerLED = 11; //innerLED connected to 11
int signalLow = 10;
int switchPin = 2; //switch is connected to digital pin 2
int switchLow = 3;
int switchValue; // a variable to keep track of when switch is pressed
void setup()
{
pinMode(boardLED, OUTPUT);
pinMode(switchPin, INPUT); // sets the switchPin to be an input
digitalWrite(switchPin, HIGH); // sets the default (unpressed) state of switchPin to HIGH
pinMode(outerLED, OUTPUT);
pinMode(innerLED, OUTPUT);
digitalWrite(signalLow, LOW);
}
void loop() // run over and over again
{
switchValue = digitalRead(switchPin); // check to see if the switch is pressed
if (switchValue == LOW) { // if the switch is pressed then,
digitalWrite(boardLED, HIGH); // turn the LED on
delay(200); //wait for one/fifth second
digitalWrite(innerLED, HIGH); // turn the inner LED on
delay(200);
digitalWrite(outerLED, HIGH); // turn the outer LED on
delay(600);
digitalWrite(boardLED, LOW); //set the LED off
delay(1000); //wait for one second
}
else { // otherwise,
digitalWrite(boardLED, LOW); // turn the LED off
digitalWrite(innerLED, LOW);
digitalWrite(outerLED, LOW);
}
}