Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/BramRausch/encoderLib
MicroPython library to handle a rotary encoder
https://github.com/BramRausch/encoderLib
Last synced: 24 days ago
JSON representation
MicroPython library to handle a rotary encoder
- Host: GitHub
- URL: https://github.com/BramRausch/encoderLib
- Owner: BramRausch
- Created: 2016-08-19T00:21:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-28T17:05:23.000Z (over 8 years ago)
- Last Synced: 2024-04-22T12:35:08.511Z (8 months ago)
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 8
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-micropython - encoderLib - MicroPython library to handle a rotary encoder. (Libraries / IO)
README
# encoderLib
EncoderLib is a library to handle a rotary encoder in MicroPython## Functions
### encoder
The encoder function initializes the library and it takes two parameters
```
encoderLib.encoder(int clk, int dt)
```### getValue
The getValue function returns the rotation and should be called continuous### example
```python
import encoderLiblast = 0
e = encoderLib.encoder(12, 13) # Initializes the library with pin CLK on 12 and pin DT on 13while True: # Infinite loop
value = e.getValue() # Get rotary encoder value
if value != last: # If there is a new value do
last = value
print(value) # In this case it prints the value
```