arduino

QSerial error communicating with Arduino

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:38:28
问题 I wrote a simple program to use Qt (version 5.5 built from source for Visual Studio 2013 following this guide) to comunicate with Arduino. Here is a simple firmware which read from the serial and after 10 seconds prints "1" back: void setup() { Serial.begin(9600); //Open Serial connection for debugging } void loop() { if (Serial.available()) { char user_input = Serial.read(); if (user_input == '1') { delay(10000); Serial.print('1'); } } Here is the Qt program which send "1" on serial when I

Upload Arduino code on virtual serial port through Arduino IDE

我是研究僧i 提交于 2019-12-11 05:36:41
问题 I downloaded several software that provide virtual COM ports. These COM ports do appear in the Device Manager and can be selected for upload from the Arduino IDE, menu Tools -> Serial Port -> COM3. It starts uploading and reaches 90% and then it either times out or just does nothing. I want to upload onto the virtual COM port so I could then read the compilation output files in another program. I don't want to use my Arduino at all, and I don't want to manually get the verbose output files

Arduino button LED not working

只谈情不闲聊 提交于 2019-12-11 05:35:46
问题 When I push the button it turns the KY008 off but when I click it again it won't turn it off, but if I jiggle the Laser Diode a little bit the KY008 turns back on. Code: int LED = 12; int BUTTON = 4; void setup(){ pinMode(LED,OUTPUT); pinMode(BUTTON,INPUT); } void loop(){ if(digitalRead(BUTTON) == HIGH){ digitalWrite(LED,HIGH); }else{ digitalWrite(LED,LOW); } } 回答1: If you use INPUT you need to have a physical pullup (or pulldown) resistor (typically 10k). Otherwise use INPUT_PULLUP to use

Receive multiple values via pyserial and display in Python GUI

好久不见. 提交于 2019-12-11 05:21:39
问题 I am trying to receive data using serial communication in Python, which I can do, but I need to improve my code. I am sending a "packet" from Arduino that is in the form of "&4,25/n" with the key factors being the values in the positions of "4" and "25". In this packet, I have the "&" as a startbyte, and the new line feed "/n" as a terminator. This is so that I can tell when a new packet is sent, and it ends. How can I receive this packet "&4,24/n" and extract the values that are in the

Serial Communication Arduino to PHP

旧城冷巷雨未停 提交于 2019-12-11 05:19:42
问题 I´m working on a project in which I want to send sensor data from Arduino via Serial Communication to PHP. Unfortunately I can not read the Serial Port in PHP. However the other direction (PHP to Arduino) works perfectly. I´m using the php_serial.class.php from Rémy Sanchez, modified by Rizwan Kassim. I´m dependant from the readPort() - function. I´m working with an Arduino UNO and Apache WAMP-Server on Mac OS X. I should realise the serial connection without Ethernet shield. In further steps

Sending data to web using arduino GSM module using GPRS

主宰稳场 提交于 2019-12-11 05:17:53
问题 #include <SoftwareSerial.h> SoftwareSerial GSM(9, 10); // RX, TX int sensor=5; enum _parseState { PS_DETECT_MSG_TYPE, PS_IGNORING_COMMAND_ECHO, PS_HTTPACTION_TYPE, PS_HTTPACTION_RESULT, PS_HTTPACTION_LENGTH, PS_HTTPREAD_LENGTH, PS_HTTPREAD_CONTENT }; byte parseState = PS_DETECT_MSG_TYPE; char buffer[80]; byte pos = 0; int contentLength = 0; void resetBuffer() { memset(buffer, 0, sizeof(buffer)); pos = 0; } void sendGSM(const char* msg, int waitMs = 500) { GSM.println(msg); delay(waitMs);

How to make Arduino perform a task daily at the required time?

不羁的心 提交于 2019-12-11 05:10:03
问题 I am a student, and just newbie to Arduino. I am trying to make an automatic plant watering system which should water the plants twice a day.Is there anyway to make the Arduino to perform the task exactly at the required time daily, and then set itself to sleep mode? 回答1: exactly at the required time daily If your Arduino is clocked on internal RC, you won't have enough precision (1%). Your clock will derivate from about 7hours after 1 month. If you need to have a (very) good precision you

Change/Override Trinket (attiny85) USB identification name, device name

萝らか妹 提交于 2019-12-11 04:59:23
问题 The AdaFruit 'Trinket' library identifies itself as "Trinket HID Combo" when using as USB Keyboard. Is it possible to change this name to more useful name (with some code, constant etc)? I'm using Arduino 1.0.4 IDE. Take a look in the source of this library but cannot find this name hard coded. Any ideas to override this? 回答1: You have to change the Trinket library. Search for USB_CFG_DEVICE_NAME in usbconfig.h #define USB_CFG_DEVICE_NAME 'T', 'r', 'i', 'n', 'k', 'e', 't', ' ', 'H', 'I', 'D',

Global variable arduino

我的未来我决定 提交于 2019-12-11 04:39:10
问题 I'm using I2C to communicate a Master Arduino to 4 Slaves Arduinos, and an Shield (OULIMEX Shield LCD 16x2) on every Arduino slave. I send Data from the master to slaves using I2C. So I use this code in the master : #include <Wire.h> #include <math.h> #include <floatToString.h> double incomingData; void setup() { Wire.begin(); Serial.begin(9600); incomingData = Serial.parseFloat(); //read incoming data } void loop() { delay (1000); if (Serial.available()) { incomingData = Serial.parseFloat();

Unwanted sign extension in Arduino

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 04:24:39
问题 I am trying to achieve logical right shift in Arduino(i.e. avoid sign extension), and after reading the Arduino BitShift guide (https://www.arduino.cc/en/Reference/Bitshift), it suggests that shifting unsigned variables to the right, wont cause sign extension: When you shift x right by y bits (x >> y), and the highest bit in x is a 1, the behavior depends on the exact data type of x. If x is of type int, the highest bit is the sign bit, determining whether x is negative or not, as we have