serial-port

System.Timers.Timer Usage

99封情书 提交于 2019-12-11 11:59:11
问题 For the purposes of this question I'm including a class of mine in its entirety: public class SerialPortConnection { private SerialPort serialPort; private string ping; double failOut; bool isReceiving; public SerialPortConnection(string comPort = "Com1", int baud = 9600, System.IO.Ports.Parity parity = System.IO.Ports.Parity.None, int dataBits = 8, System.IO.Ports.StopBits stopBits = System.IO.Ports.StopBits.One, string ping = "*IDN?", double failOut = 2) { this.ping = ping; this.failOut =

Pass an integer to an Arduino

て烟熏妆下的殇ゞ 提交于 2019-12-11 11:46:56
问题 I am having some trouble passing over integers to the Arduino that is not a 1 or a 0. In this example I want to be able to pass a 3. The reason is that I will soon have more buttons controlling different parts of the Arduino and will need different integer values to do this. Here is Arduino code.. void setup() { Serial.begin(9600); // Define the led pin as output pinMode(13, OUTPUT); } void loop() { // Read data from serial communication if (Serial.available() > 0) { int b = Serial.read(); //

Python ImportError: No module named serial

吃可爱长大的小学妹 提交于 2019-12-11 10:41:31
问题 I have installed Python 2.7.5 on Ubuntu 12.4 on a DELL LATITUDE E4300 64 bit and ran: sudo pip install pyserial nevertheless when running: sudo python main.py I receive the following error message: Traceback (most recent call last): File "main.py", line 4, in <module> from mySerial import * File "/home/oscar/ath10k/tools/sanity_test/src/mySerial.py", line 6, in <module> import serial ImportError: No module named serial I looked on other posts but none of them helped me to solve this problem.

Rewrite serial port communicationf rom C++ to C#

自闭症网瘾萝莉.ら 提交于 2019-12-11 10:29:25
问题 I want to know if I correctly mapped this C++ code which establishes serial port communication to C#. void some func(...) { *hDev = CreateFile(PortNameUNC, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(*hDev == INVALID_HANDLE_VALUE) return false ; DCB *dcb = new DCB ; memset(dcb, 0x00, sizeof(DCB)) ; dcb->DCBlength = sizeof(DCB); dcb->BaudRate = BaudRate; dcb->Parity = Parity; dcb->StopBits = StopBits; dcb->ByteSize = ByteSize; dcb->fBinary = TRUE; dcb-

External vs internal declaration of QByteArray

浪尽此生 提交于 2019-12-11 10:26:59
问题 I have currently some problems with the QSerialPort : When I am using the function from an example which looks like QKeyEvent *e; emit getData(e->text().toLocal8Bit()); connect(console, SIGNAL(getData(QByteArray)), this, SLOT(writeData(QByteArray))); void MainWindow::writeData(const QByteArray &data) { qDebug() << "Data is to write: " << data; serial->write(data); } then the receiving device can work with the data. But when I change the function writeData() to void MainWindow::writeData(const

Unusual pattern of data corruption over serial port

扶醉桌前 提交于 2019-12-11 09:34:25
问题 I'm testing my application's receipt of data over a serial port by sending data from Windows HyperTerminal and this mostly works. For example if I send : The Quick Brown Fox I receive : The Quick Brown Fox However, if I send : UUUUUUUUUUU I receive UUÕUÕUÕUÕUÕ or if I send : aaaaaaaaaaa I receive : aaáaáaáaáaá so for any repeated character string longer than 2, then the 3rd, 5th, 7th etc. characters are corrupted by having their high bit set. The serial port settings on both machines are

.NET Error Closing serial port BaseStream error is only available when the port is open

梦想的初衷 提交于 2019-12-11 09:17:56
问题 I'm using the .NET System.IO.Ports.SerialPort using the BaseStream as suggested in this post If you must use .NET System.IO.Ports.SerialPort But when I try to close the port or the baseStream, an System.InvalidOperationException is raised saying "The BaseStream is only available when the port is open" This is my code: private void ActionStarted() { //ajusta el puerto setupSerial(); serial.Open(); //conecta al plc byte[] buffer = new byte[15]; Action kickoffRead = null; if (serial.IsOpen) {

What is the simplest 'free' way to implement serial comms in Java?

不想你离开。 提交于 2019-12-11 09:07:14
问题 I'm new to Java, and have set myself a project to write so that I can do some "hands on" learning. I'm fluent with C++, but want to add another language to my skill-set. Anyway, part of that project includes serial communications. I'm targeting a Windows XP platform, and cross-platform isn't really needed for this project. I'm using NetBeans, and after quickly looking into things, I find that "in-built" support for serial communication doesn't exist any more. Further searching led me to RXTX,

One serial port in multiple forms

空扰寡人 提交于 2019-12-11 08:59:11
问题 I would like to ask you folks about passing one serial port to multiple forms in one project. I acomplished to passed it from "main" form to "Form1" but I don't know how to handle it by buttons, combobox, etc. I want to change serial port parameters in seperate form. I'm quite new in c# and i can't figure it out. Form "main" namespace RS232 { public partial class mainform : Form { Form1 frm1; Form2 frm2; public mainform() { InitializeComponent(); this.Text = "Mitasubaszi controller"; frm1 =

C# access denied when trying to access communications port?

戏子无情 提交于 2019-12-11 08:56:43
问题 I'm trying to make a simple Windows Form Application in Visual Studios that will allow me to control the brightness setting of an LED strip hooked up to an Arduino. The programming inside the Arduino is already well and done, but the C# programming is what's giving me trouble. When trying to send strings of information through the port, I receive the following message: An unhandled exception of type 'System.UnauthorizedAccessException' occurred in System.dll . Additional information: Access