int pinsensor = A0;
int LedU = 13;
int LedH = 12;
int LedK = 11;
int nilaisensor;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("POTENSIOMETER DAN 3 LED");
Serial.println("EVILJAK");
pinMode(pinsensor, INPUT);
pinMode(LedU, OUTPUT);
pinMode(LedH, OUTPUT);
pinMode (LedK, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
nilaisensor = analogRead(pinsensor) ;
Serial.println(nilaisensor) ;
//LED U
analogWrite(LedU, nilaisensor) ;
//LED H
if (nilaisensor >= 200 && nilaisensor < 600)
{
digitalWrite (LedH, HIGH) ;
delay(nilaisensor) ;
digitalWrite(LedH, LOW) ;
delay(nilaisensor) ;
}
if (nilaisensor > 1000)
{
digitalWrite(LedH, HIGH) ;
}
else
digitalWrite(LedH, LOW) ;
//LED K
digitalWrite(LedK, HIGH) ;
delay(nilaisensor) ;
digitalWrite(LedK, LOW) ;
delay(nilaisensor) ;
}