本文整理汇总了Python中pyfirmata.Arduino.readEEPROM方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.readEEPROM方法的具体用法?Python Arduino.readEEPROM怎么用?Python Arduino.readEEPROM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyfirmata.Arduino
的用法示例。
在下文中一共展示了Arduino.readEEPROM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Uarm
# 需要导入模块: from pyfirmata import Arduino [as 别名]
# 或者: from pyfirmata.Arduino import readEEPROM [as 别名]
#.........这里部分代码省略.........
def writeAngleRaw(self,servo_1,servo_2,servo_3,servo_4):
self.servo_base.write(self.angleConstrain(servo_1))
self.servo_left.write(self.angleConstrain(servo_2))
self.servo_right.write(self.angleConstrain(servo_3))
self.servo_end.write(self.angleConstrain(servo_4))
def readAnalog(self,servo_number):
if servo_number == 1:
for i in range(1,4):
data = self.uarm.readAnalogPin(2)
return data
elif servo_number == 2:
for i in range(1,4):
data = self.uarm.readAnalogPin(0)
return data
elif servo_number == 3:
for i in range(1,4):
data = self.uarm.readAnalogPin(1)
return data
elif servo_number == 4:
for i in range(1,4):
data = self.uarm.readAnalogPin(3)
return data
else:
return
def readServoOffset(self,servo_number):
if servo_number ==1 or servo_number ==2 or servo_number ==3:
addr = self.kAddrOffset + (servo_number - 1)*2
servo_offset = (self.uarm.readEEPROM(addr+1))/10.00
if(self.uarm.readEEPROM(addr) == 0):
servo_offset *= -1
return servo_offset
elif servo_number == 4:
return 0
else:
pass
def readToAngle(self,input_analog,servo_number,tirgger):
addr = self.kAddrAandB + (servo_number-1)*6
data_a = (self.uarm.readEEPROM(addr+1)+ (self.uarm.readEEPROM(addr+2)*256))/10.0
if (self.uarm.readEEPROM(addr) == 0):
data_a = -data_a
data_b = (self.uarm.readEEPROM(addr+4)+ (self.uarm.readEEPROM(addr+5)*256))/100.0
if (self.uarm.readEEPROM(addr+3) == 0):
data_b = -data_b
if tirgger == 0 :
return (data_a + data_b *input_analog) - self.readServoOffset(servo_number)
elif tirgger == 1:
return (data_a + data_b *input_analog)
else:
pass
def fwdKine(self,theta_1,theta_2,theta_3):
g_l3_1 = MATH_L3 * math.cos(theta_2/MATH_TRANS)
g_l4_1 = MATH_L4 * math.cos(theta_3 / MATH_TRANS);