Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let Hits = 0
let Health = 0
input.buttonB.onEvent(ButtonEvent.Down, function () {
if (Health == 1) {
pins.A7.digitalWrite(true)
network.infraredSendNumber(Colors.Black)
pins.A7.digitalWrite(false)
}
})
network.onInfraredReceivedNumber(function (receivedNumber) {
pins.A7.digitalWrite(true)
if (Hits == 9) {
Health = 0
}
if (Health == 1) {
light.setPixelColor(Hits, receivedNumber)
Hits += 1
} else {
light.setAll(Colors.Red)
music.playSoundUntilDone(music.sounds(Sounds.PowerDown))
}
pins.A7.digitalWrite(false)
})
light.setAll(0xffffff)
Health = 1
Hits = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment