#include <Wire.h>
// LCD configuration
// LED pins
const int redLedPin = 14; // GPIO pin for the red LED
const int greenLedPin = 12; // GPIO pin for the green LED
const int blueLedPin = 13; // GPIO pin for the blue LED
// Push button pins
const int button1Pin = 3; // GPIO pin for the first push button (controls red LED)
const int button2Pin = 4; // GPIO pin for the second push button (controls green LED)
const int button3Pin = 5; // GPIO pin for the third push button (controls blue LED)
void setup() {
// Initialize LCD
// Initialize LED pins
pinMode(redLedPin, OUTPUT);
pinMode(greenLedPin, OUTPUT);
pinMode(blueLedPin, OUTPUT);
// Initialize push button pins
pinMode(button1Pin, INPUT_PULLUP);
pinMode(button2Pin, INPUT_PULLUP);
pinMode(button3Pin, INPUT_PULLUP);
}
void loop() {
// Read the state of each button
int button1State = digitalRead(button1Pin);
int button2State = digitalRead(button2Pin);
int button3State = digitalRead(button3Pin);
// Control the red LED
if (button1State == LOW) {
digitalWrite(redLedPin, HIGH);
} else {
digitalWrite(redLedPin, LOW);
}
// Control the green LED
if (button2State == LOW) {
digitalWrite(greenLedPin, HIGH);
} else {
digitalWrite(greenLedPin, LOW);
}
// Control the blue LED
if (button3State == LOW) {
digitalWrite(blueLedPin, HIGH);
} else {
digitalWrite(blueLedPin, LOW);
}
// Add any additional code for other functionalities
delay(100); // Add a small delay to avoid rapid readings
}