本文整理汇总了Python中arduino.Arduino.input方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.input方法的具体用法?Python Arduino.input怎么用?Python Arduino.input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arduino.Arduino
的用法示例。
在下文中一共展示了Arduino.input方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Arduino
# 需要导入模块: from arduino import Arduino [as 别名]
# 或者: from arduino.Arduino import input [as 别名]
from arduino import Arduino
import time
b = Arduino("/dev/tty.usbmodem1421")
pin = 13
# declare output pins as a list/tuple
b.output([pin, 13])
b.input([8])
b.servos([])
# for i in xrange(18):
# # b.setHigh(pin)
# # time.sleep(1)
# # print b.getState(pin)
# # b.setLow(pin)
# # print b.getState(pin)
# # time.sleep(1)
# an = 3.14/180 * i * 10
# an = i*10
# print an
# b.setAngle(12,an)
# time.sleep(1)
pos = 1
d = 1
s = 20
while 1:
button = b.digitalRead(8)
# if (button!=u'0\r'):
示例2: Arduino
# 需要导入模块: from arduino import Arduino [as 别名]
# 或者: from arduino.Arduino import input [as 别名]
import time
try:
b = Arduino('/dev/tty.usbmodem1421')
print "Connected to usbmodem1421"
except:
try:
b = Arduino('/dev/ttyACM0')
print "Connected to ttyACM0"
except:
b = Arduino('/dev/ttyUSB0')
print "Connected to ttyUSB0"
led_pin = 13
b.output([led_pin])
b.input([])
b.servos([])
print "Pin setup done"
for i in xrange(18):
b.setHigh(led_pin)
time.sleep(1)
print b.getState(led_pin)
b.setLow(led_pin)
print b.getState(led_pin)
time.sleep(1)
#servo1 = 13
#servo2 = 12