input.pinA1.onEvent(ButtonEvent.Click, function () {
animating = !(animating)
if(!(animating)){
control.reset()
}elseif(animating){
intro_1()
}
})
function intro () {
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Double))
music.playTone(370,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Whole))
}
function intro_2 () {
music.playTone(523,music.beat(BeatFraction.Double))
music.playTone(494,music.beat(BeatFraction.Double))
music.playTone(466,music.beat(BeatFraction.Double))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Double))
music.playTone(523,music.beat(BeatFraction.Whole))
music.rest(music.beat(BeatFraction.Sixteenth))
music.playTone(523,music.beat(BeatFraction.Double))
music.playTone(494,music.beat(BeatFraction.Whole))
music.rest(music.beat(BeatFraction.Sixteenth))
music.playTone(494,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
intro_3()
}
input.pinA2.onEvent(ButtonEvent.Click, function () {
control.reset()
})
function Quiet () {
control.reset()
music.stopAllSounds()
music.rest(music.beat(BeatFraction.Breve))
pause(100)
light.stopAllAnimations()
light.showAnimationFrame(light.rainbowAnimation)
strip2.stopAllAnimations()
strip2.showAnimationFrame(light.rainbowAnimation)
}
function intro_4 () {
music.playTone(494,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(523,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Double))
music.playTone(523,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(659,music.beat(BeatFraction.Double))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(698,music.beat(BeatFraction.Whole))
music.playTone(659,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(523,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Sixteenth))
music.playTone(523,music.beat(BeatFraction.Whole))
music.playTone(622,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(523,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Double))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Double))
music.playTone(698,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Breve))
}
function intro_1 () {
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Double))
music.playTone(370,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Whole))
intro_2()
}
function intro_3 () {
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(370,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Double))
intro_4()
}
let strip2: light.NeoPixelStrip = null
let animating = false
animating = false
strip2 = light.createStrip(pins.A7, 30)
light.stopAllAnimations()
light.showAnimationFrame(light.rainbowAnimation)
strip2.stopAllAnimations()
strip2.showAnimationFrame(light.rainbowAnimation)
forever(function () {
if(animating){
light.showAnimation(light.cometAnimation,100)
strip2.showAnimation(light.cometAnimation, 100)
}
})