https://github.com/tratteo/esp32_pin_driver
A simple universal pin driver for ESP32 Dev boards
https://github.com/tratteo/esp32_pin_driver
driver esp32 iot
Last synced: about 2 months ago
JSON representation
A simple universal pin driver for ESP32 Dev boards
- Host: GitHub
- URL: https://github.com/tratteo/esp32_pin_driver
- Owner: tratteo
- Created: 2024-10-31T17:35:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-05T12:11:37.000Z (8 months ago)
- Last Synced: 2025-11-05T14:17:32.197Z (8 months ago)
- Topics: driver, esp32, iot
- Language: C++
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## ESP32 Universal pin driver ๐
> [!IMPORTANT]
> Currently supporting only Serial (USB) communication.
### โก Commands
```c
operation:mode:pin:value?
```
**Operation** `[write, read]`
**Mode** `[digital, analog]`
**Pin** `uint8_t`
Safe GPIOs `[4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33, 34, 35, 36, 39]`.
Pin mapping [here](include/esp32_gpio_mapping.cpp).
**Value** `int`
Value is automatically clamped to 8 bit:`[0, 255]`.
> [!NOTE]
> In digital write, pin is set to high if the value is greater than 0.
Examples:
```c
write:digital:13:0
write:analog:25:128
read:digital:19
read:analog:33
```
The ESP32 board available pins depend on the operation and mode used. Check out [esp32_gpio_mapping.cpp](include/esp32_gpio_mapping.cpp) for pin availability. For detailed information, check out the [ESP32 Pinout](https://lastminuteengineers.com/esp32-pinout-reference/).
### ๐งช Testing
To test program using the [Python utility](serial_test.py), install `pyserial`:
```sh
pip install pyserial
```
The run the script:
```sh
python serial_test.py
```
To edit the Serial port, edit the following line in the script:
```py
ser = serial.Serial("