-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcraft.js
More file actions
23 lines (23 loc) · 694 Bytes
/
craft.js
File metadata and controls
23 lines (23 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
radio.onReceivedNumber(function (receivedNumber) {
if (receivedNumber == 1) {
angle = Math.max(0, angle - 5)
pins.servoWritePin(AnalogPin.P0, angle)
led.stopAnimation()
} else if (receivedNumber == 2) {
angle = Math.min(180, angle + 5)
pins.servoWritePin(AnalogPin.P0, angle)
led.stopAnimation()
} else if (receivedNumber == 3) {
angle = 90
pins.servoWritePin(AnalogPin.P0, angle)
} else if (receivedNumber == 3) {
pins.servoWritePin(AnalogPin.P1, angle)
}
})
let angle = 0
angle = 90
pins.servoWritePin(AnalogPin.P0, angle)
radio.setGroup(1)
basic.forever(function () {
basic.showNumber(angle)
})