All Questions
1,093 questions
4
votes
1
answer
299
views
Arduino IDE formatting quirk with nested lists
For an Arduino LED animation project I have been working on an editor tool using HTML and javascript. After setting up various things, the tool enables generating C++ code to paste into an Arduino ...
-2
votes
1
answer
81
views
How do I change what variable I am changing based on a separate number?
I am trying to change thing2 if I input 0, and thing3 if I input 1. I don't want to just have if/else to determine if I should be changing thing2 or thing3 because I want this to be more dynamic than ...
0
votes
1
answer
90
views
`sprintf` of %04d and %03x at the same time on Arduino
I have this code, work fine!
uint32_t id , id2;
char s[64]; // Should be enough
...
id2 = id = CAN.getCanId();
sprintf (s, "%04d : ", id ); // !!! HERE !!!
Serial.print(s);
the ...
0
votes
1
answer
84
views
Push button isn't pushed but keeps printing or inputting 1/HIGH
I have this Arduino code that will print 1 in the serial monitor and even prints two 1's. I haven't even pushed or clicked the push button, yet it already is already set to HIGH and even activates to ...
1
vote
1
answer
157
views
Why does the use of serial.readBytes increase program size by 10kb?
If I put this in my arduino program, in main.cpp, I suddenly run out of memory for flash program size:
if(msgSize > 2) {
//sr::sequentialRead(&serialRead, newTram.hash);
uint8_t bytes[...
0
votes
1
answer
119
views
Accessing invalid key in ArduinoJson causes ESP32 to reboot [closed]
I am running a project where I have multiple ESP32s communicate over WebSockets and I am using the Arduino IDE 2.3.4 for it. The communication primarily uses JSON and sends it as strings. To work with ...
1
vote
0
answers
47
views
"'StructName' does not name a type" when returning struct, but trailing return type works [duplicate]
Note: Please, do actually read the question before voting to close. This only happens in arduino IDE, this is not about a generic "Does not name a type" error. The code is perfectly valid as ...
0
votes
2
answers
106
views
Passing an array as an argument to a function [closed]
Please help how make it work.
int myArray1[] = {10, 11, 12};
int myArray2[] = {15, 16, 17};
void setup() {
Serial.begin(9600);
}
void loop() {
myFunction(myArray1); delay(1000); // i want to use ...
0
votes
1
answer
117
views
ESP32 pressure sensor readings (RFP602)
I have two RFP602 sensors that I use.
One connected to GPIO2, the other to GPIO4, each connected to a 1Mohm resistance.
The sensor connected to GPIO2 reads the data how I want it, I have to press a ...
1
vote
0
answers
78
views
`__has_include` macro on ESP board
I am working on a code for ESP boards that can be used on either ESP32 or ESP8266 and I want to make sure I include the correct libraries.
I know I can check if ESP32 OR ESP8266 are defined, but I ...
0
votes
1
answer
81
views
How to use C++ user defined modules in Arduino
Does Arduino support C++ module import functionality i.e. what would it require to implement something like this in Arduino: import std;?
-1
votes
1
answer
113
views
Class private variable values not accessible in public function
I'm experimenting with classes in Arduino code. I have the following small code snippet:
#include "Motor.h"
#include "Arduino.h"
Motor::Motor()
{
}
void Motor::Configure(...
0
votes
1
answer
122
views
Problem with char* variable malloc/free. Empty contents on recipient variable after using free
I am working on a custom SD card data logger using the following function and struct:
char *filenameCreator(const char *prefix, const char *num, bool addExtension)
{
char *filename = (char *)...
0
votes
1
answer
197
views
deserializeJson() failed: NoMemory when sending Serial json using ArduinoJson
Hey all I have a sketch that takes up 99% of my storage space since I am using a Arduino Nano.
Although everything in my code fits as-is, there seems to be an issue with me sending a json string over ...
3
votes
0
answers
1k
views
How to use C++20 in Arduino IDE?
I'm writing a program for esp32 using the Arduino IDE that needs to count the number of '1' bits in a byte.
I found a post elsewhere that says there's a nice function in the standard library to do it: ...