The blood pressure measurement system revealed to be more challenging than I expected...
As a matter of fact, the pulse detection algorithm takes up most of the Atmel 32U4 resources, thus leaving too few time to other tasks. This has some counter-effects, the most noticeable being a non-uniform movement of the continuous rotation servo.
I tried several workaround, like moving the pulse detection algorithm in Timer3 ISR instead of Timer1 ISR (and obviously forcing the Servo library to use Timer1 instead of Timer3) but the problem was still there. I also tried to skip the Servo library and generate the PWM for the servo using the analogWrite function, but the problem was not resolved. I guess the problem is that the pulse detection algorithm completely disables interrupts, thus causing the PWM signal to jitter randomly
For this reason, I decided to move the servo control logic to another Arduino board. The Enchanted objects challenge's kit included a Arduino UNO board, but unfortunately I can use this board due to size contraints. So the choice was for the Arduino Mini Pro board, which is small enough to accommodate inside the MagicHat.
Despite the additional work this decision involves, there are also some benefits. For example, the mouth control logic I originally removed from the list of features I planned to implement is returning now into play.
The connection between the two boards is very simple:
a digital output driven by Arduino Yun tells Arduino Mini to start the blood pressure servo
a digital output driven by Arduino Yun tells Arduino Mini to bend the hat