Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/HowManyOliversAreThere/micropython-8encoder
A MicroPython library for the M5 8Encoder.
https://github.com/HowManyOliversAreThere/micropython-8encoder
Last synced: 3 months ago
JSON representation
A MicroPython library for the M5 8Encoder.
- Host: GitHub
- URL: https://github.com/HowManyOliversAreThere/micropython-8encoder
- Owner: HowManyOliversAreThere
- Created: 2023-04-26T12:26:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-27T07:57:49.000Z (over 1 year ago)
- Last Synced: 2024-04-22T12:35:10.345Z (7 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-micropython - micropython-8encoder - Driver for the I2C [M5Stack 8-Encoder Unit](https://shop.m5stack.com/products/8-encoder-unit-stm32f030) (Libraries / IO)
README
# M5 8Encoder
This is a MicroPython library for the [M5 8-Encoder](https://shop.m5stack.com/products/8-encoder-unit-stm32f030).
Features:
- ✅ Read encoder counter values
- ✅ Read encoder increment values
- ✅ Reset counter values
- ✅ Read button values
- ✅ Read switch value
- ✅ Set LEDs
- ✅ Read firmware version## Usage
```python
from machine import Pin, SoftI2C
from m5_8encoder import M5_8Encoderi2c = SoftI2C(sda=Pin(SDA_PIN_NUM), scl=Pin(SCL_PIN_NUM), freq=100000)
encoder = M5_8Encoder(i2c)
```See the `examples` folder for a basic example of how to utilise the `M5_8Encoder` object, and see `m5_8encoder.py` for the class definition and all of the available methods.
You will need to ensure you're setting SDA and SCL pin numbers correctly, and note that the examples here use the `SoftI2C` module but you could also use `I2C` (hardware I2C instead of software I2C) depending on your port / board.