Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
28 votes
Accepted

Why can't my IF statement see a global?

The backslash in your comments are the problem. As per C++ language definitions, a \ at the end of the line is interpreted as a "line continuation". Thus, your comment gets continued in the next line ...
user avatar
7 votes
Accepted

"stray '/302' in program error" when compiling

0302 is 0xc2. Somewhere in your source you have one or more non-breaking spaces (0xa0) encoded in UTF-8 (0xc2 0xa0). Use od or a similar tool to find them, and then replace them with normal spaces. ...
user avatar
7 votes
Accepted

NodeMCU and expected ';' before wrong ' " '

In C you can not use quotation marks inside quotation marks (thus nested). Replace message2 += " <meta name="viewport" content="width=device-width, initial-scale=1">"; to message2 += " <...
user avatar
5 votes
Accepted

Ubuntu class string has no member remove

The remove method was added to the String class in 1.0.6. Installing Arduino IDE from the Ubuntu repository gets you a really old package (1.0.5). You should download and install the newest version ...
user avatar
  • 1,645
5 votes
Accepted

Project wont compile when I place functions below function calls

You need to declare your function before you use it. So either the whole function body needs to be before the usage, or you must add a function prototype declaration. void myfunction(); myfunction()...
user avatar
  • 176
5 votes

Can't use uint16_t in library

Using #include <Arduino.h> in your myheader.h will also include <stdint.h> and probably solve this. The Arduino IDE automatically includes Arduino.h in the sketch itself, but apparently ...
user avatar
  • 1,575
5 votes
Accepted

Own type definition using a struct does not name a type

This is a bug in the Arduino IDE: when converting your .ino file to a .cpp file, it added a declaration for the function ledFactory() before the declaration of the type led_t. As it appears to be ...
user avatar
  • 35.5k
5 votes
Accepted

How to enable exception handling on the Arduino Due?

First, we must make sure the "-fno-exceptions" compiler flag is overwritten with "-fexceptions". In addition, we must link a separate library that includes the compiler support ...
user avatar
  • 1,059
4 votes

The code is showing a error that "ledpin2 is not declared in the scope"

You mix capitals with non capital characters. The case of characters in variable names are important, so ledPin2 is a different variable than ledpin2. Also, never mix similar names (unless it is ...
user avatar
4 votes

Compilation Error in nodeMCU along with oneWire temperature sensor ds18b20, and 2x16 LCD display (not I2C)

It appears you're using an outdated version of the OneWire library that does not support ESP8266. Please follow these instructions to upgrade to the latest release of the library: Sketch > Include ...
user avatar
  • 3,834
4 votes
Accepted

'DynamicJsonBuffer' was not declared in this scope

Did you forget to include the ArduinoJSON header file: #include <ArduinoJson.h>
user avatar
  • 6,922
4 votes

"stray '/302' in program error" when compiling

One cause of the /(302) error is copy and paste code from a word processor. You have ASCII codes copied that add spaces, etc to your code. Go through each identified line and remove any extra spaces ...
user avatar
  • 51
4 votes
Accepted

What is wrong with this code?

if (rightStickVerticalPwm == 0) { servo1.write(elevatorServoStop); } else if (rightStickVerticalPwm > 1500) { servo1.write(100); } else (rightStickVerticalPwm < 1400) { ...
user avatar
3 votes
Accepted

Arduino library not working, can't find header

You spelled the header filename wrong: #include "SegDispaly.h" should be: #include "SegDisplay.h" You have also made the same mistake in the class name multiple places in SegDisplay.cpp.
user avatar
  • 3,834
3 votes
Accepted

Cannot convert 'String' to 'uint8_t {aka unsigned char}' in initialization

uint8_t first = atoi (tmp1.substring(1, 3).c_str ()); Or even: String data = "#255101987"; uint8_t first = atoi (data.substring(1, 3).c_str ());
user avatar
  • 35.1k
3 votes
Accepted

compile error when using two typename in template class

In this class declaration: class Test { public : Test(); ~Test(); Map<int, String> *list = new Map<int, String>(); }; This line is wrong: Map<int, String> *list = ...
user avatar
  • 35.1k
3 votes

error: expected primary-expression before '(' token

You seem to have been programming in Java recently, because many of your errors have a Java ‘whiff’ to them. This, as you’ve tagged, is C++, not Java. sendMouseState: a. You wrote leftPressed == ...
user avatar
  • 1,795
3 votes
Accepted

How to deal with this array correctly?

You don't want an array of strings containing the (badly formatted) names of variables. Instead you want an array of 32-bit integers containing the values held within those variables. const uint32_t ...
user avatar
  • 101k
3 votes

Strange compiler error (Segmentation Fault)

This is a known fault with the compiler in Windows. The annoying thing is that it's the version of the compiler that is included in the Windows Store App version of the Arduino IDE. It also snuck ...
3 votes
Accepted

Selected board depends on 'arduino' core (not installed)

I needed to install the boards package for: Arduino AVR Boards Under Tools -> Board -> Board Manager
user avatar
  • 435
3 votes
Accepted

Two libraries collide. Ambiguous functions/variables?

The DEBUG_ functions in the DGS class are private and used only in DGS.cpp. They will not collide with the macros from DHT.h If DHT.h is included before DGS.h, the preprocessor replaces the DEBUG_ ...
user avatar
  • 16.1k
3 votes
Accepted

Unable to declare variable in a library that doesn't have a class: multiple definition of the variable

In Lib.h you should declare an extern int myVariable; In Lib.cpp you can define it once #include "Lib.h" int myVariable=123; ...
user avatar
3 votes
Accepted

Unable to compile c++11 libraries despite having added -std=c++11 in platform.txt

The AVR-based Arduinos don't come with anything close to a full C++ standard library implementation. They have avr-libc which is fairly complete to at least the C99 standard, that is the C standard ...
user avatar
  • 3,868
3 votes
Accepted

Problem in upload bootloader into esp32

esp32 has a fixed bootloader in read only memory. it is not replaceable ArduinoISP sketch is a programmer only for classic ATmega MCU boards in valid case you would have to select the programmer in ...
user avatar
  • 16.1k
2 votes

Compilation Error: "cannot declare 'client' to be of abstract type 'Client'"

You can't use Client directly like that. It's just an abstract class. You have to use one of the classes like EthernetClient or WiFiClient that implements it. Client is like a shell of a class. ...
user avatar
  • 2,606
2 votes
Accepted

Suddenly I can't compile any sketch. Not even a blink sketch that I compiled earlier

So I seem to have fixed it. One way or another, I think VisualMicro suffered some type of problem with the installed boards. My first clue was that my sketches still compiled int the native Arduino ...
user avatar
2 votes

Suddenly I can't compile any sketch. Not even a blink sketch that I compiled earlier

There are a few suggestions here, here and here: Ensure you are using the latest Arduino software that is compatible with Visual Micro (this is not necessarily the latest Arduino software!) Go to ...
user avatar
2 votes

Error running the code

Three remarks to your question. Avoid using UPPERCASE as that is considered to be a typographical notation for shouting. See http://practicaltypography.com/all-caps.html The compiler error is due to ...
user avatar
  • 7,811
2 votes
Accepted

Arduino IDE compiles, UECIDE not

This is a bug in UECIDE. It doesn't like lambda functions in constructors. A complete rewrite of the sketch parser to use Exuberant Ctags is under way.
user avatar
  • 101k

Only top scored, non community-wiki answers of a minimum length are eligible