I've been playing with the servo/leds controller example from https://learn.adafruit.com/multi-tasking-the-arduino-part-1?view=all
In the Update function for the Servo, I added the following for debug purposes:
Serial.print("Position: "); Serial.println(pos);
Position: 180 Position: 90 Position: 0 Position: 90 Position: 180 Position: 90 Position: 0
as an output in the Serial Monitor during the execution.
Then I changed those two lines to:
Serial.print("Position: " + pos);
which produced this output
(seems to print 'Position' whenever the value is 0.)
From the logic point of view, both should be the same so I've trying other things suspecting some kind of interference between the servo and the serial communication withouth success like:
a)Different baud rates (1200, 2400, 9600 up to 115200), keeping the code in sync with the Serial Monitor. b)Powering the Arduino with an external power source instead of the USB connection to my laptop. Same by powering the servo independently c)Disconnecting the servo direcly
I would really appreciate if anyone has a clue of what is happening here. Cheers!