Revision: 15 http://acme-dev.svn.sourceforge.net/acme-dev/?rev=15&view=rev Author: claudyus Date: 2010-02-15 16:35:40 +0000 (Mon, 15 Feb 2010) Log Message: ----------- fox.py: a simple motors class Modified Paths: -------------- python/fox.py Modified: python/fox.py =================================================================== --- python/fox.py 2010-02-15 16:31:05 UTC (rev 14) +++ python/fox.py 2010-02-15 16:35:40 UTC (rev 15) @@ -141,3 +141,23 @@ ser.write("s%c%c%c%c%c%s%c" % (int(x),int(y),1,0xFF,0xFF,string,0x00)) ser.read(1) +class motor: + """This class can be used to control a standard DC motor using two GPIO pins. +Class define three methods: forward(), backward() and stop()""" + def __init__ (self, pin1, pin2): + self.pt1 = pin( pin1, "out") + self.pt2 = pin( pin2, "out") + self.off() + + def forward(): + pt1.on() + pt2.off() + + def backward(): + pt1.off() + pt2.on() + + def stop(): + pt1.off() + pt2.off() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.