CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 14:05:53 GMT
content-type: text/html; charset=utf-8
cf-ray: 965cb1b1c909c167-BLR
cf-cache-status: DYNAMIC
cache-control: private
set-cookie: prov=2cf4bb3b-f582-4d52-ae8d-1e99d63ab20d; expires=Mon, 27 Jul 2026 14:05:52 GMT; domain=.stackexchange.com; path=/; secure; httponly
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding
content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com
x-clacks-overhead: GNU Terry Pratchett
x-frame-options: SAMEORIGIN
x-request-guid: a371fda6-e80a-483b-bc87-47ff8fea0e76
x-worker-origin-response-time: 919000000
x-dns-prefetch-control: off
set-cookie: prov=2cf4bb3b-f582-4d52-ae8d-1e99d63ab20d; Path=/; HttpOnly; Domain=stackexchange.com
set-cookie: __cf_bm=hQlN7d5jqZke0x9sYzwANqSDodOWFGJvNW2jm58ehEo-1753625153-1.0.1.1-.hKheSRB_z5ezLAKXpFGzvCVKm9KSoJ2c045QBs1yULWIOxGXAC_hqMgwiJ.NH2zssOhaUODr2GlNNPeXpHK4Ldpx5uG_t8.W9oVdat06Hs; path=/; expires=Sun, 27-Jul-25 14:35:53 GMT; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=9_2ru.QYOhDMEToRnyYvH2MDCKNKd8fUJRFrD0scWN8-1753625153221-0.0.1.1-604800000; path=/; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
server: cloudflare
content-encoding: gzip
Newest 'c++' Questions - Arduino Stack Exchange
Skip to main content
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsQuestions tagged [c++]
C++ is the standard language used to program the Arduino IDE. However, the Arduino IDE does have lots of libraries built in, so functions such as "main" are not called directly in the sketch code. Most Arduino code online is written in this language.
1,069 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-1
votes
1
answer
62
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
77
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 ...
1
vote
1
answer
55
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
146
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
65
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
40
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
89
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
94
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
67
views
0
votes
1
answer
66
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
91
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
96
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
171
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: ...
1
vote
0
answers
221
views
LCD Wiki screen (ILI9341) works on Mega. How to get it working on the Due?
I have this exact LCD shield: https://www.lcdwiki.com/2.8inch_Arduino_Display
SKU: MAR2808
Driver IC: ILI9341
It works on an Arduino Mega 2560 using the old libraries the manufacturer (I assume) ...
- The Overflow Blog
-
-
- Featured on Meta
-
-
Related Tags
arduino-uno × 283
programming × 210
arduino-ide × 124
c × 84
serial × 72
arduino-mega × 68
library × 50
esp8266 × 46
class × 45
array × 43
string × 41
led × 37
arduino-nano × 33
sensors × 33
esp32 × 33
interrupt × 25
pointer × 22
sketch × 21
variables × 20
i2c × 20
memory-usage × 19
compile × 17
lcd × 17
softwareserial × 15
servo × 15
more related tags
Hot Network Questions
- Anonymizing a submission for double-blind review
- I don't understand Photos Library.photoslibrary
- Were the Fantastic Four the only superheroes on Earth-828 in The Fantastic Four: First Steps?
- leftmargin in enumerate
- Kepler's first law proof error - can anyone help me see what the error is?
- When was the last time all humans were on the ground not in the air?
- Not your ordinary affix riddle
- Why aren't there baleen whales at about the size of a dolphin?
- Are classified documents subject to a subpoena in discovery?
- Can I switch the stand on my Apple Studio Display?
- Will this work as an XOR gate?
- Can a minor run a business by having an adult act on their behalf?
- When did the OEIS get even better?
- About security concerns using in find -exec vs interactively performing the same task
- I don't have enough alive employees to start the day. What now?
- Why does Gaza Humanitarian Foundation (GHF) not distribute more food in Gaza?
- How can my dwarves keep humans from reverse engineering their technology?
- Word order for a phrase with a number, adjective and noun
- What were the two colored keys on a MUPID for?
- Has the Silver Surfer's clothing (or lack thereof) ever been addressed in the comics?
- How to extend an MDF shelf?
- How to make that the object sliding down along the local axis while following the rotation of the another object?
- How to put commutative symbol in a commutative diagram?
- How to change opamp variable resistor to fixed resistor?