serial-port

how to read data frome serialport using jssc in java?

ぃ、小莉子 提交于 2021-02-19 06:39:06
问题 I used jssc library to read and write data from serial port. package serial; import jssc.*; public class Serial { public static void main(String[] args) { String[] portNames = null; portNames = SerialPortList.getPortNames(); for (String string : portNames) { System.out.println(string); } if (portNames.length == 0) { System.out.println("There are no serial-ports"); } else { SerialPort serialPort = new SerialPort("com2"); try { serialPort.openPort(); serialPort.setParams(SerialPort.BAUDRATE

TCP/IP over Serial Port

╄→尐↘猪︶ㄣ 提交于 2021-02-18 18:14:04
问题 I am trying to setup a network interface over one of serialports of the system. I am using beaglebone and Xbee-wifi modules. Basically I'm trying to communicate 2 beaglebone over serialport bu using a TCP/IP protocole. I need to connect to the beaglebone via ssh, telnet or via default web port 80. So I do not need a single port working on the serial interface. I need a newtork intarface running over serialport. Is there anyway to do this? Hardware : beaglebone black os : angstrom 回答1: Here's

TCP/IP over Serial Port

こ雲淡風輕ζ 提交于 2021-02-18 18:13:16
问题 I am trying to setup a network interface over one of serialports of the system. I am using beaglebone and Xbee-wifi modules. Basically I'm trying to communicate 2 beaglebone over serialport bu using a TCP/IP protocole. I need to connect to the beaglebone via ssh, telnet or via default web port 80. So I do not need a single port working on the serial interface. I need a newtork intarface running over serialport. Is there anyway to do this? Hardware : beaglebone black os : angstrom 回答1: Here's

Fast plotting data in python

℡╲_俬逩灬. 提交于 2021-02-18 17:16:08
问题 I'm trying to plot data from mpu6050 imu with arduino. MPU6050 sends data faster than plot. Arduino code gives 6 data which are yaw, pitch, roll, ax,ay and az from serial port. I need suggestions for fast plot . Python Code: import serial import matplotlib.pyplot as plt #import matplotlib library from drawnow import * ser = serial.Serial('COM9', 115200) yaw = 0.0 pitch =0.0 roll =0.0 ax =0.0 ay =0.0 az =0.0 o_yaw= [0] o_pitch= [0] o_roll= [0] o_ax= [0] o_ay= [0] o_az= [0] plt.ion() cnt=0 def

Get Device Descriptor of SerialPort using jssc

↘锁芯ラ 提交于 2021-02-17 22:20:30
问题 How to get the Device Descriptor of a SerialPort using jssc ( java-simple-serial-connector) ? The getPortName() method gives port name ( e.g. COM2 ), but descriptor would be more helpful. If it's necessary to patch this opensource API to get the Device Descriptor how can it be done? 回答1: Look at gohai/java-simple-serial-connector, the SerialPortList class has a getPortProperties(String portName) method to get the port properties, unfortunately is not implemented yet for windows but is easy to

CreateFile not able to share serial (COM) port

南楼画角 提交于 2021-02-17 06:46:21
问题 The CreateFile function is useful for opening files or devices for read/write access, providing a handle. The third parameter, dwShareMode , specifies if the file/device can later be accessed by others. An example, with files: void* pFileHandle1 = ::CreateFileA("C:\\test.txt", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); DWORD lastError = GetLastError(); // 0, ERROR_SUCCESS void* pFileHandle2 = ::CreateFileA("C:\\test.txt", GENERIC_READ|GENERIC_WRITE,

Manage serial port from two processes simultaneosly

半世苍凉 提交于 2021-02-17 05:28:25
问题 I have the following scenario: Rasperry pi connected to a device via Serial port 3g Dongle connected to the raspberry (with the ability to make/recieve calls) One process reading the data from the serial port and redirecting it to a server (using 3g) Another process waiting for a incoming call, and when someone calls the program takes the data from the serial port and redirect it via the 3g dongle using AT commands ( like fax-call). When someone calls, the call is made using AT commands and

Read characters from serial port in c#

左心房为你撑大大i 提交于 2021-02-16 14:16:08
问题 Hello I am using Read() method to read 10 characters say 0123456789 from serial port. Actually the characters are sent by a PIC Micro-controller. Here is my code: serialPort1.PortName = "com4"; serialPort1.BaudRate = 9600; serialPort1.Open(); char[] result = new char[10]; serialPort1.Read(result, 0, result.Length); string s = new string(result); MessageBox.Show(s); serialPort1.Close(); When I run the code, a message box shows up and displays only the first character. "0" alone is displayed in

Select() system call in threads?

拜拜、爱过 提交于 2021-02-16 07:27:22
问题 I am reading data from multiple serial ports. At present I am using a custom signal handler (by setting sa_handler) to compare and wake threads based on file descriptor information. I was searching for a way out to have individual threads with unique signal handlers, in this regard I found that select system call is to be used. Now I have following questions: If I am using a thread (Qt) then where do I put the select system call to monitor the serial port? Is the select system call thread

Select() system call in threads?

时光毁灭记忆、已成空白 提交于 2021-02-16 07:25:19
问题 I am reading data from multiple serial ports. At present I am using a custom signal handler (by setting sa_handler) to compare and wake threads based on file descriptor information. I was searching for a way out to have individual threads with unique signal handlers, in this regard I found that select system call is to be used. Now I have following questions: If I am using a thread (Qt) then where do I put the select system call to monitor the serial port? Is the select system call thread