Mise à jour de 'PWMDriver.py'
This commit is contained in:
parent
ce5fc4c445
commit
9ef67cb37d
1 changed files with 51 additions and 54 deletions
|
@ -26,7 +26,6 @@ class PWMDriver:
|
|||
ini_esc(LESC[1])
|
||||
ini_esc(LESC[2])
|
||||
ini_esc(LESC[3])
|
||||
|
||||
def setAngle(self, slot, angle, profileName = 'default'):
|
||||
profile = None
|
||||
if type(profileName) is dict:
|
||||
|
@ -45,10 +44,8 @@ class PWMDriver:
|
|||
pulse = int(self.mappyt(angle, 0, profile['range'], profile['min'], profile['max']))
|
||||
#print('setting slot', slot, 'to angle', angle, 'with profile', profileName, profile, pulse)
|
||||
self.driver.set_pwm(slot, 0, pulse)
|
||||
|
||||
def setPwm(self, slot, off, on):
|
||||
#self.driver.set_pwm(slot, off, on)
|
||||
self.driver.set_pwm(slot, off,on)
|
||||
|
||||
def mappyt(self, x, inMin, inMax, outMin, outMax):
|
||||
return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin
|
||||
|
|
Loading…
Reference in a new issue