Please view the attached files to see if problem is in the code or the circuit. It's supposed to be a normal switch type circuit, just passing through arduino.
The arduino files and circuit diagram on proteus are attached.
Moderators note : used code tags
The arduino files and circuit diagram on proteus are attached.
C:
int switchPin = 8;
int ledPin = 9;
int ctr = 0;
void setup() {
// put your setup code here, to run once:
pinMode(switchPin,INPUT);
pinMode(ledPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(switchPin)==LOW)
digitalWrite(ledPin,LOW);
else
digitalWrite(ledPin,HIGH);
}
Last edited by a moderator: