splits m:b simulator state
This commit is contained in:
17
sim/state/lightsensor.ts
Normal file
17
sim/state/lightsensor.ts
Normal file
@ -0,0 +1,17 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user