So I have recently been using the Elegoo Uno board, I've realised that I have run into a few issues with this board, one of which being: #error "This library only supports boards with an SAM processor."
I was wondering if an actual Arduino board would solve this?
I've found some fairly cheap ones on Ebay, would these be suitable and have a SAM processor?
Don't you think it would have been more helpful to provide a link to where you got the library from?
Since you didn't do that, I searched and found this one, though I have no guarantee it's what you're using:
Right there in the readme it says:
The VarSpeedServoSam Arduino library is an adaptation of the VarSpeedServo.h library to work on boards with SAM processor such as Arduino Due.
Turns out the VarSpeedServo library it's based on was written specifically for the AVR architecture used by your Uno. So why not just use the library that was written for the board you have?
In the Arduino world, the Zero's architecture is called SAMD, not SAM. You will get the same exact compiler error if you try to use that library with the Zero. Whether the library could be easily modified to also work with SAMD boards I can't say. I have no experience with the SAM or SAMD boards.
Thanks for the comment, I didn't know that SAMD is something special. I'd think that the library documentation will contain more information about the required/compatible hardware.
Atmel/Microchip does call both chips SAM. I guess it's kind of like how the ATmega, ATtiny, and ATxmega are all AVR. I don't know why Arduino decided to split the support for the Due and Zero into two separate hardware packages. I guess there must be significant enough differences that the advantage of sharing the code base was not considered to outweigh the extra complexity necessary to support both microcontroller types. The fact that the Due was out of production at that time might have had a strong influence on the decision. Splitting it into two packages allowed them to focus the development work on the Arduino SAMD Boards hardware package to a single microcontroller and leave the Arduino SAM Boards hardware package to gather dust. I'd prefer to see packages support a wider range of devices. It would be great if we could have a single unified AVR package that supported every AVR, or at least every AVR within a logical group (e.g. ATmega), rather than needing to have separate 3rd party packages to support chips not in Arduino AVR Boards. But of course there is no economic incentive for Arduino to pay developers to write code for microcontrollers they don't sell.
DrDiettrich:
I'd think that the library documentation will contain more information about the required/compatible hardware.
Well it does say it works on the Due, but it also says "boards with SAM processor" so that could be confusing to someone who isn't familiar with the Arduino architecture name conventions.
The first question is why are you trying to use that library? What will it do for you that the original VarSpeedServo library can't? That works just fine with UNOs and similar 328P boards.
This library file is for the Arduino based on the SAM processing chip, such as Arduino Due, while UNO uses the AVR kernel, and the two compiles are different, so the library files cannot be used universally.
Arduino is an open-source hardware meaning anyone can make the design and sell it, and I have some Elegoo Unos and Nanos, a few official Unos, all of them work well. The problem you met is Arduino control chip, so even if you change into official Arduino UNO, the problem is still there.
All the Arduino UNO boards do not support SAM processor, so if you want to solve this problem, I suggest you change a library file based on AVR chip, or you need to purchase an Arduino Due.