OttoDIY / OttoDIYPython

port of the OttoDIY Robot API (Otto9.h & Otto9Humanoid.h) to a micropython based platform
https://github.com/OttoDIY/OttoDIYPython
MIT License
21 stars 15 forks source link

otto_servo.py for esp8266 & ESP32 #1

Closed sfranzyshen closed 3 years ago

sfranzyshen commented 4 years ago

servo.py for esp8266 & ESP32

sfranzyshen commented 4 years ago

https://bitbucket.org/thesheep/micropython-servo/src/tip/servo.py http://docs.micropython.org/en/latest/esp8266/tutorial/pwm.html?highlight=servo#control-a-hobby-servo https://github.com/kevinmcaleer/botOS/blob/b60bbabe5fddd65e22ff6c02e735199bbca30f5a/botos/servo.py https://github.com/kevinmcaleer/botOS/blob/master/botos/servo.py

sfranzyshen commented 4 years ago

first go at the servo driver is up ... i tried to keep it as close to the arduino servo driver ... but I only included what the OttoDIY required ... no support for reading position for an example ... I tested this out using a esp8266 with the latest micropython firmware ...

>>> import servo
>>> ser = servo.Servo()
>>> ser.attach(14)
>>> ser.attached()
True
>>> ser.write(0)
>>> ser.write(90)
>>> ser.write(180)
>>> ser.detach()
>>> ser.attached()
False
sfranzyshen commented 4 years ago

first working code is up ...