本文整理汇总了Python中serial_manager.SerialManager.list_ports方法的典型用法代码示例。如果您正苦于以下问题:Python SerialManager.list_ports方法的具体用法?Python SerialManager.list_ports怎么用?Python SerialManager.list_ports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serial_manager.SerialManager
的用法示例。
在下文中一共展示了SerialManager.list_ports方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Utility
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import list_ports [as 别名]
from utilities import Utility
from serial_manager import SerialManager
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)
示例2: Utility
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import list_ports [as 别名]
from __future__ import unicode_literals
import sys
from os import path
sys.path.append(path.dirname(__file__) + 'lib/') #for generic functionality
sys.path.append(path.dirname(__file__) + 'modules/') #specific to various hardware
import random
import struct
from utilities import Utility
from serial_manager import SerialManager
utils = Utility()
manager = SerialManager()
print('\nSelect a port to connect to or a menu option below')
manager.list_ports()
from threads import AutoTimer, EventWrapper
from data_structures import v2_drivetrain as v2dt
from data_structures import mini_arm as marm
marm.status = ord('k')
v2dt.speed1 = 1
v2dt.speed2 = 255
v2dt.status = ord('k')
def e0():
manager.write(marm.get_outgoing_struct())
dataflag = False
示例3: print
# 需要导入模块: from serial_manager import SerialManager [as 别名]
# 或者: from serial_manager.SerialManager import list_ports [as 别名]
print("Select a baudrate:")
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)