()
| 31 | encoder = new TextEncoder; |
| 32 | |
| 33 | constructor() { |
| 34 | this.lora = new device.peripheral.lora.Default({ |
| 35 | onReadable: () => this.receive(this.lora.read()) |
| 36 | }); |
| 37 | |
| 38 | this.button = new device.peripheral.button.Flash({ |
| 39 | onPush: () => { |
| 40 | if (this.button.pressed) |
| 41 | this.send(); |
| 42 | } |
| 43 | }); |
| 44 | |
| 45 | this.update(); |
| 46 | } |
| 47 | send() { |
| 48 | this.sent += 1; |
| 49 | this.messageSent = `hello #${this.sent}` |