Bug in the slide switch behavior
nagsides opened this issue · comments
This experiment is taken from https://www.javatpoint.com/arduino-switch#:~:text=The%20slide%2Dswitch%20in%20Arduino,used%20in%20small%20circuits%20applications.
The image shown below was drawn on the workspace
This was the ino file used for the above circuit:
const int pinOFswitch = 3;
const int LED = 8;
void setup( ) {
pinMode(pinOFswitch, INPUT);
pinMode(LED, OUTPUT);
}
void loop( )
{
int ValueOFswitch;
ValueOFswitch = digitalRead(pinOFswitch);
if (ValueOFswitch == HIGH)
{
digitalWrite(LED, HIGH);
delay(500);
}
else
{
digitalWrite(LED, LOW);
delay(500);
}
}
The problem is with the slide switch not working in this configuration