void setup () {
pinMode (3,OUTPUT);
pinMode (A0,INPUT);
Serial.begin(9600);
}
void loop () {
int a = analogRead (A0);
Serial.print("nilai a = ");
Serial.println(a);
if(a > 500) {
digitalWrite(2,HIGH);}
else {digitalWrite (2,LOW);}
if(a > 800){
digitalWrite(3,HIGH);}
else{digitalWrite(3,LOW);}
if(a > 1000){
digitalWrite(4,HIGH);}
else{digitalWrite(4,LOW);}
}