0

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.

3
  • 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
    Jan 19 at 20:48
  • I selected "SparkFun SAMD21 Mini Breakout". I got it working see below :) Jan 19 at 20:51
  • 2
    Given 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
    Jan 19 at 20:53
1

Ahhhh, I figured it out. I had to add #include "Arduino.h" to the .cpp file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.