pxt-ev3/sim/state/gyro.ts
Peli de Halleux d4ee9d2d62 various fixes
2019-10-13 00:01:34 -07:00

36 lines
709 B
TypeScript

namespace pxsim {
export const enum GyroSensorMode {
Angle = 0,
Rate = 1,
}
export class GyroSensorNode extends UartSensorNode {
id = NodeType.GyroSensor;
private rate: number = 0;
constructor(port: number) {
super(port);
}
getDeviceType() {
return DAL.DEVICE_TYPE_GYRO;
}
setRate(rate: number) {
rate = rate | 0;
if (this.rate != rate) {
this.rate = rate;
this.setChangedState();
}
}
getRate() {
return this.rate;
}
getValue() {
return this.getRate();
}
}
}