Hi folks,
Baby steps to PlatformIO for Arduino development. Let’s start with a simple question:
I think you gonna be surprised but the following code throws an error when compiling:
#include <Arduino.h>
const int num_1 = 15;
int num_2 = 0;
num_2 = 10;
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Error is:
src/main.cpp:6:1: error: ‘num_2’ does not name a type
num_2 = 10;
^
*** [.pioenvs/uno/src/main.cpp.o] Error 1
It works on Arduino IDE as it supposed to be. I think there are some differences when you code in PlatformIO comparing to Arduino IDE.
What might be the problem?