​ We should pull high level at one side of the LED light , and connect the other side to GND, that would make the light shine .This is the base role .

​ Because we need to make J1 at high level to let led shine , so we have to connect one gpio of esp32 with J1 terminal.Here are 8 led and corresponding J1 teminal and GPIO (15,2,0,4,16,17,5,18)

​ Now here’s the problem, how can we program with micropython to control the GPIO of esp32?

​ MicroPython supply one module named machine . machine supply a lot of elements to support us to control GPIO , Now we use Pin of machine here .

​ led = machine.Pin(id, mode,pull)

​ to create one object named led, id is number of gpio,mode :out, in ,pull up or down resistance.

​ led.value([x]) x=0 low level , x=1 high level

​ led.on() equal to led.value(1)

​ led.off() equal to led.value(0)

​ main.py

from machine import Pin

led_1 =  machine.Pin(15, Pin.OUT)
led_1.value(1)

Next post

buzzer