pxt-calliope/docs/examples/servo-calibrator.md
Peli de Halleux 2bec29bdd1 Milk Jar Robot (#377)
* first draft

* fixed code section

* calibration

* fix broken link
2017-03-26 21:22:40 -07:00

453 B

Servo calibrator

let angle = 90
input.onButtonPressed(Button.A, () => {
    angle -= 5
    pins.servoWritePin(AnalogPin.P0, angle)
    led.stopAnimation()
})
input.onButtonPressed(Button.B, () => {
    angle += 5
    pins.servoWritePin(AnalogPin.P0, angle)
    led.stopAnimation()
})
basic.forever(() => {
    basic.showNumber(angle)    
})
pins.servoWritePin(AnalogPin.P0, angle)
basic.showString("Press A or B to change servo angle")