/*Mohammed Ali , Student ID: 300370238
First code to try and validate all the individual components connected
arduino uno. Component list as follows:
Button_a - Pin 2
Button_b - Pin 12
Button_c - Pin 8
Button_d - Pin 7
Amber LED - Pin5
Blue LED - Pin6
Green LED - Pin10
Red LED - Pin9
Servo PWM - Pin 11
*/
void setup() {
// put your setup code here, to run once:
//setup all the digital input pins from the pushbuttons
pinMode(2, INPUT); // Button_a (Red)
pinMode(12, INPUT);// Button_b (Green)
pinMode(8, INPUT); // Button_c (Blue)
pinMode(7, INPUT); //Button_d (Amber)
//Setup all the output pins from the LEDs
pinMode(5, OUTPUT);// LED Amber
pinMode(6,OUTPUT); // LED Blue
pinMode(9, OUTPUT); // LED Red
pinMode(10, OUTPUT); // LED Green
}
void loop() {
// put your main code here, to run repeatedly:
//Turn off all the LEDs
digitalWrite(5, HIGH); // High turns it off, Amber turns off
digitalWrite(6, HIGH); //Turns off Blue
digitalWrite(9, HIGH); //Turns off Red
digitalWrite(10,HIGH); //Turns off Green
while(digitalRead(8))
{
digitalWrite(6, LOW);// turn on blue LED for 200ms
delay(200);
//turn off Blue LEd and keep it off
digitalWrite(6, HIGH);
delay(150);
}
}