06 Mission Instructions

Your mission is to design a timer, with a loud alarm, and then send it wherever you need to keep track of time. 

6. Code: Timer

There are also a couple of pre-made variables in Bloxter. One of them is a timer. It can be found under the Time category. There are blocks to start the timer, use the current timer value, and reset the timer. We are going to use this instead of the "change ________ by ___" block. The timer will do the work for us. 


Now, we are going to create a new timer program. 

  1. Create a new variable. In the example below this variable is called "end". 
  2. Set the variable. When do you want the buzzer to make noise? Set your variable to that number. 
  3. Start the timer. 

Next, we want to create at least one "if-do" statement. What do you want the robot to do if the current timer value is above the value of the variable "end"? Wrap your if-do statements in a forever loop and you have created a timer using the buzzer! If you need some help, take a look at the examples below. 


By using a variable, if you want to change the amount of time the GoPiGo waits until the alarm sounds, you only need to change the number at the beginning where you tell the robot what to set the variable to. 

Now you have all the tools you need to write your program. You will update the variable to set the timer length, wait that long, and then display whatever behavior you planned back in the planning step. If you get stuck, you can check out our sample program below.