-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtests.ts
30 lines (30 loc) · 885 Bytes
/
tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// tests go here; this will not be compiled when this package is used as a library
led.plot(0, 0);
bluetooth.onBluetoothConnected(() => {
led.plot(0, 1);
})
bluetooth.onBluetoothDisconnected(() => {
led.unplot(0, 1);
})
bluedot.startService();
bluedot.onButton(BlueDotButtonState.Down, () => {
led.unplot(0, 2);
serial.writeValue("b", bluedot.isPressed() ? 1 : 0)
})
bluedot.onButton(BlueDotButtonState.Up, () => {
led.plot(0, 2);
serial.writeValue("b", bluedot.isPressed() ? 1 : 0)
})
bluedot.onMoved(() => {
led.toggle(0, 3);
serial.writeValue("x", bluedot.x())
serial.writeValue("y", bluedot.y())
let x = pins.map(bluedot.x(), -1023, 1023, 1, 4);
let y = pins.map(bluedot.y(), -1023, 1023, 1, 4);
for (let i = 1; i < 5; ++i) {
for (let j = 1; j < 5; ++j) {
led.unplot(i, j);
}
}
led.plot(x, y);
})