本文整理汇总了Python中pyfirmata.Arduino.get_shield方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.get_shield方法的具体用法?Python Arduino.get_shield怎么用?Python Arduino.get_shield使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyfirmata.Arduino
的用法示例。
在下文中一共展示了Arduino.get_shield方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Arduino
# 需要导入模块: from pyfirmata import Arduino [as 别名]
# 或者: from pyfirmata.Arduino import get_shield [as 别名]
INPUT = 0
OUTPUT = 1
ANALOG = 2
PWM = 3
SERVO = 4
### Values for motor direction
FORWARD = 1
BACKWARD = 2
BRAKE = None # These don't work.
RELEASE = None
clients = []
yun = Arduino('/dev/ttyATH0', baudrate=115200)
s = yun.get_shield()
m1 = s.get_motor(1)
m2 = s.get_motor(2)
m1.dir, m2.dir = FORWARD, FORWARD
m1.spd, m2.spd = 0,0
yun.servo_config(9);
yun.servo_config(10);
yun.digital[10].write(60); # Start it at a different angle, so it can move opposite the other servo
def butane_on():
yun.digital[9].write(60);
yun.digital[10].write(0);
def butane_off():
yun.digital[9].write(0);
yun.digital[10].write(60);