Projekt:Calliope/Scripte/2

Aus Un-Hack-Bar
Wechseln zu: Navigation, Suche
let Counter = 0
input.onButtonPressed(Button.A, () => {
   radio.sendNumber(1)
   Counter += 1
})
input.onButtonPressed(Button.B, () => {
   radio.sendNumber(2)
   Counter += -1
})
radio.onDataPacketReceived( ({ receivedNumber }) =>  {
   if (receivedNumber == 1) {
       Counter += 1
   }
   if (receivedNumber == 2) {
       Counter += -1
   }
})
radio.setGroup(17)
basic.forever(() => {
   basic.showNumber(Counter)
})