I have just reccently bought an Arduino Zero to play with debugging. Alas, I’m simply stuck with the simple HelloWorld. My .ini looks like
[env:zeroUSB]
platform = atmelsam
framework = arduino
board = zero
But compiling croaks with
src/main.c:4:2: error: ‘Serial’ undeclared (first use in this function); did you mean ‘Sercom’?
The main.cpp is simply
#include <Arduino.h>
void setup() {
Serial.begin(115200);
Serial.print(“Hello”);
}
void loop() {}
Arduino is a C++ framework, why is this file called src/main.c? Rename it to src/main.cpp, and you shall be able to use C++ objects like Serial with no problems.
As you can see in the source, the C++ objects only get exposed to you in C++ mode (__cplusplus defined).
Well, what should I say? It’s not the first time that happened to me
I blame the compiler structure for that, but that’s another story I don’t want to roll out here. Anyway, thanks a bunch 