serial-port

How to solve this plotting problem in serial communication?

旧巷老猫 提交于 2019-12-13 03:19:06
问题 Here this simple code: #import serial from tkinter import * from matplotlib import pyplot as plt import matplotlib.animation as animation from matplotlib import style from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import serial fig = plt.gcf() fig.show() fig.canvas.draw() ser = serial.Serial('COM35', 115200, timeout=.1) while True: data = ser.readline() print(data) plt.plot(data) fig.canvas.draw() now when i run this i'm getting something like this..in pic and the data values

MATLAB serial port connection is too slow

℡╲_俬逩灬. 提交于 2019-12-13 02:54:27
问题 I've got a detector that spits out two numbers at a high rate when I turn it on. I've been capturing my data using HyperTerminal, which seems to be able to keep up with the device. I wanted to automate the process and control the device entirely through Matlab, but discovered that less than half of the data gets through to Matlab. Are there any known issues with Matlab's speed in this area? Here's what I'm using to read in data: s = serial('COM1', 'BaudRate', 115200, 'DataBits', 8,

Serial port timeout- 10 seconds, but getting less samples than expected/desired

别来无恙 提交于 2019-12-13 02:34:53
问题 I have the following error while trying to access serial port data sent from Nios II UART: The specified amount of data was not returned within the Timeout period or A timeout occurred before the Terminator was reached. The above error occurs when I set the timeout to be smaller than 10 seconds, say 2 seconds, or 6 or 8 etc. set(s,'BaudRate',115200,'timeout',10); %timeout is in seconds. If I set the timeout to be as '10' or larger, I did not get the timeout error, however, with this timeout,

input() is blocking the use of processes

一曲冷凌霜 提交于 2019-12-13 02:11:57
问题 I have a problem with multiprocessing. If I am waiting for input in a thread the process is not starting. The class to put the input into a queue in the background: class InputCatcher(Thread): def __init__(self, input_queue): Thread.__init__(self) self.input_queue = input_queue def run(self): while True: self.input_queue.put(input()) # <<-- Without this it works! The class that will not start: class Usb(Process): def __init__(self, port, ctrl=Controller()): Process.__init__(self) self.usb

How can I discover if a device is connected to a specific serial (COM) port?

↘锁芯ラ 提交于 2019-12-13 01:30:28
问题 How can I discover, using C#'s SerialPort class, whether a device is connected to a specific serial (COM) port? Note: that class's Open method opens the port even if there is no device connected to the port. 回答1: The answer depends on the device and the cable. In some cases, DSR ( SerialPort.DsrHolding ) or even CTS ( SerialPort.CtsHolding ) will be raised when the device is connected. But in some cases you may only have Tx / Rx connected, and the only way to tell is to attempt to communicate

PyQT real time display of serial port data throwing maximum recursion depth exceeded exception on QtCore.QTimer.singleShot()

纵然是瞬间 提交于 2019-12-13 01:29:09
问题 My application scenario: Read continues data (realtime) from serial port and display on PyQt GUI and also store data in csv file. I have tried to use While loop. <-- which does not work due to the call blocking. So, on second hand I have tried QtCore.QTimer.singleShot(1, methodname) . Which throwing recursion exception. My Code: # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'D:\TUK\Master Thesis\ML\Lable_Data.ui' # # Created by: PyQt5 UI code generator 5.11.2 #

Specificity in importing python module?

天大地大妈咪最大 提交于 2019-12-13 01:28:01
问题 I've been working with the PySerial library for pythonPyserial API, and I can't seem to understand why I have to specifically import a certain part of the module. This will give me an error: import serial for item in serial.tools.list_ports.comports(): print item The above snippet will return "AttributeError: type object 'Serial' has no attribute 'tools'" If I import that attribute specifically, I get no errors: import serial.tools.list_ports for item in serial.tools.list_ports.comports():

UDEV-How to get value of a child device attributes

試著忘記壹切 提交于 2019-12-13 01:22:03
问题 I am writting an udev rule to set name of two serial ports. I want to use the value of the attribute bInterfaceNumber in the symlink. My rules is: SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", SYMLINK+="toto%s{bInterfaceNumber}" The rule matched the device but value of the attribute is never found. Here is the hierarchical view of one device: console@host:udevadm info --name=/dev/ttyUSB0 --attribute-walk looking at parent device '/devices/pci0000:00

CashCode Bill2Bill communication error on linux

无人久伴 提交于 2019-12-13 01:02:58
问题 We are facing the same problem as described here link with Bill2Bill on linux system. Everything works on Windows, but on linux after sending POLL command {0x02, 0x01, 0x06, 0x33, 0x62, 0x34} we can't read any data from serial port. Device is stucked and do not respond. We've already tried solution posted in that topic but with no luck. Is there any possibility that bytes wrote to serial port on linux are somehow changed and bill2bill gets modified data or structure ? 回答1: As it turned out

Reconnect Serial Port on Processing

人盡茶涼 提交于 2019-12-13 00:42:25
问题 I'm using processing and I'm reading inputs from Arduino with a serial port but connection drop may occur, in this case how to I reopen this connection? 回答1: You can catch RuntimeExceptions thrown by Serial.java, which generally indicate the serial port is no longer available. Within that catch block, then, you can start polling the serial port; once it allows you to reinstantiate your Serial instance, the port is again available (e.g. the USB cable is plugged back in) and you're back in the