Code for alternating lights:
int ledPin = D2; //point where LED is connected
int bluePin = D3;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH); //Turns the led pin on. This is a binary control, only takes HIGH or LOW
digitalWrite(bluePin, LOW);
delay (1000); //Waits 1000ms (1 second)
digitalWrite(ledPin, LOW); //Turns off the led pin
digitalWrite (bluePin, HIGH);
delay (1000); //Waits 1000ms (1 second) before starting next step
}
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .