const byte potentioMeterPin = A0;
const byte redPin = 13;
const byte orangePin = 12;
const byte greenPin = 11;
byte procentage;
float potentio;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(orangePin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(potentioMeterPin, INPUT);
Serial.begin(9600);
}
void loop() {
potentio = analogRead(potentioMeterPin);
procentage = map(potentio, 0, 1023, 0, 100);
Serial.println(procentage);
if(procentage < 50 )
{
digitalWrite(redPin,HIGH);
digitalWrite(redPin,LOW);
}
else if(50 < procentage && procentage < 70)
{
digitalWrite(orangePin,HIGH);
digitalWrite(orangePin,LOW);
}
else if(procentage > 70)
{
digitalWrite(greenPin,HIGH);
digitalWrite(greenPin,LOW);
}
}