pxt-calliope/sim/state/lightsensor.ts

17 lines
388 B
TypeScript
Raw Normal View History

2016-08-30 20:51:32 +02:00
namespace pxsim {
export class LightSensorState {
usesLightLevel = false;
lightLevel = 128;
}
}
namespace pxsim.input {
export function lightLevel(): number {
let b = board().lightSensorState;
if (!b.usesLightLevel) {
b.usesLightLevel = true;
runtime.queueDisplayUpdate();
}
return b.lightLevel;
}
}