serial-port

read 22 byte from FTDI serial port in c# is too slow

99封情书 提交于 2019-12-12 04:06:57
问题 I have a FTDI serial port and I have to write something in serial port to start reading 22 byte I have a very strange problem. I read this data too slow I don't know what is my problem this is my code:` public partial class Form1 : Form { public Form1() { InitializeComponent(); } int count; private void button1_Click(object sender, EventArgs e) { // serialPort1.Open(); // serialPort1.Write(Convert.ToString(0x02)); //here we converted the same method to convert hex to string to be send using

Serial COM port communications not working

假如想象 提交于 2019-12-12 04:06:08
问题 I'm writing a test app for some serial communications that my team is working on. Its written in Visual C++ (unmanaged) on VS2010. We're testing it on Windows 7x64. If we run Putty first (and connect), our code works. If we don't run Putty first (and connect), nothing works. The return codes from Read/Write file are as follows: w/o putty write file = 1 read file = 1 w/ putty write file = 1 read file = 1 The SetCommState routine returns 1 (a pass): https://msdn.microsoft.com/en-us/library

Raspberry Pi to Arduino Communication

夙愿已清 提交于 2019-12-12 04:04:05
问题 I am using an opencv algorithm on my Raspberry pi 3. I need to output the data from the raspberry pi to my Arduino. Presently I am using serial, where I simply plug in the arduino to the raspberry pi using the USB connector. But my application requires a faster speed. I thought of exploring i2c communication. It is for a robotic application for which the input sensor values needs to be fast for the robot to respond quickly. Assuming the constraint that I need to push the values to a arduino

Read Complete Line Java Serial Port

被刻印的时光 ゝ 提交于 2019-12-12 03:59:11
问题 I have implmented JSSC API so I can communicate with the Com Port. I send a command like "N\r\n" and what i receive in a normal hyperterminal should look like this: 0100071CA79215021803164442180000 0100071C9F5415021803164514520000 0100071CDF5115022106142956600000 NOK But when i do the same with the JSSC API i receive this (only the first code) 010 0071CA79 2150218 0316444 218 The Problem is that i randomly receive bit parts and at the end of the code i lose some parts. But thats not important

conversion of string to decimal

血红的双手。 提交于 2019-12-12 03:58:09
问题 I am using RS232 serial communication to rotate the motor. The serial communication is done in strings but i need decimal value for it. Any clues how to proceed.I am coding in c language.i tried using atoi function but its not working. char *p; int z=atoi(p); 回答1: Usually given a string: char * myStr= "123"; the way to obtain it's value as an int is: int value=atoi(myStr); Some things important to notice: the following include is necessary: #include <stdlib.h> and you must be sure that your

SerialDevice.FromIdAsync(string id) timing out

百般思念 提交于 2019-12-12 03:43:58
问题 Here's a fragment of a UWP app I am writing // [...] using Windows.Devices.Enumeration; using Windows.Devices.SerialCommunication; using Windows.Networking.Connectivity; // [...] private Dictionary<string, SerialDevice> _SerialDevices = new Dictionary<string, SerialDevice>(); // [...] var serialSelector = SerialDevice.GetDeviceSelector(); var serialDevices = (await DeviceInformation.FindAllAsync(serialSelector)).ToList(); var hostNames = NetworkInformation.GetHostNames().Select(hostName =>

C# Read serial port value only if changed (weight machine)

老子叫甜甜 提交于 2019-12-12 03:33:52
问题 private SerialPort _serialPort = null; public WeightDisplay() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; _serialPort = new SerialPort("COM1", 9600, Parity.None, 8); _serialPort.StopBits = StopBits.One; _serialPort.DataReceived += new SerialDataReceivedEventHandler(_serialPort_DataReceived); _serialPort.Open(); } void _serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { txtWeight.Text = _serialPort.ReadExisting(); } This code continuously gets

Serial Data communication Arduino

这一生的挚爱 提交于 2019-12-12 03:28:10
问题 I currently am trying to read the serial output from a small capacitance meter(model DN060-02v04 from JYETECH). I have the arduino UNO set up to read the meter output. I do get data, but it is not readable and does not correspond to the format outlined in the manual. My baud rates match at 38400bps. The meter claims a 8-N-1 configuration. I'm using the SerialSoftware example in the Arduino Library to read it. #include <SoftwareSerial.h> SoftwareSerial mySerial(2, 3); // RX, TX void setup() {

Bash timeout on 'read' command

狂风中的少年 提交于 2019-12-12 03:22:09
问题 I have a pretty simple bash script that sends command to serial and reads thee value back. The problem is when I don't get a value back,, it can get stuck. echo BC > /dev/ttyS1 read line < /dev/ttyS1 echo $line I have used the cat command with a timeout, but cannot use the same technique with 'read', because if I send the process to the background, I never get value back on exit. 'cat' works for the most part, but i'm not sure if this is the most robust way to do this. echo BC > /dev/ttyS1

pyserial communication with arduino (for motor-control)

删除回忆录丶 提交于 2019-12-12 02:42:14
问题 I would like to send data from python do arduino in order to control motors via relays. Idea is to send a number, in order to identify a motor and a value, to finally move it. Unfortunately im struggling with some problems. Data is getting lost. So, in this minimal example there is an identifier "n", to indicate that the received data is the variable "number" and an identifier "c" to identify that the received data is a counter. To find out what's wrong, I send the data back to Python and try