int potVal;
const int pinPot = A1;
const int pinR = 9;
const int pinY = 3;
void setup() {
// put your setup code here, to run once:
pinMode(pinR, OUTPUT);
pinMode(pinY, OUTPUT);
pinMode(pinPot, INPUT);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
potVal = analogRead(pinPot);
Serial.println(potVal);
if (potVal < 256) {
digitalWrite(pinR, HIGH);
digitalWrite(pinY, LOW);
}
else if (potVal < 512) {
digitalWrite(pinR, HIGH);
digitalWrite(pinY, HIGH);
}
else if (potVal < 768) {
digitalWrite(pinR, LOW);
digitalWrite(pinY, HIGH);
}
delay(50);
}