serial-port

how to read multiple serial ports in realtime in C or Python

风流意气都作罢 提交于 2020-06-28 04:06:12
问题 I need to read multiple (at least 2) serial ports (currently two ports on a FT2232H module connected through USB). I am using it to monitor a serial connections, so the two ports have their RX connected in parallel to RX and TX of the serial I need to monitor. Setup is very similar to this. I am setting up ports like this: #define waitTime 0 int start_dev(const int speed, const char *dev) { int fd = open(dev, O_RDWR | O_NOCTTY |O_NONBLOCK| O_NDELAY); int isBlockingMode, parity = 0; struct

RedPitaya: No data in UART - can't read buffer

百般思念 提交于 2020-06-27 06:05:37
问题 I am trying to read out a Sensor on a RedPitaya (running Ubuntu). The sensor (RM08 rotary encoder by RLS) works with the SSI protocol. I connected the Clock wire to a Digital Output Pin and the Data wire to my Uart RX-PIN. What I want my program to do now is: After transmitting the clock-signal by my function "clock_signal()" I expect the sensor sending 8 bits of data to my UART via the RX-Pin. But when reading the RX Buffer with the following Code I only get the message "Again!" which means

Using VBA to control another program entirely

徘徊边缘 提交于 2020-06-25 04:06:32
问题 I'm currently working on simplifying a process at work. It involves a Chatillon DFIS Force Meter which uses a serial connection to transmit data. The data gets sent to the Chattillon program as text and can only be saved as a .dat file. I'm trying to set up an Excel workbook that can just automatically open the program and have different commands to put the information straight into Excel. The Commands would involve changing the units, zeroing the sensor, and transmitting. I've done some

async/await using serialport in node.js

霸气de小男生 提交于 2020-06-17 03:19:27
问题 Working on the communication between PC and an Arduino-based Hardware with Node.js. This last device is implemented with G-Code, so if i send ‘G0’ I will receive two lines; one to confirm that the instruction has been received and a second one with data. I would like to use async/await but something is wrong... here goes the code: 'use strict' const SerialPort = require('serialport') const Readline = SerialPort.parsers.Readline const cardPort = new SerialPort('COM6', { baudRate: 115200,

Pyserial when should I use flush?

女生的网名这么多〃 提交于 2020-06-17 02:08:07
问题 I'am working with pyserial and trying to write and read data to and from an arduino board. I saw several examples showing that flush should be used while reading and writing. I couldn't understand what is the role of flush even after reading the pyserial documentation. I also noticed that there is: flushInput() flushOutput() flush() What is the role of each one, why and when should I use it. I'd appreciate the explanation. 回答1: [Quotes from pySerial API documentation] flushInput() "Deprecated

Python Convert String to Byte

谁都会走 提交于 2020-05-30 08:06:36
问题 I am trying to do some serial input and output operations, and one of those is to send an 8x8 array to an external device (Arduino). The pySerial library requires that the information that I send be a byte. However, in my python code, the 8x8 matrix is made up of types <class 'str'> . Here's my sending function: import serial import Matrix width = 8 height = 8 portName = 'COM3' def sendMatrix(matrix): try: port = serial.Serial(portName, 9600, timeout = 1000000) port.setDTR(0) print("Opened

Python Convert String to Byte

℡╲_俬逩灬. 提交于 2020-05-30 08:06:31
问题 I am trying to do some serial input and output operations, and one of those is to send an 8x8 array to an external device (Arduino). The pySerial library requires that the information that I send be a byte. However, in my python code, the 8x8 matrix is made up of types <class 'str'> . Here's my sending function: import serial import Matrix width = 8 height = 8 portName = 'COM3' def sendMatrix(matrix): try: port = serial.Serial(portName, 9600, timeout = 1000000) port.setDTR(0) print("Opened

What is the equivalent of Serial.available() in pyserial?

萝らか妹 提交于 2020-05-25 06:38:11
问题 When I am trying to read multiple lines of serial data on an Arduino, I use the following idiom: String message = ""; while (Serial.available()){ message = message + serial.read() } In Arduino C, Serial.available() returns the number of bytes available to be read from the serial buffer (See Docs). What is the equivalent of Serial.available() in python? For example, if I need to read multiple lines of serial data I would expect to ues the following code: import serial ser = serial.Serial('/dev

Read/Write data returns null - Unable to perform any operations - node serialport

耗尽温柔 提交于 2020-05-17 07:04:45
问题 I am working with serialport for the first time and trying to establish a read and write connection with an UART device which is a controller of a height adjustment desk by using the below method. The application is a desktop application using electron. const SerialPort = require('serialport') const Readline = require('@serialport/parser-readline') const parser = new Readline() const port = new SerialPort("COM4", { baudRate: 9600 }) This is the code I have used and port.read() always returns

node.js path to serialport

匆匆过客 提交于 2020-04-13 09:18:09
问题 For this part of code for my node.js server var SerialPort = require("serialport"); var port = new SerialPort("/dev/tty-usbserial1", {}); wich use the https://github.com/EmergingTechnologyAdvisors/node-serialport library how I can know this path to my serial port? 回答1: To find the paths of available COM ports on the system, you can use the list method. I'd advise omitting any that have an undefined manufacturer property as these normally seem to be things like built-in bluetooth etc. Example: