serial-port

ValueError: "port" must be None or a string, not <class 'int'>

ValueError: "port" must be None or a string, not <class 'int'> Question: I am trying to issue commands to my usb connected lock controller. The code runs fine until this line: Connected ports: [‘COM6’] Please enter the port number that has port connected. i.e. if COM3 is shown, enter 3 when ask to enter port …

Total answers: 1

VI_ERROR_TMO (-1073807339)

VI_ERROR_TMO (-1073807339) Question: I’m using RS-232 port to communicate with KeithleyInstruments(SCPI Protocol) and have a problem.I can send the write command but when I send a query command it*s show the error below. import visa rm = visa.ResourceManager() inst = rm.list_resources() print inst # print inst –> (u’USB0::0x05E6::0x2200::9060025::INSTR’, u’ASRL1::INSTR’, u’ASRL6::INSTR’, u’ASRL7::INSTR’, u’ASRL10::INSTR’, u’GPIB0::16::INSTR’) keithleyInst= rm.open_resource(‘ASRL7::INSTR’) …

Total answers: 2

Connecting via USB/Serial port to Newport CONEX-PP Motion Controller in Python

Connecting via USB/Serial port to Newport CONEX-PP Motion Controller in Python Question: I’m having trouble getting my Windows 7 laptop to talk to a Newport CONEX-PP motion controller. I’ve tried python (Spyder/Anaconda) and a serial port streaming program called Termite and in either case the results are the same: no response from the device. The …

Total answers: 3

Reading serial data in realtime in Python

Reading serial data in realtime in Python Question: I am using a script in Python to collect data from a PIC microcontroller via serial port at 2Mbps. The PIC works with perfect timing at 2Mbps, also the FTDI usb-serial port works great at 2Mbps (both verified with oscilloscope) Im sending messages (size of about 15 …

Total answers: 4

pySerial 2.6: specify end-of-line in readline()

pySerial 2.6: specify end-of-line in readline() Question: I am sending commands to Eddie using pySerial. I need to specify a carriage-return in my readline, but pySerial 2.6 got rid of it… Is there a workaround? Here are the Eddie command set is listed on the second and third pages of this PDF. Here is a …

Total answers: 5

pyserial: No module named tools

pyserial: No module named tools Question: I have installed the latest pySerial on my Ubuntu box with python 2.7.2, and it works fine for most things, but whenever I try to import the ‘tools’ package, it says that it can’t find ‘tools’. The documentation for pySerial explicitly references this ‘tools’ package. >>> from serial import …

Total answers: 11

Python AttributeError: 'module' object has no attribute 'Serial'

Python AttributeError: 'module' object has no attribute 'Serial' Question: I’m trying to access a serial port with Python 2.6 on my Raspberry Pi running Debian. My script named serial.py tries to import pySerial: import serial ser = serial.Serial(‘/dev/ttyAMA0’, 9600) ser.write("hello world!") For some reason it refuses to establish the serial connection with this error: AttributeError: …

Total answers: 7

Python: Making a beep noise

Python: Making a beep noise Question: I’m trying to get the program to give me a beeping noise. I’m on a windows machine. I’ve looked at http://docs.python.org/library/winsound.html But not sure how I can program this with a barcode scanner. Here is my code for the serial barcode scanner. ser = serial.Serial() ser.baudrate = 9600 #for …

Total answers: 12

Fake serial communication under Linux

Fake serial communication under Linux Question: I have an application where I want to simulate the connection between a device and a “modem”. The device will be connected to a serial port and will talk to the software modem through that. For testing purposes I want to be able to use a mock software device …

Total answers: 4

Listing serial (COM) ports on Windows?

Listing serial (COM) ports on Windows? Question: I’m looking for a robust way to list the available serial (COM) ports on a Windows machine. There’s this post about using WMI, but I would like something less .NET specific – I want to get the list of ports in a Python or a C++ program, without …

Total answers: 8