PiperCode: Launch Sequence
Three, Two, One...Launch!
PROGRAM LAUNCH SEQUENCE WITH PIPERCODE
Create an empty Pipercode project. If you haven’t completed all of the projects, you can unlock custom projects by going into the Pipercode Settings Menu and clicking “Unlock All Projects”.
Now that you have a blank project to work with, start by creating some functions to help control the boosters (LEDs) on the rocket. The functions will need to turn the boosters on, off, and test them by blinking them on and off once. You can use any open pins you want for the boosters, just make sure the pins are the same in the on and off functions.
Next, you’re going to create the launch sequence. You can have fun with this function, using any combination of sounds, shouts, and testing of the boosters you want. Just be sure that you remember to turn the boosters on at the very end! In our example launch sequence, we use “shout” to print a countdown from three on the screen, play a buzzer sound each second, and test the boosters a couple of times. At the end, we shout “BLASTOFF!” and play a warning sound before turning the boosters on.
The last part of making your mission control program is to set up the code to handle the arming switch and indicator LED. In a “repeat forever” block, check if the switch is on, turning the indicator LED on if so, and off if not. Then, if the switch is on and the launch button is pressed, run the “start_countdown” function.
Incredible job! With your newly created mission control, you now have the perfect way to usher your rocket onto its stellar voyage. Stayed tuned for the next #OutOfThisWorld project where your rocket and mission control will join forces for an epic display!