serial-port

Read Weight from a Serial Mettler Toledo Digital Scale

China☆狼群 提交于 2019-12-12 02:33:52
问题 I am trying to read weight from digital scale in c# app, found this question this is exactly what I am trying to do but for me below function never runs. private void port_DataReceived(object sender, SerialDataReceivedEventArgs e) { this.Invoke(new EventHandler(DoUpdate)); } I have checked the scale in device manager, its location is set to Port_#0004.Hub_#0003 and appear to be working fine I was not sure about port number of the scale so I did var test = SerialPort.GetPortNames(); and only

Serial.write crashes program in Qt (C++)

蓝咒 提交于 2019-12-12 02:28:52
问题 I am attempting to write a command to a serial port that will change my TV input, but when I try to write the necessary command to the port, I get a very strange output. #include <QCoreApplication> #include <QSerialPort> #include <Windows.h> int set_id = 0; int fd = -1; int main(int argc, char *argv[]) { QCoreApplication app{argc, argv}; int timeInSeconds=0; while(timeInSeconds>0) { printf("%d...\n",timeInSeconds); Sleep(1000); timeInSeconds--; } QSerialPort serial; serial.setBaudRate

Java to Esplora Serial port communication issue

我的梦境 提交于 2019-12-12 02:19:37
问题 I am attempting to communicate between an Arduino Esplora and a Java process using the RXTXComm library that comes bundled with the Arduino IDE. I have started with the code here. Based on this question I have modified my Arduino code to be void setup(){ Serial.begin(9600); while(!Serial); } void loop(){ Serial.println("Test"); } Communication consistently works with an Arduino UNO. However, Communication with an Arduino Esplora often produces no output, and when it does work, it quickly

Linux Serial Port: missing data on input

蹲街弑〆低调 提交于 2019-12-12 02:17:23
问题 #include <fcntl.h> #include <termios.h> #include <unistd.h> #include <errno.h> #include <cerrno> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fstream> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <cstdlib> #include <ctime> using namespace std; typedef struct termios ComSet; int main() { int acm=-1; acm=open("/dev/ttyACM0",O_RDWR | O_NOCTTY); if(acm == -1) { cout<<"Error Opening ttyACM0"<<endl; exit(1); } else {

Linux serial read blocks minicom

余生长醉 提交于 2019-12-12 02:13:05
问题 I'm attempting to read from a serial port ( /dev/ttyS4 ) on a BeagleBone Black, but I think(?) this should apply to all Linux devices in general. Currently, I can set up minicom with a baud rate of 9600 and 8N1 data to read from the serial port correctly. However, if I attempt to directly cat /dev/ttyS4 , nothing shows up in my terminal. My code also does this, and returns a Resource temporarily unavailable error, which I suspect is what is happening with the cat command. If I run stty -F

MSVS C# SerialPort Received Data Loss

折月煮酒 提交于 2019-12-12 02:09:08
问题 I'm trying to create a Serial Communication tool on MSVS using C#. it communicates with the Photon MCU and a bluetooth dongle. When the "start" button is pressed, the UI sends a "1" to the Photon which it first sends the current time stamp and starts streaming data from the function generator. When the "stop" button is pressed, It first sends 10 "2"s (due to the timer issue on the photon's end) which the when the Photon receives, it stops transmitting the function generator's data. Then it

linux writing string value as hex to serial

谁说我不能喝 提交于 2019-12-12 02:07:47
问题 here's my problem i have a string with hex value such as std::string str ="8C000002008E" and i want to write this as hex to serial out by using the write() I have a sony Display which i want to control with. Passing a unsigned char test[6] = {0x8c, 0x00, 0x00, 0x02, 0x00, 08E}; to the write method works. But i dont know how to convert the string to such a char array especially that the size of the char array has to be calculated on runtime. Thanks for your help. Here is my full code #include

How to unit test serial ports in Java on Android

时光总嘲笑我的痴心妄想 提交于 2019-12-12 01:57:51
问题 I'm aware that Android does not provide out-of-the-box access to the serial ports unless the device is rooted or a custom Android version is flashed, say on a BeagleBone Black board -- which is exactly my case. Using the Android SerialPort API project I am able to access and test the serial ports of my device through the sample GUI app (slightly modified). However, I'd like to also add JUnit tests for the Serial API because I will be expanding it into a library module for client programmers

How to plot graphs with data from a SerialPort with multiple sensors

删除回忆录丶 提交于 2019-12-12 01:52:43
问题 I need to plot data from sensors of pH, Temperature and Humidity, the data is sent as a matrix from arduino to PC through the serial port. I can show the data in a TextBox, but when I try to plot the data, it doesn't work (I don't know how to do it). I just can plot the data when is not a matrix and it's data from just one sensor. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using

jssc getInputStream() getOutputstream()

耗尽温柔 提交于 2019-12-12 01:44:46
问题 I'm using jssc library for communicating with device over serial port. In standard java SerialComm library there are two methods getInputStream() and getOutputStream(). Why I need this? I want to implement Xmodem according to this example and xmodem constructor requires two params: public Xmodem(InputStream inputStream, OutputStream outputStream) { this.inputStream = inputStream; this.outputStream = outputStream; } Xmodem xmodem = new Xmodem(serialPort.getInputStream(),serialPort