Hello
So I have been working in Proteus software to program Arduino uno board to turn on LED 13 when the analogRead input of Potentiometer is between 500 and 1000.
But I have got this problem where the read of the input A0 is stuck at 1023.
I have updated the Arduino library to version (v4.0) from BLOGEMBARCADO.
After I have updated the the library it got stuck at 0.
I have even connected a voltmeter to see if voltage is going through.
note : I am new to the program so hopefully nothing is wrong with the code or with the layout.
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(A0, INPUT);
}
int v = 0;
void loop()
{
v = analogRead(A0);
Serial.println(v);
if (v >= 500){
if (v <= 1000){
digitalWrite(13, HIGH);
}
else {
digitalWrite(13, LOW);
}
}
else digitalWrite(13, LOW);
}