Closed rhubarbdog closed 5 years ago
The second parameter to setServoValue (range) is in microseconds and should be approximately 2000 not 200. You can leave it off to get the default 2000.
setServoValue does a similar job to the angle() function in the second program, but using a center and range rather than min and max. It calls setServoPulseUs to set the pulse in microseconds (called period in the angle function). setServoPulseUs takes care of setting the analogue period to 20ms. An angle value of 200 sent to setServoValue will get clipped to 180.
i adjusted the first program and removed the second parameter to setServoValue it still wasn't working. i now have it working, the issue is the external circuit setServoValue uses the first circuit where as the setAnalogValue method uses the second circuit.
thanks for reporting back @rhubarbdog.
Closing this issue now as it turned out to be a problem with your circuit and not the software.
hi, I'm new to c++ on the microbit and i am following documentation on this web site.
this program doesn't work, it compiles, but my servo does nothing. I don't have a logic analyser, but the LED i put in the circuit looks to be at full brightness implying no PWM
where as with the same external circuit I can operate my servo with this code and the LED is at differing brightness for each servo position