The Squid Game Micro:bit!

The Squid Game Micro:Bit is a micro:bit connected to a speaker, red LED, and a green LED, that plays the "red light, green light" song from Squid Game(2021) and lights up red or green depending on the part of the program.

The Code(In JavaScript)

input.onButtonPressed(Button.AB, function () {

basic.showString("Hello!")

})

control.onEvent(EventBusSource.MES_BROADCAST_GENERAL_ID, EventBusValue.MICROBIT_EVT_ANY, function () {

music.playTone(131, music.beat(BeatFraction.Half))

music.rest(music.beat(BeatFraction.Half))

music.playTone(131, music.beat(BeatFraction.Half))

music.rest(music.beat(BeatFraction.Half))

music.playTone(131, music.beat(BeatFraction.Half))

music.rest(music.beat(BeatFraction.Half))

music.playTone(131, music.beat(BeatFraction.Half))

music.rest(music.beat(BeatFraction.Half))

music.playTone(131, music.beat(BeatFraction.Half))

music.rest(music.beat(BeatFraction.Half))

music.playTone(131, music.beat(BeatFraction.Half))

music.rest(music.beat(BeatFraction.Half))

})

basic.forever(function () {

music.setBuiltInSpeakerEnabled(true)

music.setVolume(255)

music.setTempo(randint(60, 180))

pins.digitalWritePin(DigitalPin.P8, 1)

music.rest(music.beat(BeatFraction.Whole))

music.playTone(466, music.beat(BeatFraction.Half))

music.playTone(659, music.beat(BeatFraction.Half))

music.playTone(659, music.beat(BeatFraction.Whole))

music.playTone(659, music.beat(BeatFraction.Whole))

music.playTone(587, music.beat(BeatFraction.Whole))

music.playTone(659, music.beat(BeatFraction.Half))

music.playTone(659, music.beat(BeatFraction.Half))

music.playTone(466, music.beat(BeatFraction.Half))

music.playTone(466, music.beat(BeatFraction.Half))

music.playTone(554, music.beat(BeatFraction.Whole))

pins.digitalWritePin(DigitalPin.P8, 0)

pins.digitalWritePin(DigitalPin.P11, 1)

music.setTempo(120)

music.rest(music.beat(BeatFraction.Whole))

music.setTempo(60)

music.playTone(988, music.beat(BeatFraction.Whole))

control.raiseEvent(

EventBusSource.MES_BROADCAST_GENERAL_ID,

EventBusValue.MICROBIT_EVT_ANY

)

basic.showString("Go SS!")

pins.digitalWritePin(DigitalPin.P11, 0)

})