arduino

Member variable needs parameters for constructor

半腔热情 提交于 2019-12-20 03:20:02
问题 I'm trying to include a member variable in the class I write, MyClass.h #include <SomeClass.h> Class MyClass{ public: MyClass(int par); SomeClass B; } MyClass.cpp #include "MyClass.h" #include "SomeClass.h" MyClass::MyClass(int par){ B=SomeClass(par); } However SomeClass takes variables for its constructor, so the above code yields no matching function for call to "SomeClass::SomeClass()" What should I do here? Update: Seems like member initializer list is the way to go, but how if I want to

How to transmit a String on Arduino?

喜夏-厌秋 提交于 2019-12-19 10:06:10
问题 I want 2 Arduinos Leonardo to communicate, send a string for instance, so I have to use Serial1 to communicate via RS232 on pins 0 (RX) and 1 (TX). I need to write binary data in that pins, the problem is how can I send a String using Serial1.write . Serial1.print works without errors but I think it does not do what I want. Any suggestion? void setup() { Serial.begin(9600); Serial1.begin(9600); while (!Serial); // while not open, do nothing. Needed for Leonardo only } void loop() { String

io.on is not a function

喜夏-厌秋 提交于 2019-12-19 08:49:13
问题 I have this code working for receiving data from my Arduino but I will like to send data back to my Arduino and get a response on my client page. I added a listening function but I keep getting io.on is not a function when I send data from my client page. test.js io.listen(app.listen(3000)).on('connection', function (client) { // store client into array clients.push(client); // on disconnect client.on('disconnect', function() { // remove client from array clients.splice(clients.indexOf(client

Sending serial communication from Raspberry pi

十年热恋 提交于 2019-12-19 08:11:10
问题 I am sending serial data from a Raspberry Pi to an Arduino using a Python program. I am running Python 2.7.3. The program is: import serial ser = serial.Serial('/dev/ttyACM0', 115200) ser.write(b'\x4c\xff\x46') The problem is that nothing seems to be sent by these three lines if they are run in a program. But if I run them line by line in a Python shell, they work fine. Also, if I have the Arduino Serial Monitor open, the program works fine as well, without running the lines one by one in the

Is it possible to display compiler warnings in Arduino?

大城市里の小女人 提交于 2019-12-19 04:44:39
问题 I would like the Arduino IDE to display compiler warnings, and I would rather not have to compile once in the terminal for warnings, and again through Arduino to generate the hex file. Holding down the shift key while clicking the "Verify" button shows intermediate commands, but none of their output. Is this possible without hacking the Arduino IDE? 回答1: This feature has been added to the latest Arduino source code, although is not yet in a released version (see https://github.com/arduino

ESP32 direct port manipulation

感情迁移 提交于 2019-12-19 04:02:51
问题 Dear StackOverflowers, I am trying to use HX8357D 3.5" TFT from Adafruit (link) with an esp32. The TFT driver has two interfaces: SPI and 8-bit parallel. The provided library from Adafruit (link) only supports SPI on the esp32. I need to have higher display speeds, so I decided to try and add support for the esp32 myself. I'm not experienced at all with this kind of programming, but I liked the challenge. I figured out how the 8-bit interface work by reverse engineering the Arduino Uno/Mega

Communication Arduino-C++ do not read Arduino

╄→尐↘猪︶ㄣ 提交于 2019-12-19 03:56:41
问题 I have the following code: QSerialPort arduPort("COM5"); arduPort.setBaudRate(QSerialPort::Baud9600); arduPort.setDataBits(QSerialPort::Data8); arduPort.setParity(QSerialPort::NoParity); arduPort.setStopBits(QSerialPort::OneStop); arduPort.setFlowControl(QSerialPort::NoFlowControl); arduPort.open(QSerialPort::ReadWrite); cout<<arduPort.isReadable()<<endl; cout<<arduPort.isWritable()<<endl; arduPort.write("a"); QByteArray s=arduPort.readAll(); cout<<QString(s).toStdString()<<endl; And the next

Communication Arduino-C++ do not read Arduino

一曲冷凌霜 提交于 2019-12-19 03:56:06
问题 I have the following code: QSerialPort arduPort("COM5"); arduPort.setBaudRate(QSerialPort::Baud9600); arduPort.setDataBits(QSerialPort::Data8); arduPort.setParity(QSerialPort::NoParity); arduPort.setStopBits(QSerialPort::OneStop); arduPort.setFlowControl(QSerialPort::NoFlowControl); arduPort.open(QSerialPort::ReadWrite); cout<<arduPort.isReadable()<<endl; cout<<arduPort.isWritable()<<endl; arduPort.write("a"); QByteArray s=arduPort.readAll(); cout<<QString(s).toStdString()<<endl; And the next

Objective-C Serial - Mac OS X

一笑奈何 提交于 2019-12-18 15:18:45
问题 I'm currently running the followin in Terminal to send a command over USB serial. /Users/drummerboyx/Library/Scripts/arduino-serial -b 9600 -p /dev/tty.usbserial-A800ev0Z -s 1 Is there a way to do this in Objective-C? 回答1: Some google-fu found: Serial Communication Cocoa Framework (on arduino.cc!) AMSerialPort I know pretty much nothing about it, but the name "IOKit" also sounds pretty promising... 回答2: ORSSerialPort is a newer, easier to use alternative to AMSerialPort. Using ORSSerialPort

Is it possible to generate random numbers using physical sensors?

好久不见. 提交于 2019-12-18 11:02:50
问题 I've heard about people using light sensors, geiger counters, and other physical sensors to generate random numbers, but I'm skeptical. Is there really a way to generate random numbers from taking measurements of the physical world (using an Arduino or any other microcontroller)? If so, would these numbers ever be really random? to clarify: the question is about the feasibility of using microcontroller-gathered data to generate random numbers that could be applied soundly to cryptography-- an