const int GreenLED = 8; const int BlueLED = 9; const int RedLED =10; // define Buttons code const int GreenButton = 4; const int BlueButton = 3; const int RedButton = 2; void setup() { // initialize the digital pin as an output. pinMode(GreenLED,OUTPUT); pinMode(BlueLED ,OUTPUT); pinMode(RedLED ,OUTPUT); //input pins pinMode(RedButton,INPUT_PULLUP); pinMode(BlueButton,INPUT_PULLUP); pinMode(GreenButton,INPUT_PULLUP); } // the loop routine runs over and over again forever: void loop() { boolean GreenIs=digitalRead(GreenButton); boolean BlueIs=digitalRead(BlueButton); boolean RedIs=digitalRead(RedButton); delay(50); if(GreenIs==false) { digitalWrite(GreenLED, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(BlueLED , LOW); // turn the LED off by making the voltage LOW digitalWrite(RedLED , LOW); // turn the LED off by making the voltage LOW } if(BlueIs==false) { digitalWrite(BlueLED , HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(GreenLED , LOW); // turn the LED off by making the voltage LOW digitalWrite(RedLED , LOW); // turn the LED off by making the voltage LOW } if(RedIs==false) { digitalWrite(RedLED , HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(GreenLED , LOW); // turn the LED off by making the voltage LOW digitalWrite(BlueLED , LOW); // turn the LED off by making the voltage LOW } }