//Name:Li Yung Lap
//Student no:220311206
//Class:EG524403/EEE3453
//Exercise6-Q1
//1.Push-button not pressed->LED off
//2.Push-button pressed->LED flashes at 5HZ
const int LedPin = 25;
const int ButtonPin = 15;
int buttonState = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(LedPin,OUTPUT); //set the pin function
pinMode(ButtonPin,INPUT_PULLUP);
}
void loop() {
buttonState = digitalRead(ButtonPin);
if(buttonState == LOW){ //read current
digitalWrite(LedPin, HIGH);
delay(200); // this speeds up the simulation
digitalWrite(LedPin, LOW);
delay(200); // this speeds up the simulation
}
}