serial-port

Rs232 arduino issue

末鹿安然 提交于 2019-12-13 08:56:16
问题 I have a little confusing about arduino uno. I use Serial.print("hi") code then it "hi" appears on the serial monitor. I also use rs232/ttl converter which are connected pin 1 and 0 on the arduino properly. Then I realize that when serial.print("hi") working the data first is going through usb cable. But I want the data has to go through tx rx pins which are 1 and 0. But when I enter some data from serial monitor , rs232/ttl will work and some data will be sended ? I do not understand the

Send byte array on serial port out put stream

痞子三分冷 提交于 2019-12-13 08:49:35
问题 when I want to send byte array on serial port stream with java,on destination device I receive different result !!! byte[] sendingPack = new byte[7]; sendingPack[0] = 0x6E; sendingPack[1] = 0x55; sendingPack[2] = (byte) 0x0D; sendingPack[3] = (byte) (1 & 0x000000FF); sendingPack[4] = 0x01; sendingPack[5] = 0x0D; sendingPack[6] = (byte) 0xAA; getSendBuffer().getOutputStream().write(sendingPack); sending array : byte[]{0x6E,0x55,0x0D,0x01,0x01,0x0D,0xAA} receive result array : 6E 55 0D 0A 01 01

Linux shell: save input line from Serial Port each minute and send to remote server

倖福魔咒の 提交于 2019-12-13 08:46:12
问题 I have Arduino connected to computer over RS-232 (only TxD, RxD and GND). Arduino only send data to computer and computer receive it. Computer do not transmit anything to Arduino. Computer is WiFi router with OpenWrt linux with 16MB RAM and 4MB flash for system. I do not have free enough space for "good tool" like python (I have the same working program on x86 PC written in python). Arduino send data to PC +- each 60 seconds. Data has following format: SENSOR1;12.34;95.47 ABC245;34.5;75.1 2

How can i get data without blocking?

﹥>﹥吖頭↗ 提交于 2019-12-13 08:38:37
问题 I have a serial port external device for getting data. I set two timers. One of them has to be for plotting(0.5sn) and the other for writing to a text file(15sn). Timers shouldn't get data from each other by list or array. Because sometimes I need to close plotting button. So I have to get data from the same resource (coming continuous data), right? But when I try this, it blocked. And how to get data without blocking? As an example the below code runs without blocking: # -*- coding: utf-8 -*

Can't communicate with certain baud rates

给你一囗甜甜゛ 提交于 2019-12-13 08:37:56
问题 My application is able to communicate with baud rates like 4800, 9600 and 115200 but can't with 14400 or 38400. I have to include asm/termios because I need struct termios2 since I'm going to use c_ispeed and c_ospeed members for any buad rate. Also the second problem I encounter is that read function doesn't return after VTIME . Do you know why this happens? Any help is appreciated. Thanks. #include <asm/termios.h> int serialDevice = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_SYNC);

java - how to pass multiple parameters over serial port to Arduino mega

别等时光非礼了梦想. 提交于 2019-12-13 08:26:32
问题 Through my java program. i want to pass a byte value to the Arduino mega to blink an Led and also at the same time i want to pass a string value to the Arduino to be displayed in the lcd. How can I separately get above 2 inputs from the java program to Arduino and use them in different processes inside Arduino.. Below is the arduino code LiquidCrystal lcd (12, 11, 10, 9, 8, 7); int operation; void setup() { lcd.begin(16, 2); Serial.begin(9600); Serial1.begin(9600); Serial2.begin(9600);

Proper usage of InvokeRequired before terminating a task

大城市里の小女人 提交于 2019-12-13 08:25:46
问题 I am working on a serial port related application. While using DataReceived event of SerialPort I need to update a textbox with the received bytes: private void Connection_DataReceived(object sender, SerialDataReceivedEventArgs e) { ledReceive.On = true; var data = Connection.ReadExisting(); _readBuffer.Add(data); Invoke(new EventHandler(AddReceivedPacketToTextBox)); } So I use Invoke to update the textbox. But there is a big problem. When I try to close connection, my UI gets freezed, I

How to get multi line result from serial port

孤人 提交于 2019-12-13 08:25:33
问题 I'm working with winform project and trying to send a command to the serial port and receive data from it. I'm expecting a multi-line response, but using the following code I'm getting only the first line of the response. I don't want to use ReadExisting . { SerialPort mySerialPort = new SerialPort("COM5"); mySerialPort.BaudRate = 115200; mySerialPort.Parity = Parity.None; mySerialPort.StopBits = StopBits.One; mySerialPort.DataBits = 8; mySerialPort.Handshake = Handshake.None; mySerialPort

Reading data from NodeJs Serialport

↘锁芯ラ 提交于 2019-12-13 07:16:44
问题 I would like to be able to read data received by the ascii command sent. Below is the code that sends command to my lock controller var express = require('express'); var router = express.Router(); var SerialPort = require('serialport'); /* GET home page */ router.get('/', function(request, response){ SerialPort.list(function (err, ports) { ports.forEach(function(port) { console.log(port.comName); console.log(port.pnpId); console.log(port.manufacturer); }); }); var port = new SerialPort("COM5"

Integrating Arduino and Processing - button counter

僤鯓⒐⒋嵵緔 提交于 2019-12-13 07:16:32
问题 I am looking to integrate Arduino controls and Processing Interface. In my Arduino code, there are three buttons attached to pin a1, a0 and d0 (all digitalRead). int x;// assigned to A0 input int y;// assigned to A1 input int z; //assigned to D0 input int votes[3]={0,0,0}; void setup() { // initialize the serial communication Serial.begin(9600); while(!Serial); } void loop() { // first we need to read the values from the BUTTONS x = digitalRead(A0); y = digitalRead(A1); z = digitalRead(0); if