serial-port

Arduino being recognized as keyboard by android

纵然是瞬间 提交于 2019-12-13 04:59:59
问题 I wrote a simple firmware for arduino to replicate whatever incoming data it recieves on serial to the serial output. Something like this: int serialData = 0; void setup() { Serial.begin(9600); } void loop() { if (Serial.available() > 0) { serialData = Serial.read(); Serial.println(serialData); } } Now I wanted it connect to my Nexus 7 running on Android 4.3 using a microUSB->OTG cable + USB->microUSB cable. I installed a serial monitor app (https://play.google.com/store/apps/details?id=jp

How to display data received from serial port in a textbox without the text disappearing in Visual Studio C#?

若如初见. 提交于 2019-12-13 04:51:30
问题 So, I'm trying to develop a simple application in visual C# which gets data from serial port and displays it in a textbox (to monitor temperature). I'm acquiring and displaying the data successfully, using the DataReceived event to update a global string variable and a timer to update the text field on my text box, as shown: private void port_DataReceived_1(object sender, SerialDataReceivedEventArgs e) { try { globalVar.updateTemp = port.ReadLine(); //This is my global string } catch

GetPortNames() returns stale data/Remove stale comport entries in Windows?

[亡魂溺海] 提交于 2019-12-13 04:43:00
问题 I'm currently working on a project using the SerialPort class in C# to communicate with RS232-based calibration devices used at the company I work for. In the SerialPort class, there is a static method named GetPortNames(). Unfortunately, Windows has a terrible problem with keeping around stale port entries. If I call GetPortNames() from my machine, it returns the following ports: COM3 COM4 COM1 Of these ports, only one physically exists right now. I have a PCIe RS232 card on the back of my

Cannot access serial port during debugging

岁酱吖の 提交于 2019-12-13 04:42:16
问题 This is my first SO question so please correct me where I am not supplying enough or correct information. I'm interfacing two RFID tag readers via RS232 ports on a FTDI serial to USB hub to my program. The program runs perfectly outside VS2010, but I cannot debug the code. The program starts fine during debugging, but as soon as I bring a tag within reading proximity I get an error. This only happens during debugging. The error: Error Opening Serial Port COM9 System

How can I allow thread 2 to communicate on the port I opened in thread 1?

倾然丶 夕夏残阳落幕 提交于 2019-12-13 04:35:02
问题 I'm trying to communicate with the same port using two different threads in a CLI C++ program (running on Windows but not using the Windows API). The port is a USB port (that leads to a converter to RS-232 and then to another device). I can successfully establish port communications in my main thread using OpenCom() and Transmit() , functions provided in a DLL by the manufacturer of those devices. I then call newThreadFunc() (defined in another DLL), which runs in a separate thread (let's

Timeouts in C# serial port

人走茶凉 提交于 2019-12-13 04:28:40
问题 I am using the C# Serial port library for communicating with a sensor and PC . I am frequently getting timeouts with the SerialPort.Read() method even though there is data in there. I used serial sniffers to check that I am receiving all the packet at the port but some how .NET does not pick all of them and times out. I am reading bytes and the bytes I am receiving is 2112 less than the serial port buffer size. I tried multiple things and now thinking of using native C/C++ and calling it in C

RS-232 communication with RPi

ぃ、小莉子 提交于 2019-12-13 04:13:47
问题 This is a follow up question to this original post: RaspberryPi RS-232 trouble I made changes to my code per the accepted answer, the terminal is now set up for blocking and canonical input. The read() now works as expected, with the exception of the very first read(which is typically some extra random symbols mixed with some good data) I get single lines of data from the laser range finder representing exactly what I expect to see. However, I now have an issue that if I do too many reads,

Serial Ports Linux vs Windows

人走茶凉 提交于 2019-12-13 03:59:40
问题 I am having issues with my pyserial program on Ubuntu 16. I am trying to send a break command to a hardware device using pyserial. I wrote a python script that: Sets the port/baud/parity/bytesize/... Opens the port Sends a break command Reads the return message from the device. I run the script on my Ubuntu 16.04 machine and I get zero response, it just hangs or eventually timeouts. I copy the same script to my Windows machine, change the port (from /dev/ttyUSB0 to COM#) and my script works

Windows API ReadFile Drops Null Characters (Serial Port)

ε祈祈猫儿з 提交于 2019-12-13 03:52:44
问题 I am using ReadFile to read a null character '0x00', but it is not able to see it. If I send "0x01 0x02 0x00 0x03" to my program. It will receive "0x01 0x02 0x03". I know for a fact that my sending side is sending the null character (I used a scope to see the data). I have checked the DCB structure and have fNull set to false. (which is supposed to allow for null bytes to be received and not discarded) This is the configuration of the DCB shown from GetCommState: DCBlength 28 BaudRate 9600

Using same serialport on two different forms

不打扰是莪最后的温柔 提交于 2019-12-13 03:19:33
问题 I have two forms = Form1.CS and SMS.CS on the first form (Form1) i've configured and ready to work serialport1. I have button which is called send message. This button opens new form called SMS.cs. private void SMS_Click(object sender, EventArgs e) { SMS settings = new SMS(); settings.ShowDialog(); } I'd like to use my configured serialport1 on to forms: Form1 and form SMS.cs. It's also possible to receive from form SMS data, and send it using serialport1 on Form1 for example: private void