serial-port

Linux serial port reading - can I change size of input buffer?

故事扮演 提交于 2019-12-21 09:07:22
问题 I am writing an application on Ubuntu Linux in C++ to read data from a serial port. It is working successfully by my code calling select() and then ioctl(fd,FIONREAD,&bytes_avail) to find out how many bytes are available before finally obtaining the data using read() . My question is this: Every time select returns with data, the number of bytes available is reported as 8. I am guessing that this is a buffer size set somewhere and that select returns notification to the user when this buffer

Serial Port Read C# Console

廉价感情. 提交于 2019-12-21 06:04:13
问题 Hi to all i am new here and i have heard a lot about this website that it really helps you out. Hope you will be able to help me out!. I have a very simple program which its only aim is to read from a serial port and prints it on the console window in C# for 2000 times. I am just turning a variable resistor on a micro-controller that's all Here below is the code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO.Ports; namespace Testing

C# console application talking to Arduino via Bluetooth

岁酱吖の 提交于 2019-12-21 06:03:35
问题 Not a whole lot to say here other than this doesn't work, and I have no idea why. The serial output on the Arduino is nothing. The output on the C# code goes down to waiting for a response and then nothing. The Bluetooth card LED on the Arduino goes green when I start the C# program so there is a connection being made. Just nothing else. Arduino Code #include <SoftwareSerial.h> //Software Serial Port #define RxD 8 // This is the pin that the Bluetooth (BT_TX) will transmit to the Arduino (RxD

UART controller or RS232 controller? Is UART a general word?

醉酒当歌 提交于 2019-12-21 05:36:32
问题 I have a question regarding UART controller. Is UART controller a general name? i mean that if we use RS-232 protocol, we should name this UART controller, RS-232 controller and if we use RS-485 as protocol, we should call this UART controller, a RS-485 controller and so on? I've noticed that we generally say network controller (protocols:Ethernet, token ring,ATM,..) and if the protocol implemented is Ethernet for example, we say Ethernet controller. Is it a correct comparison between UART

Twisted Python script on Raspberry Pi (Debian) to communicate with Arduino via USB

拜拜、爱过 提交于 2019-12-21 05:25:05
问题 I have been working on an Arduino/Raspberry Pi project where I have found myself learning not just Python but Twisted Python as well; so I apologize in advance for my newbness. I am trying to keep it simple for now and just trying to send a char at any one time between the two devices. So far I am able to send from the Raspberry Pi to the Arduino and effectively turn its LED off/on just as expected. However I cannot seem to generate Twisted code which will detect anything coming from the

Accessing Bluetooth data via Serialport in C#

佐手、 提交于 2019-12-21 05:15:09
问题 So I'm working in Unity3D, programming in C#, and I heard that one can read data from a Bluetooth adaptor via SerialPort. I have several Bluetooth USB adaptors that I've tried to connect on my PC using this method. However, when I try to open the SerialPort, I get an error message that says port does not exist. I only included the code relevant to the question, but portI is a string ("COM11" or "COM12") and PortIn is of type SerialPort. void OnGUI() { GUI.Label(new Rect(btnX, btnY, btnW, btnH

How do I read Bluetooth Low Energy transmitted data programmatically on Mac OS X 10.9.5?

不羁岁月 提交于 2019-12-21 04:33:17
问题 I'm trying to read Bluetooth Low Energy transmitted data programtically using Ruby. Bluetooth Low Energy technology provides no support for the Serial Port Profile (SPP) in the standard Specification v4.0. With older Bluetooth communication methods, one can just read the serial port for Bluetooth incoming data ( /dev/tty.Bluetooth-Incoming-Port ). Clearly, this won’t work for Bluetooth Low Energy, given it works almost completely differently. I came across a few tools like LightBlue and XCode

C#: Proper way to close SerialPort with Winforms

南笙酒味 提交于 2019-12-21 04:25:12
问题 I have an app where I read from the serialport, everything goes fine, until I close the app. When I click on the [X] the app simply hangs, the UI: unresponsive. I read from the port in the DataReceived event handler, and I close the port when FormClosed happens: private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { mySerialPort.Close(); } 回答1: It's not a bug. The only reason it would hang when you close it is because in the event handler of your SerialPort object, you're

Android: USB Communication Android <-> External Device

耗尽温柔 提交于 2019-12-21 02:28:10
问题 I found several threads speacking about this subject, but after read them I don't have a clear idea about my problem. We have a external device (something like a tomtom device, I mean, not an accessory) and we want to connect this device to an android device. And we want to have serial communication between the external device and the android device using a USB connection. (At this time we have communication between the external device and other non android devices using RS232 interface, but

Binary communications protocol parser design for serial data

扶醉桌前 提交于 2019-12-20 23:27:02
问题 I'm revisiting a communications protocol parser design for a stream of bytes (serial data, received 1 byte at a time). The packet structure (can't be changed) is: || Start Delimiter (1 byte) | Message ID (1 byte) | Length (1 byte) | Payload (n bytes) | Checksum (1 byte) || In the past I have implemented such systems in a procedural state-machine approach. As each byte of data arrives, the state machine is driven to see where/if the incoming data fits into a valid packet a byte at a time, and