Difference: HardwareAccessGPIO (2 vs. 3)

Revision 32022-10-16 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="MinimalLectures"

Hardware access, the General Purpose Input Output (GPIO) pins.

Running the programs on the PC

Line: 31 to 30
  In order to understand how to access GPIO line we must look up the MicroPython documentation. Select Quick reference for the ESP32 and search for Pins and GPIO .
Changed:
<
<
As you can see, MicroPython supplies a Python module named Pin, which is used to program GPIO pins. In order to control a LED the corresponding pin must be programmed to be an output line.
>
>
The schematic diagram of the LED connection looks like this:

led.png

 
Added:
>
>
When the output level on GPIO 2 is zero, then there is no voltage across the LED and the resistor. The LED is switched off. If GPIO 2 is at high level, then there is a voltage of 3.3V across the LED and the resistor and the LED lights up. The 330 Ω resistor limits the current flowing through the LED to 10 mA.

As you can see, MicroPython supplies a Python module named Pin, which is used to program GPIO pins. In order to control a LED the corresponding pin must be programmed to be an output line.

 
from machine import Pin
from time import sleep
led = Pin(2,Pin.OUT) # the led is connected to GPIO 2 and this is an output line
Line: 53 to 58
 
META FILEATTACHMENT attachment="tripleBase.png" attr="" comment="" date="1665914356" name="tripleBase.png" path="tripleBase.png" size="200805" user="UliRaich" version="1"
META FILEATTACHMENT attachment="esp32_back.png" attr="" comment="" date="1665914587" name="esp32_back.png" path="esp32_back.png" size="169353" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="led.png" attr="" comment="" date="1665938650" name="led.png" path="led.png" size="5815" user="UliRaich" version="1"
META FILEATTACHMENT attachment="switch.png" attr="" comment="" date="1665938650" name="switch.png" path="switch.png" size="5608" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback