int potensio = A5;
int lampu = 4;
void setup() {
// put your setup code here, to run once:
pinMode(potensio, INPUT);
pinMode(lampu, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int hasil = analogRead(A5);
float rumus1 = 10230/1023;
float rumus2 = hasil*rumus1;
if (rumus2 < 5115)
{
digitalWrite(lampu,HIGH);
delay(rumus2);
}
else
{
digitalWrite(lampu, LOW);
delay(rumus2);
}
Serial.println(hasil);
}