micropython-ULN2003-ESP32/README.MD

19 wiersze
724 B
Plaintext

2018-12-18 07:50:06 +00:00
# ULN2003 for ESP32
uln2003 for `MicroPython` has been in github, here's the [link](https://github.com/IDWizard/uln2003). But it's work for `microbit`, so I change a little to transplant for my NodeMCU's `ESP-32s`. Here's the example:
```python
import Stepper
from machine import Pin
s1 = Stepper.create(Pin(16,Pin.OUT),Pin(17,Pin.OUT),Pin(5,Pin.OUT),Pin(18,Pin.OUT), delay=2)
s1.step(100)
2020-06-11 09:28:25 +00:00
s1.step(100,-1) # or s1.step(-100)
2018-12-18 07:50:06 +00:00
s1.angle(180)
2020-06-11 09:28:25 +00:00
s1.angle(360,-1) # or s1.angle(-360)
2018-12-18 07:50:06 +00:00
```
function `angle` is angle, and the PIN map:
`IN1` link `PIN_16`
`IN2` link `PIN_17`
`IN3` link `PIN_5`
`IN4` link `PIN_18`
My uln2003 board like this, and stepper runing:<br />
2020-06-11 09:28:25 +00:00
![uln2003](img/uln2003.jpg) ![uln2003](img/stepper.gif)<br />