arduino

Using member functions of class in global function before declaring object

坚强是说给别人听的谎言 提交于 2019-12-13 01:26:25
问题 I have an event handler function and in that function there is a call to a member function of a class. The event handler function is declared in the class cpp file but not part of the class, it's no a member function. When i compile the code the compiler says that the function is note in the scope, because it's calling a member function within the global event handler function. My question is as followed: is there a way to use a meber function in a global function? (The object is created

controlling two dc motors and servo with arduino code

霸气de小男生 提交于 2019-12-13 01:26:03
问题 The code does not seem to be working but I have also just started learning how to code arduino. I'm trying to run two dc motors and one servo as steering for a robot car. How should I wright it so it works. All I'm trying to do is use two motors to drive the car forward and the servo to provide direction for the car. How can I improve this code? #include <Servo.h> int servoRightPin = 2; int servoLeftPin = 3; int servoDirPin = 4; Servo servoRight; Servo servoLeft; Servo servoDir; void turnLeft

Is there a possibility to glow the led in 5*5 matrix in a square shape with the common anode configuration

元气小坏坏 提交于 2019-12-13 01:18:10
问题 I have a led-matrix that is common anode in row-wise and common cathode in column-wise. I need to glow the matrix in the shape of a square(first row && last row && first column && last column) , but I was not able to do it. I was able to glow the first and last row separately and first and second column separately) void first_last_row(); void first_last_column(); int Led_Row_Pins[] = { 2 , 3 , 4 , 5 , 6 } ; // Anode pins are shorted in row_wise_manner int Led_Column_Pins[] = {8 , 9 , 10 , 11

Reconnect Serial Port on Processing

人盡茶涼 提交于 2019-12-13 00:42:25
问题 I'm using processing and I'm reading inputs from Arduino with a serial port but connection drop may occur, in this case how to I reopen this connection? 回答1: You can catch RuntimeExceptions thrown by Serial.java, which generally indicate the serial port is no longer available. Within that catch block, then, you can start polling the serial port; once it allows you to reinstantiate your Serial instance, the port is again available (e.g. the USB cable is plugged back in) and you're back in the

Convert MFRC522 UID Hex Bytes to Printable Decimal

坚强是说给别人听的谎言 提交于 2019-12-12 18:23:07
问题 I'm using the MFRC522 library on my Arduino UNO to read Mifare RFID tag Info. // Print HEX UID Serial.print("Card UID:"); for (byte i = 0; i < mfrc522.uid.size; i++) { Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); Serial.print(mfrc522.uid.uidByte[i], HEX); } Serial.println(); I've got a byte array(4) which contains the HEX UID: 54 C7 FD 5A But I've failed to convert it to Decimal: HEX(5AFDC754) => DEC(1526581076) I've tried to convert the byte array to char reversely, but the

How to send SMS with GSM module SIM800 and Arduino Uno?

a 夏天 提交于 2019-12-12 17:10:06
问题 I am trying to send a text message from Arduino through a SIM800 GSM module. The message gets to the given number but not in the correct format. It shows "Message format not supported". I am including my code here and a fast reply is much appreciated. #include <SoftwareSerial.h> SoftwareSerial GPRS(11, 12); //11 = TX, 12 = RX unsigned char buffer[64]; //port int count=0; int i = 0; //if i = 0, send SMS. void setup() { GPRS.begin(9600); // the GPRS baud rate Serial.begin(9600); // the Serial

Strange initial output using Serial.print

核能气质少年 提交于 2019-12-12 17:01:06
问题 When I'm writing to the serial interface, I'm getting strange and unexpected output when my sketches first run. The output seems to be a variant of what should be printed: eg: String text1 = "foobar"; void setup() { Serial.begin(9600); Serial.print("\n"); Serial.print(text1); } void loop() { } Results in the output: fo foobar (the new line appears before "fo" but I couldn't work out how to include it). So some variant of whatever is supposed to be printed, gets printed before the actual text

Double way Serial communication between Arduino and Qt 5.7

隐身守侯 提交于 2019-12-12 14:15:48
问题 I am trying to transfer data from Arduino to a C++ Qt5.7 and from a Arduino to a C++ Qt5.7 (MinGW) program. I am able to transfer the data FROM QT TO ARDUINO without any problems. The Arduino blinks perfectly. On the other hand, the data transfered FROM THE ARDUINO TO QT isnt always the expected (sends "LED ON" when it should be "LED OFF") and sometimes it doesnt communicate at all! QT code: #include <QCoreApplication> #include <QDebug> #include <QSerialPort> #include <QSerialPortInfo>

Why is Chrome loading my HTML in a “pre” tag?

拜拜、爱过 提交于 2019-12-12 13:05:19
问题 I have a very basic web page that I'm loading with an Arduino Server. When I view the page on Safari, everything works fine and looks good when I use the inspector. But when I load it on Chrome (version 39.0.2), it wraps all of my HTML in a "pre" tag which prevents my webpage from loading (I've attached screenshots showing the Inspector output). It also moves all of my code out of the "head" tag and into the "body" tag. First, here is my HTML : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01

Does Arduino's clock (millis) continue counting in the background during interrupts?

旧城冷巷雨未停 提交于 2019-12-12 13:04:14
问题 I have a quick question which apparently isn't said online from what I've read: I know millis() on an Arduino doesn't change during a custom interrupt, but does the associated timer still counts in the background ? My program is time-sensitive and I would like to know if I should increase its value (how?) each time one of my interrupts is handled so that the main program's clock doesn't drift. Thanks in advance, Regards, Mister Mystère 回答1: The CPU-internal timer will count even when