Error when building Arduino sketch - file "sam.h" not found

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Hello,

 

I am trying to build the default blink Arduino sketch for the Adafruit Metro M0 Express (ATSAMD21G18) in Microchip Studio.

 

Here is the error I get upon attempting to build:

 

I have tried to change the include paths for the C and C++ compilers to include C:\Users\User\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0\CMSIS\Device\ATMEL, but this gives me a different set of errors:

 

 

Here is all the software I am using:

  • Arduino IDE 1.8.13
  • Arduino board packages:
    • Arduino SAMD Boards 1.8.11
    • Arduino SAM Boards 1.6.12
    • Adafruit SAMD Boards 1.6.6
  • Microchip Studio 7.0.2542
  • Windows 10 20H2, running in VirtualBox 6.1.18 on macOS 11.1

 

 

Here is the code:

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

 

Arduino/CircuitPython maker team - github.com/fishycircuits

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's been a couple of threads recently about importing Arduino "sketches" into Atmel/Microchip Studio - and associated problems

 

See: https://community.atmel.com/forum/imported-arduino-due-project-wont-compile and follow the links

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...