frg-fossee / eSim-Cloud

A web-based system for designing and simulating electronic (eSim) and Arduino circuits.

Home Page:https://esim-cloud.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
image

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