serial-port

Serial port communication in .NET

扶醉桌前 提交于 2020-01-12 06:01:21
问题 I am using C# to receive data from a serial port but there are some problems. I'm new to this so I need some help. First off all I want to know which functions are event driven: ReadExisting() Read() Readbyte() Readchar() ReadLine() Readto() How can I take the required data form input stream of this port? I have static sized protocols. Can I use a special char to specify limits of a protocol data, and which will be a suitable char for this? How do I handle this exception: C# SerialPort System

Serial port communication in .NET

蓝咒 提交于 2020-01-12 06:01:13
问题 I am using C# to receive data from a serial port but there are some problems. I'm new to this so I need some help. First off all I want to know which functions are event driven: ReadExisting() Read() Readbyte() Readchar() ReadLine() Readto() How can I take the required data form input stream of this port? I have static sized protocols. Can I use a special char to specify limits of a protocol data, and which will be a suitable char for this? How do I handle this exception: C# SerialPort System

Binary data with pyserial(python serial port)

痴心易碎 提交于 2020-01-12 00:44:49
问题 serial.write() method in pyserial seems to only send string data. I have arrays like [0xc0,0x04,0x00] and want to be able to send/receive them via the serial port? Are there any separate methods for raw I/O? I think I might need to change the arrays to ['\xc0','\x04','\x00'], still, null character might pose a problem. 回答1: You need to convert your data to a string "\xc0\x04\x00" Null characters are not a problem in Python -- strings are not null-terminated the zero byte behaves just like

Clear input data from serial port in boost::asio

余生颓废 提交于 2020-01-11 06:43:10
问题 I'm writing a C++ program for communicating with a Arduino over a serial port using boost::asio. After establishing the connection the Arduino resets itself. However the input buffer of the C++ program still contains old data sent from the Arduino. Since I have no use for this data I'd like clear the input buffer. How can I accomplish that using boost::asio? My code currently looks like this: #include <boost/asio.hpp> #include <vector> #include <iostream> using namespace std; using namespace

Connecting Silverlight to the local computers COM port

我与影子孤独终老i 提交于 2020-01-11 06:27:29
问题 I have been searching high and low for a way to get my silverlight application talking to the COM port on my local computer. Has anybody out there been able to get Silverlight to successfully connect to the COM port of you local computer? If so can you point me to the documentation. 回答1: This can not be done with Silverlight. Why not just use a standard .NET desktop app? If you need to easily deploy over the web, just use Click-Once for deployment. 回答2: There's no access to computer resources

termios VMIN VTIME and blocking/non-blocking read operations

梦想与她 提交于 2020-01-11 05:34:29
问题 I am trying to write a simple C serial communication program for Linux. I am confused about the blocking/non-blocking reads and VMIN/VTIME relationships. My question is, if I should be settings VMIN/VTIME according to whether I have a blocking/non-blocking open call? For example, if I have the following open call: open( "/dev/ttyS0", O_RDWR|O_NONBLOCK|O_NOCTTY) Should I set the VMIN/VTIME to: .c_cc[VTIME] = 0; .c_cc[VMIN] = 0; and if I have blocking mode like: open( "/dev/ttyS0", O_RDWR|O

Serial Receiving from Arduino to Raspberry Pi with PySerial stops after a while

牧云@^-^@ 提交于 2020-01-11 00:11:57
问题 I'm working on a project in which I have to receive some 25 character data at a time in order to process it in Raspberry Pi. Here is the example code that generates some data I want to receive from Arduino: char i =0; char a =0; char b=0; void setup(){ Serial.begin(9600); for(i=0;i<25;i++){ Serial.print('l');} Serial.print('\n'); delay(2000); } void loop(){ for(i=0;i<25;i++){ for(a=0;a<i;a++){ if((a==9)||(a==19)||(a==24)) Serial.print('l'); else Serial.print('d'); } for(b=0;b<25-i;b++){

node.js to read usb port signals

我怕爱的太早我们不能终老 提交于 2020-01-10 14:26:38
问题 I have installed serialport module for node.js using npm.( npm install serialport ). Now I would like to send some messages from my android phone to node application via usb port of my computer(assuming node can read serial port signals). Has anyone done this before? Thanks in advance. 回答1: Why, yes, it's certainly doable. There's a plenty of examples listed at the serialport package homepage itself. Your node.js application will start with... var SerialPort = require("serialport").SerialPort

node.js to read usb port signals

若如初见. 提交于 2020-01-10 14:26:17
问题 I have installed serialport module for node.js using npm.( npm install serialport ). Now I would like to send some messages from my android phone to node application via usb port of my computer(assuming node can read serial port signals). Has anyone done this before? Thanks in advance. 回答1: Why, yes, it's certainly doable. There's a plenty of examples listed at the serialport package homepage itself. Your node.js application will start with... var SerialPort = require("serialport").SerialPort

How do I read data from serial port in Linux using C?

纵饮孤独 提交于 2020-01-09 09:07:19
问题 I am new to serial programming in Linux using C. I have found a small piece of code to write data on serial port which I am sharing here. After running this code I may assume that data has written on a specific port. Now I would like to open another terminal and using separate code want to read the data written on that specific port - how do I do that? #include <stdio.h> /* Standard input/output definitions */ #include <string.h> /* String function definitions */ #include <unistd.h> /* UNIX