I recently switched computers and installed Arduino IDE, Added SAMD21 to the boards manager and installed drivers.
My sketch previously ran on my laptop with no problems. Now when I try to compile for the SAMD21 Mini, I get a 'Serial1' was not declared in this scope error.
If I try to compile it for Mega, there are no problems.
I have tried sample code with Serial1 for SAMD21 and it compiled and uploaded with no problems.
-
The samd21g serial options are more configurable than for an AVR. Much of this is left to the variant definition. So which board do you have selected?timemage– timemage2021年01月19日 20:48:14 +00:00Commented Jan 19, 2021 at 20:48
-
I selected "SparkFun SAMD21 Mini Breakout". I got it working see below :)exchangenoob– exchangenoob2021年01月19日 20:51:53 +00:00Commented Jan 19, 2021 at 20:51
-
2Given that you're now liable to be the only person to answer the question, you may want to just edit the question and answer to make a good read for whomever comes across it in the future. E.g. the question doesn't mention that you're not working in an .ino file.timemage– timemage2021年01月19日 20:53:04 +00:00Commented Jan 19, 2021 at 20:53
1 Answer 1
Ahhhh, I figured it out. I had to add #include "Arduino.h"
to the .cpp file.