//Student name: Ngan Hoi Sing
//Class: EG524403-1A
//Student no.: 230292338
//https://wokwi.com/projects/382443074291088385
#define LED_Out_Pin 25 //Set the output position
#define SW_In_Pin 15 //Set the input position
void setup()
{
// Initialize serial port
Serial.begin(115200);
// Set pins
pinMode(LED_Out_Pin, OUTPUT);
pinMode(SW_In_Pin, INPUT_PULLUP);
}
void loop()
//If the button is pull up, then the LED will not flashes
{
if (digitalRead(SW_In_Pin))
{
digitalWrite(LED_Out_Pin, LOW);
}
//If press the button, the LED will flashes
else
{
digitalWrite(LED_Out_Pin, HIGH);
delay(200);
digitalWrite(LED_Out_Pin, LOW);
delay(200);
}
}