serial-communication

Android app not synchronized with Arduino Serial communication

走远了吗. 提交于 2020-07-08 22:25:48
问题 I have a simple sonar arduino project so that it prints the distance every second. I have implemented an android app using UsbSerial to communicate with my arduino. So far so good, I am able to receive data and the data I receive is correct, but the problem is that the values are sometimes not properly sent. Here is the sample output I receive: data: 7 data: 1 data: data: 71 and here is the code that generates output: private UsbSerialInterface.UsbReadCallback mCallback = new

Listening to Serial Com Ports that are In use

我们两清 提交于 2020-01-27 15:47:40
问题 I'm dealing with some legacy systems that are using RS232 to communicate with peripherals. I'm not very experienced with COM interfacing. I have some code that can open and use COM ports, but it can't open ports that are used by other applications. I need to black box the packets so that we can use the same protocol for updated communications. Is there any way to "middle man" incoming packets to an open COM port and detect what packets are being sent? I'm using .NET, but I'm open to any type

safe and fast method for communicating a mix list of integers and booleans between pyserial and Arduino

北慕城南 提交于 2020-01-16 09:05:14
问题 I want to send and receive a mix list of integers and booleans between pyserial and an Arduino. I have figured the Arduino to pyserial out, well partly: Arduino code: ... bool var1 = ...; int var2 = ...; ... void setup() { ... Serial.begin(9600); ... } void loop() { ... // here I send the data in CSV format Serial.print(var1); Serial.print(", "); Serial.print(var2); Serial.print(", "); ... Serial.println(var_n); ... } and the pyserial side: import serial serPort = serial.Serial("COM7")

Google chrome - chrome.serial connection failed

那年仲夏 提交于 2020-01-11 11:38:49
问题 I am trying to connect to USB serial which is working manually as below: $ ls /dev/cu.* /dev/cu.Bluetooth-Incoming-Port /dev/cu.usbserial $ screen /dev/cu.usbserial 9600 But when Google chrome apps trying to connect its failing. apps, background.js: var DEVICE_PATH = '/dev/cu.usbserial'; var serial = chrome.serial; function log(msg) { console.log(msg); } var ab2str = function(buf) { var bufView = new Uint8Array(buf); var encodedString = String.fromCharCode.apply(null, bufView); return

Why does ORSSerialPort serialPort:didReceiveData NSData only have single byte?

徘徊边缘 提交于 2020-01-05 13:08:42
问题 From my Arduino, I'm writing multi-byte data to serial with Serial.print("blah"), but in Objective-C, -serialPort:didReceiveData: (provided by ORSSerialPort) only gets this data 1 byte at a time. Occasionally, it'll grab 2 bytes at once, but never all 4. Is this expected? If so, how can I make it receive all 4 bytes at once? Arduino: void loop() { Serial.print("blah"); delay(1000); } Obj-C: - (void)serialPort:(ORSSerialPort *)serialPort didReceiveData:(NSData *)data { NSString *string = [

CRC16 and data communications

一个人想着一个人 提交于 2020-01-05 07:57:14
问题 Hi I have been trying to calculate a CRC for a device I want to write a software interface for. For simplicity I will say X is the device and Y is the hardware controller. I am looking for a nudge in the right direction I am sure I am on the correct track just a little confused on a few points. When the device is idle it sends the following strings of data every 2 seconds or so that looks like it is counting up in hex: The 2 bytes between the | | is the CRC I assume. (XX) is the varying byte.

Serial communication (for Arduino) using Visual Studio 2008 and C

淺唱寂寞╮ 提交于 2020-01-04 06:01:29
问题 I want to send data to my Arduino board using Visual Studio and C. I specifically need to use C since I am using ARToolKit to get markers and sending the data accordingly. I was trying the code #include<stdio.h> #include<stdlib.h> void main() { system( "MODE COM9: BAUD=9600 PARITY=n DATA=8 STOP=1" ) ; FILE port = fopen( "COM9:", "wb" ) ; printf("hello"); fprintf( port, "s" ) ; fclose( port ) ; } but it is not getting compiled. I just need to send data. 回答1: I understood from your post that

grabserial stops printing the log?

旧城冷巷雨未停 提交于 2020-01-02 10:00:12
问题 i tried Grabserial to measure the startup code of my embedded Linux device. It works somehow but after a while (that means a longer startup code - talking about > 26 s) it stops printing out the messages, but grabserial still is running - i have to hit the [CTRL-C] to retrieve control. I checked the serial port with putty and it's working so it's a problem with grabserial. But i can't think of what it is. I downloaded and installed with both of the 2 install-variants and it just changed the