//Configuration Values int potPin = 2; //Pin for the potentiometer int button1Pin = 3; //Pin for Button 1 int button2Pin = 4; //Pin for Button 2 int led1Pin = 10; //Pin for LED 1 int led2Pin = 11; //Pin for LED 2 //Internal Values int potVal = 0; int button1State = 0; int button2State = 0; void setup() { Serial.begin(9600); //Initialize Input Pins pinMode(potPin, INPUT); pinMode(button1Pin, INPUT); pinMode(button2Pin, INPUT); //Initialize Output Pins pinMode(led1Pin, OUTPUT); pinMode(led2Pin, OUTPUT); analogWrite(led1Pin, LOW); analogWrite(led2Pin, LOW); } void loop() { potVal = analogRead(potPin); //Read the value of the pot int ledBrightness = map(potVal, 0, 1023, 0, 255); //Map the value Serial.println(potVal); button1State = digitalRead(button1Pin); //Get the state of button 1 button2State = digitalRead(button2Pin); //Get the state of button 2 if(button1State == HIGH) { //Serial.println("Button 1"); analogWrite(led1Pin, ledBrightness); analogWrite(led2Pin, LOW); } else if(button2State == HIGH) { //Serial.println("Button 2"); analogWrite(led1Pin, LOW); analogWrite(led2Pin, ledBrightness); } else { //Serial.println("None"); analogWrite(led1Pin, LOW); analogWrite(led2Pin, LOW); } }