Three colours LED example with TCRT5000 and switch

//
// Three colours example for Arduino
// Written by Ted Burke 7-2-2018
//

void setup()
{
  // THESE INSTRUCTIONS ARE CARRIED OUT ONCE WHEN THE ARDUINO TURNS ON
  pinMode(4, OUTPUT); // white LED
  pinMode(5, OUTPUT); // green LED
  pinMode(6, OUTPUT); // blue LED
}

void loop()
{
  int x, y;

  x = digitalRead(7);
  
  if (x == 1)
  {
    digitalWrite(6, HIGH);    
  }
  else
  {
    digitalWrite(6, LOW);
  }

  y = digitalRead(8);

  if (y == 1)
  {
    digitalWrite(5, HIGH); // green LED on
  }
}
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s