Hackaday’s own [Jeremy Cook] has been testing out the pyMCU board and managed to put together an animated block head that looks like it could be a foe in Minecraft. That’s thanks mostly to the block of foam he’s using as a diffuser. The face of the project is a set of LEDs. These, along with the servo motors that move the neck are controlled using Python code which you can glance at after the break (there’s a video demo there too).
We first saw pyMCU early in the year. The PIC 16F1939 offers plenty of IO and acts as a USB connected bridge between your hardware and your Python scripts. Speaking of hardware, the test platform used to be an RC helicopter. [Jeremy] scrapped most of it, but kept the servo motors responsible for the pitch of the rotors. The board makes these connections easy, and the concept makes controlling them even easier. In fact, there’s only about 17 lines of code for the functions that control the servos. The rest is a simple UI built with Tkinter.
# File: hello2.py from Tkinter import * import pymcu # Import pyMCU module mb = pymcu.mcuModule() # Create a new pyMCU class object from first found pyMCU board class App: def __init__(self, master): frame = Frame(master) frame.pack() self.button = Button(frame, text="QUIT", fg="red", command=frame.quit) self.button.pack(side=LEFT) self.servos_up = Button(frame, text="nod up", command=self.nod_up) self.servos_up.pack(side=LEFT) self.servos_down = Button(frame, text="nod down", command=self.nod_down) self.servos_down.pack(side=LEFT) self.tilt_left = Button(frame, text="tilt left", command=self.tilt_left) self.tilt_left.pack(side=LEFT) self.tilt_right = Button(frame, text="tilt right", command=self.tilt_right) self.tilt_right.pack(side=LEFT) def nod_up(self): print "nod up" mb.pinHigh(1) mb.pausems(20) mb.pulseOut(11,1300,20) mb.pinHigh(2) def nod_down(self): print "nod down" mb.pulseOut(11,800,20) mb.pinLow(1) mb.pinLow(2) def tilt_left(self): print "tilt left" mb.pulseOut(10,1000,20) def tilt_right(self): print "tilt right" mb.pulseOut(10,1600,20) root = Tk() app = App(root) root.mainloop()
5 thoughts on “PyMCU Test Project Looks Like A Minecraft Mob”
wow hackaday is responsive. wow!
awesome use of a trainer kit for an RC chopper. Never would have thought of using that as legs.
FTDI USB to UART chips make me angry!!!!!
creepy bot is creepy
i was expecting it to walk too…
Please be kind and respectful to help make the comments section excellent. (Comment Policy)