//Pins are defined here(defined as a integer constant and not a variable)
const int buttonRed = D9;
const int buttonGreen = D8;
const int buttonBlue = D7;

const int ledRed = D2;
const int ledGreen = D3;
const int ledBlue = D4;

void setup() {
  Serial.begin(115200); //Starts serial communication at 115200 baud rate
  Serial.println("Ready"); //Prints Ready when the program has started successfully

  pinMode(buttonRed, INPUT);  // When the button is not pressed, the pin reads HIGH (due to the pull-up resistor)
  pinMode(buttonGreen, INPUT); 
  pinMode(buttonBlue, INPUT);

  pinMode(ledRed, OUTPUT); //This allows the microcontroller to control the LEDs by setting them HIGH (turning them on) or LOW (turning them off)
  pinMode(ledGreen, OUTPUT);
  pinMode(ledBlue, OUTPUT);

  digitalWrite(ledRed, LOW); //ensures that all LEDs are off at the start of the program
  digitalWrite(ledGreen, LOW);
  digitalWrite(ledBlue, LOW);
}

void loop() {
  bool redState = digitalRead(buttonRed); //reads the current state (HIGH or LOW) of each button
  bool greenState = digitalRead(buttonGreen);
  bool blueState = digitalRead(buttonBlue);

  digitalWrite(ledRed, !redState); //controls each LED by setting it to HIGH (on) or LOW (off)
  digitalWrite(ledGreen, !greenState);
  digitalWrite(ledBlue, !blueState);

  Serial.print("Red: "); Serial.print(!redState); //Prints the LED states (1 for on, 0 for off) to the Serial Monitor
  Serial.print(" Green: "); Serial.print(!greenState);
  Serial.print(" Blue: "); Serial.println(!blueState);

  delay(100);
}
esp:D0
esp:D1
esp:D2
esp:D3
esp:D4
esp:D5
esp:D6
esp:D7
esp:D8
esp:D9
esp:D10
esp:3V3
esp:GND
esp:5V
led1:A
led1:C
r1:1
r1:2
led2:A
led2:C
r2:1
r2:2
led3:A
led3:C
r3:1
r3:2
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
r4:1
r4:2
r5:1
r5:2
r6:1
r6:2