#define RED 5
#define GREEN 6
#define pot A0
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(pot, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int potVal = analogRead(pot);
int pot1Analog = map(potVal, 0, 1023, 0, 255);
Serial.println("Value of potentiometer in analog:");
Serial.println(pot1Analog);
if (pot1Analog <= 150){
digitalWrite(RED, LOW);
digitalWrite(GREEN, HIGH);
}
else{
digitalWrite(RED, HIGH);
digitalWrite(GREEN, LOW);
}
}