Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from microbit import *
- import tm1637
- tm=tm1637.TM1637(clk=pin15,dio=pin16)
- def servo(pin,degrees):
- degrees=max(0, min(degrees, 180))
- duty= degrees / 180 * 102 + 25
- pin.write_analog(duty)
- while(1):
- tm.write([0x01,0,0,0])
- sleep(30)
- tm.write([0,0x01,0,0])
- sleep(30)
- tm.write([0,0,0x01,0])
- sleep(30)
- tm.write([0,0,0,0x01])
- sleep(30)
- tm.write([0,0,0,0x02])
- sleep(30)
- tm.write([0,0,0,0x04])
- sleep(30)
- tm.write([0,0,0,0x08])
- sleep(30)
- tm.write([0,0,0x08,0])
- sleep(30)
- tm.write([0,0x08,0,0])
- sleep(30)
- tm.write([0x08,0,0,0])
- sleep(30)
- tm.write([0x10,0,0,0])
- sleep(30)
- tm.write([0x20,0,0,0])
- sleep(30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement