pyserial

pyserial serialwin32.py has attribute error

﹥>﹥吖頭↗ 提交于 2019-12-01 12:26:53
问题 I'm new to Python and trying to run a demo provide by Invensense. They provide a Python client which should take COM traffic and manipulate a graphic. The demo seems to crash out of the box and I'm not sure if I have something wrong with pyserial that I installed. The requirements were python2.7, pyserial and pygame. The pyserial executable serialwin32.py throws this error: Traceback (most recent call last): ....... File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 47, in open

Losing data in received serial string

♀尐吖头ヾ 提交于 2019-12-01 09:14:59
So part of a larger project needs to receive a long hex character string from a serial port using a raspberry pi. I thought I had it all working but then discovered it was losing a chunk of data in the middle of the string. def BUTTON_Clicked(self, widget, data= None): ser = serial.Serial("/dev/ex_device", 115200, timeout=3) RECEIVEDfile = open("RECIEVED.txt", "r+", 0) #unbuffered #Commands sent out ser.write("*n\r") time.sleep(1) ser.flush() ser.write("*E") ser.write("\r") #Read back string rx'd RECEIVED= ser.read() RECEIVED= re.sub(r'[\W_]+', '', RECEIVED) #remove non-alphanumeric characters

python code for serial data to print on window.

我是研究僧i 提交于 2019-12-01 08:21:35
I am quite new to python and pyserial. My pc was installed with python 2.7.4 with pyserial and I want to print the serially received data on a seperate window on my pc. First the window has to be opened, then after the serial data should print on that window. Here the window has to be opened once and the serial data has to be continously print on the window until the device stops tramsmitting the data. I tried with this code, but its worthless. please someone help me with the code. import serial import Tkinter from Tkinter import * s = serial.Serial('COM10',9600) # open serial port master = Tk

Pyserial Sending More than One Byte

こ雲淡風輕ζ 提交于 2019-12-01 07:32:44
问题 First time poster. Before I start, I just want to say that I am a beginner programmer so bear with me, but I can still follow along quite well. I have a wireless device called a Pololu Wixel, which can send and receive data wirelessly. I'm using two of them. One to send and one to receive. It's USB so it can plug straight into my Raspberry Pi or PC, so all I have to do is connect to the COM port through a terminal to read and write data to it. It comes with a testing terminal program that

python code for serial data to print on window.

℡╲_俬逩灬. 提交于 2019-12-01 07:24:48
问题 I am quite new to python and pyserial. My pc was installed with python 2.7.4 with pyserial and I want to print the serially received data on a seperate window on my pc. First the window has to be opened, then after the serial data should print on that window. Here the window has to be opened once and the serial data has to be continously print on the window until the device stops tramsmitting the data. I tried with this code, but its worthless. please someone help me with the code. import

Linux serial port buffer not empty when opening device

我怕爱的太早我们不能终老 提交于 2019-12-01 04:20:33
问题 I have a system where I am seeing strange behavior with the serial ports that I don't expect. I've previously seen this on occasion with usb-to-serial adapters, but now I'm seeing it on native serial ports as well, with much greater frequency. The system is set up to run automated tests and will first perform some tasks that cause a large amount of data to be outputted from the serial device while I do not have the ports open. The device will also reset itself. Only the tx/rx lines are

PySerial [Error 5] Access is Denied

泪湿孤枕 提交于 2019-11-30 23:27:36
I am trying to write a program in Python that will loop to keep checking the serial port (COM4) and print out a message when the character "1" is read from the serial port. I want to send "1" over the serial port from an Arduino gadget upon the push of a button. However, I get the error "[Error 5]: Access is Denied" when I try to create an instance of a serial object. (It automatically tries to open upon instantiation, which is where the error is, from what I can see from the file in the PySerial package that handles this.) My code: c = serial.Serial('COM4', 9600) while True: signal = c.read()

Trying to open a serial port with pyserial on WinXP -> “Access denied”

夙愿已清 提交于 2019-11-30 21:25:51
I'm trying to send data to an hplc pump via the serial port using python and pyserial. I tested the cable and the pump under linux (a gentoo derivative), where it worked perfectly, albeit as root. Now i have to use the code on a WinXP machine, where i always get an "Access denied" error when trying to open the port (i adjusted the parameters to COMxx instead of ttySxx, the port is found). I tried the serial port of the computer, as well as a USB2Serial adapter. I heard that WinXP was quite restrictive when it comes to trying to address some port with self written code. Is there a simpler

Read from two serial ports asynchronously

纵然是瞬间 提交于 2019-11-30 21:09:03
问题 I'd like to read from two (or more) serial ports (/dev/ttyUSB0 etc) at the same time in python on Linux. I want to read complete lines from each port (whichever has data) and process the results in the order received (without race conditions). As a simple example could just write the lines to a single merged file. I assume the way to do this is based on pyserial, but I can't quite figure out how to do it. Pyserial has non-blocking reads using asyncio and using threads. Asyncio is marked as

Serial Receiving from Arduino to Raspberry Pi with PySerial stops after a while

≡放荡痞女 提交于 2019-11-30 18:31:12
I'm working on a project in which I have to receive some 25 character data at a time in order to process it in Raspberry Pi. Here is the example code that generates some data I want to receive from Arduino: char i =0; char a =0; char b=0; void setup(){ Serial.begin(9600); for(i=0;i<25;i++){ Serial.print('l');} Serial.print('\n'); delay(2000); } void loop(){ for(i=0;i<25;i++){ for(a=0;a<i;a++){ if((a==9)||(a==19)||(a==24)) Serial.print('l'); else Serial.print('d'); } for(b=0;b<25-i;b++){ Serial.print('l'); } delay(2000); } } It sends a line like this 'llllddddllldddd...' This line is 25