A few changes

Added correction factor
Change motor test code
This commit is contained in:
shrkey
2016-08-15 21:21:43 +01:00
parent 95d9be87cd
commit d56cf2f666
3 changed files with 17 additions and 14 deletions

View File

@@ -9,12 +9,12 @@ m4 = dw.getMotor(4)
m5 = dw.getMotor(5)
m6 = dw.getMotor(6)
m1.setMotorSpeed(0)
m2.setMotorSpeed(0)
m3.setMotorSpeed(0)
m4.setMotorSpeed(0)
m5.setMotorSpeed(0)
m6.setMotorSpeed(0)
m1.off()
m2.off()
m3.off()
m4.off()
m5.off()
m6.off()
time.sleep(1)
##time.sleep(10)
@@ -75,10 +75,10 @@ time.sleep(1)
print "Motor 6"
m6.setMotorSpeed(-255)
time.sleep(1)
print "All stop"
m1.setMotorSpeed(0)
m2.setMotorSpeed(0)
m3.setMotorSpeed(0)
m4.setMotorSpeed(0)
m5.setMotorSpeed(0)
m6.setMotorSpeed(0)
print "All off"
m1.off()
m2.off()
m3.off()
m4.off()
m5.off()
m6.off()

View File

@@ -96,7 +96,7 @@ class PCA9685(object):
oldmode = self._device.readU8(MODE1);
newmode = (oldmode & 0x7F) | 0x10 # sleep
self._device.write8(MODE1, newmode) # go to sleep
self._device.write8(PRESCALE, prescale)
self._device.write8(PRESCALE, int(math.floor(prescale)))
self._device.write8(MODE1, oldmode)
time.sleep(0.005)
self._device.write8(MODE1, oldmode | 0x80)

View File

@@ -227,6 +227,9 @@ class dw_Motor:
if (command == dw_Controller.RELEASE):
self.MC.setPin(self.PHpin, 0)
self.MC.setPin(self.ENpin, 0)
def off(self):
elf.run(dw_Controller.RELEASE, 0)
class dw_Servo:
def __init__(self, controller, num, freq):