RE: Makeblock libraries fail on Arduino


#1

Continuing the discussion from Makeblock libraries fail on Arduino UNO:

I have found a solution to this ancient problem :grin:
In the Servo.h header that can be found in arduino/libraries/makeblock/utility, there is a following part around line 60:

// Architecture specific include
#if defined(ARDUINO_ARCH_AVR)
#include "avr/ServoTimers.h"
#elif defined(ARDUINO_ARCH_SAM)
#include "sam/ServoTimers.h"
#elif defined(ARDUINO_ARCH_SAMD)
#include "samd/ServoTimers.h"
#else
#error "This library only supports boards with an AVR, SAM or SAMD processor."
#endif

this should be replaced with simply:

// Architecture specific include
#include "avr/ServoTimers.h"

After that, you may get some further errors, but inserting an include to this header in the Firmware file (Firmware_for_MegaPi.ino in my case) made it to work:

#include <Servo.h>

#2

Wouldn’t it be easier to simply #define ARDUINO_ARCH_AVR before the Makeblock header file?


#3

Thanks for the tip, and yeah, that would also work in this case. It’s just that I saw in the Makeblock-Libraries package, that the only provided folder under utility is the avr one, so setting any other architecture would throw up a missing header error, so why bother with the proper selection of avr?


#4

I suspect it was to remain somewhat compatible with future offerings, but that’s a question for @tech_support. :slight_smile:


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.