serial-port

Why don't serial ports work properly in Unity?

老子叫甜甜 提交于 2020-01-21 07:39:10
问题 I need help, I'm desperate During two weeks I have been working in my project, this uses serial port communication (a PIC serial board). I got to set the connection up, but I can not get data from the COM port. I've read some forums and the cause of the problem seems to be the incomplete implementation of System.IO.Ports class . When I try to get data of the COM port, the event SerialDataReceivedEventHandler (represents the method that will handle the DataReceived event of a SerialPort object

Change properties in device manager

ぐ巨炮叔叔 提交于 2020-01-17 08:16:13
问题 i am working with serial device, i want to communicate my computer with microcontroller. In my C# program, i can set the baud rate, stop bits, data bits etc. These just in my C# program. For example, i set the baud rate 115200 in microcontroller and my C# program, But when i see the properties of my device in device manager, the baud rate is still using default, 9600 bps. I don't know if it is good or no for communication, my C# program and microcontroller using 115200bps, and in the

How to build byte array frame and calculate checksum

北城以北 提交于 2020-01-17 07:52:11
问题 I'm trying to communicate with a serial port as defined in a specification. ser = serial.Serial("/dev/ttyUSB0", baudrate="115200") frame = bytearray([ 0x00, 0x00, #frame control (2 bytes) 0x00, 0x00, #machine id (2 bytes) 0x07, # number of bytes in data field 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, #data field itself 0x00, 0x0A #checksum ]) ser.write(frame) ser.close() The code executes without error, and I am monitoring the same port in a separate script/process. The device is supposed to

Where does 'baud rate' value go in serial Android-2-Arduino communication over USB

孤街浪徒 提交于 2020-01-17 06:42:52
问题 Issues with Android-2-Arduino communication made it clear to me I have no clue which parts of the chain are (directly) affected by the baud rate. Could you please confirm/correct following assumptions? The 'baud rate' value is not related to anything on the Android side. Therefore it is not a bug when an Android USB/Serial library only sends the baud rate value (9600, 125000, etc.) to the other side via controlTransfer, not storing it anywhere, not setting it somehow to the Android device

C# SerialPort: ReadLine not working

无人久伴 提交于 2020-01-17 05:40:08
问题 i'm having issues reading input from a serial port in C#. The device, that is connected via usb, is a ELM327-Chip for reading the OBD-port of the car. My Code consist of two threads: A Write- and a Read-Thread. It looks like the following: static volatile SerialPort moPort; ... moPort = new SerialPort("COM3"); moPort.BaudRate = 38400; moPort.Parity = Parity.None; moPort.DataBits = 8; moPort.StopBits = StopBits.One; moPort.NewLine = "\r"; moPort.ReadTimeout = 5000; moPort.Open(); Write-Thread:

Why am I getting the same performance from Hardware Serial and Software Serial?

北慕城南 提交于 2020-01-17 04:59:08
问题 I'm trying to interface (1) LinkSprite JPEG Color Camera TTL Interface - Infrared and (2) Arduino Mega 2560 connected to my laptop. While I am able to print the HEX values of the images, it takes about 30 seconds to print 1 image to the monitor. I thought that it was because I was using SoftwareSerial, so I tried HardwareSerial, but still, 30 seconds per image. Shouldn't it be faster using HardwareSerial? Just wondering, do I need a special cable connecting the arduino to my laptop? I tried

unsupported operand type(s) for %: 'bytes' and 'str'

非 Y 不嫁゛ 提交于 2020-01-17 04:25:11
问题 I receive the error in the following line: command = input("please type command.example open 1") #call the serial_connection() function ser.write(b"%d\r\n"%command) Essentially I want the input written by the user and parse it into ser.write, without asking for the input and directly putting the string into ser.write such as: ser.write(b'close1\r\n') worked fine, the problem only occurred when i try to use the result of the input as a string to include in ser.write A bit more of the code: ser

Reading raw serial data in Matlab

北城余情 提交于 2020-01-17 02:21:26
问题 I'm trying to read some raw telemetry data via serial. Each message terminates with \r\n and there are 4 kinds of messages. I setup the port like this: if exist('s') fclose(s); delete(s); clear s; end s = serial('/dev/ttyS99'); s.BaudRate = 57600; s.BytesAvailableFcnMode = 'terminator'; s.Terminator = 'CR/LF'; s.DataBits = 8; s.Parity = 'none'; s.StopBits = 1; s.BytesAvailableFcn = @serial_callback; s.OutputEmptyFcn = @serial_callback; fopen(s); For the calback, i wrote a simple function

QSerialPort in QThread run bytesAvailable is zero

心不动则不痛 提交于 2020-01-16 18:18:39
问题 Have a simple Qt app. Gui thread, creates Dev thread it creates (in its run()) Read thread. Dev and Read threads are my classes inherited from QThread. The Read thread should read data from COM port continuously. An approximate view of Read run is following. read::run() { sp2->clear(); while (DO_EXEC) { if (DO_WRITE) { // write data to port } usleep(500); ba = sp2->bytesAvailable(); if (ba > 0) { int a = sp2->read(&BUF[BUF_END], ba); // process data emit sgnl(sendeddata); } } } To start it I

stty serial port settings for parity not persistent

和自甴很熟 提交于 2020-01-16 16:50:28
问题 I have a netcore app that opens the serial port, and writes "parity error" on the console once a parity error gets detected. It works fine in Windows 10 but can't get it to work under Linux. My assumption is that the OS is not passing the parity error to netcore. For checking the port settings I run: stty -D /dev/ttyS0 -ignpar inpck then I run: stty -D /dev/ttyS0 -a and the settings seem to be properly set (-ignpar inpck) as expected. Then I run my netcore 3 app but parity error is not