support for multiple simulated servos

This commit is contained in:
Peli de Halleux
2016-11-07 22:25:19 -08:00
parent 633522c800
commit 7117ba771e
2 changed files with 12 additions and 7 deletions

View File

@ -72,12 +72,12 @@ namespace pxsim.pins {
}
export function servoWritePin(pinId: number, value: number) {
let pin = getPin(pinId);
if (!pin) return;
analogSetPeriod(pinId, 20000);
// TODO: per pin state
if (board().microServoState.angle != value) {
board().microServoState.angle = value;
runtime.queueDisplayUpdate();
}
const state = board().servosState.servoState(pinId);
state.setAngle(value);
}
export function servoSetPulse(pinId: number, micros: number) {