()
| 53 | |
| 54 | const 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 | }); |