#define LED 9
int data;
float v;
void setup()
{
Serial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop()
{
data = analogRead(A0);
v = (data / 1023.0) * 5 ;
Serial.print("Vin = ");
Serial.print(v);
Serial.print("[V]");
Serial.print(", data = ");
Serial.print(data);
Serial.print(", = ");
Serial.println(data, BIN);
if (data > 409)
digitalWrite(LED, 1);
else
digitalWrite(LED, 0);
delay(1000);
}