本文整理汇总了Python中serial_manager.SerialManager.open_port方法的典型用法代码示例。如果您正苦于以下问题:Python SerialManager.open_port方法的具体用法?Python SerialManager.open_port怎么用?Python SerialManager.open_port使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serial_manager.SerialManager
的用法示例。
在下文中一共展示了SerialManager.open_port方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Utility
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import open_port [as 别名]
from pololu_controller import PololuController
from Servo import *
from data_structures import mini_arm as marm
utils = Utility()
alive = True
def quit():
global alive
alive = False
manager1 = SerialManager()
print 'Ports available'
manager1.list_ports()
print 'Select Dynamixel port'
user_input = utils.getch()
if manager1.open_port(user_input, 57600):
serv_2 = Robotis_Servo(manager1, 1)
print 'Setting up Dynamixel 2'
print 'Dynamixel 2 at ' + str(serv_2.read_angle())
while(alive):
serv_2.move_angle(1, 1.5, blocking=False)
time.sleep(1)
serv_2.move_angle(2, 1.5, blocking=False)
time.sleep(1)
manager1.close()
示例2: e1
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import open_port [as 别名]
def e1():
global dataflag
dataflag = manager.receive_into(marm)
manager.write(v2dt.get_outgoing_struct())
def e2():
manager.receive_into(v2dt)
pass
ev0 = EventWrapper(e0, 0)
ev1 = EventWrapper(e1, marm.calculate_timeout(115200))
ev2 = EventWrapper(e2, marm.calculate_timeout(115200) + v2dt.calculate_timeout(115200))
sertest = AutoTimer(period=1, events=[ev0,ev1,ev2])
if manager.open_port('0', 115200):
sertest.start()
try:
while True:
if dataflag:
print(marm.voltages)
print(marm.test)
dataflag = False
#user_input = raw_input()
'''
if manager.open_port(user_input, 115200):
sertest.start()
示例3: print
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import open_port [as 别名]
for baudrate in baudrates :
print(str(baudrate) + ' bps')
current_baudrate = raw_input()
print (str(current_baudrate))
if int(current_baudrate) not in baudrates:
print('incorrect baudrate selected')
quit()
ser.list_ports()
for i, port in enumerate(ser.ports):
if ser.open_port(i, current_baudrate):
print('Scanning at ' + str(current_baudrate))
for i in range(0, 10):
print('scanning servo at id ' + str(i))
try:
r = Robotis_Servo(ser, i);
ang = r.read_angle()
print('Servo found at id ' + str(i) + ' at angle %.3f' % ang)
except RuntimeError, e:
pass
ser.serial_io.close()
time.sleep(1)
servo_list = []