Projekt:Calliope/Scripte/2

Aus Un-Hack-Bar
Zur Navigation springen Zur Suche springen
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)
})