MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / onReadable

Function onReadable

examples/drivers/m5dial-rotary_encoder/main.js:55–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53
54const rotaryEncoder = new device.peripheral.RotaryEncoder({
55 onReadable() {
56 const count = this.read();
57 trace(`count: ${count}\n`);
58 drawCount(count.toString());
59 if (count > current) {
60 buzzer.tone(7000, 20);
61 } else {
62 buzzer.tone(6000, 20);
63 }
64 current = count;
65 },
66});

Callers

nothing calls this directly

Calls 3

drawCountFunction · 0.85
readMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected