int readpin = A1;
int resultpin = 13;
int v2 = 0;
float result = 0;
int delayinms = 50;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(readpin, INPUT);
pinMode(resultpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
v2 = analogRead(readpin);
result = v2 * 5.0 / 1024;
if(result >= 2.5){
digitalWrite(resultpin, HIGH);
}
else{
digitalWrite(resultpin, LOW);
}
Serial.println(result);
delay(delayinms);
}