void setup()
{
Serial.begin(9600);
pinMode(A0,INPUT);
for(int i = 11; i<=13; i++)pinMode(i,OUTPUT);
}
void loop()
{
delay(100);
int data = analogRead(A0);
Serial.print("Data = "+ String(data));
float volt = data * 5.0/1023;
Serial.println("/t Volt = " + String(volt) + "v");
if(volt <= 1.6)
{
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
}
else
if(volt <= 3.2 && volt > 1.6)
{
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
digitalWrite(13, HIGH);
}
else
{
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
}
}