#  2. Light up the LED

## 2.1.Overview
 
 This section mainly focuses on understanding the characteristics of the main control board and expansion board, learning
 how to burn code and lighting the green LED on the expansion board through the program.
 
## 2.2.Control board resources
 
### 2.2.1.ESP32-S3-PLUS main control board
* All I/O ports provided by the main control board support PWM;
* Some I/O second functions also support SPI/IIC/clock output and other functions;
* Tpye-C input voltage is 5V;
* DCinput voltage 7V~9V

<img src="https://cdn.mkaidevops.xyz/tscinbuny/esp32_s3_plus/ESP32S3-Pinout.jpg" width="100%" height="100%"/>

### 2.2.2 Expansion board

<img src="https://cdn.mkaidevops.xyz/tscinbuny/esp32_s3_plus/expansion_board.png" width="800" height="600"/>

## 2.3.Connect the line

<img src="https://cdn.mkaidevops.xyz/tscinbuny/esp32_s3_plus/2.lesson_connect_line.png" width="800" height="600"/>

## 2.4. Upload code program

### 2.4.1. Connect the main control board to the computer with a USB cable

<img src="https://cdn.mkaidevops.xyz/tscinbuny/esp32_s3_plus/upload_code_program.png" width="800" height="600"/>
  
### 2.4.2. Open the " 2_ESP32_S3_PLUS \Lesson_2_Light_up_the_LED" code file

Select the board type as ESP32S3 Dev Module. When plugging in the USB, a new COM number will be displayed. Select it.

Here it is COM(x), but the actual COM number will be different for everyone.

<img src="https://cdn.mkaidevops.xyz/tscinbuny/esp32_s3_plus/arduino_program_run.png" width="800" height="600"/>

 Click "Upload" to start compiling and uploading the program to the main control board.
 Waiting for the program to upload;

 After the program upload is completed , you can see that the green light of LED2 is on.

## 2.5. Code analysis
 this " sketch " code consists of comments. These are not actual program instructions; instead, they simply explain how to
 make the program work. They are there for your ease of reading . Everything between " /* " and " */ " at the top of the
 sketch is a block comment that explains the purpose of the sketch.
 Single-line comments begin with "//" and everything up to the end of the line is considered a comment.
 
The first part of the code is:

```cpp
#define LED 13  // Define the LED lamp output pin

void setup() {
  pinMode(LED, OUTPUT);    // Define the operation mode of the pin
  digitalWrite(LED, LOW);  // Output low level
}
```


 * Every sketch requires a "set" function , which is a "void setup()" function, this is executed when the reset button is
 pressed. 
 * It is executed whenever the board resets for any reason, such as first power-up or after uploading a sketch.
 * The next step is to name the pin and set the output. Here, set " LED " as the output port, and digitalWrite(LED,LOW)
 controls the pin to output a low level, which is to turn off.
 *The sketch must also have a " loop " function. Unlike the "Set " function, which only runs once , after a reset, the "Loop "
 function will start again immediately after completing the command run.

```cpp
void loop() {
  // Because the negative electrode of the LED lamp is already connected to the GND, 
  // it only needs to output a high level to run and light the LED lamp
  digitalWrite(LED, HIGH);
}
```

 Inside the loop function, the command turns on the LED ( high )