#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
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn3:1.l
btn3:2.l
btn3:1.r
btn3:2.r