In this lesson we will be using the editor from Open Roberta. Be careful to ensure that the following image is visible at the top right of your programming environment. You can find the editor on our website. Just click on ‘Let’s Start’ and then ‘Editor’.
First steps: Inputs
So far all the programmed text, numbers and images have been displayed on the LED matrix immediately after being loaded onto the Calliope mini. However, if you would prefer to have an event take place after a specific input, you need to use the wait until block. By using this block, the Calliope mini will wait until your chosen condition is met before anything is displaying.
The Calliope mini has two input buttons: Button A (in red) and Button B (in blue). When one of the buttons is pressed, the circuit is completed.
By using the wait until block from Control along with the button A pressed? block from Sensors, you can display your output as soon as button A has been pressed.
The Calliope mini has five rounded corners: -, +, 0 , 1, 2, and 3. If you place one finger on the – corner and another finger on one of the numbered corners, a small electrical current will flow through your body and back to the Calliope mini, thus closing the electrical circuit.
Use the wait until block from control. Your text will be displayed when pin – and pin 0 are both pressed at the same time. You can find the is pin 0 touched? block in the Sensors menu.
The Calliope mini’s in-built position sensor allows it to know which side is face down, whether it is being shaken or even in free-fall.
Use the wait until block from control. Your text will be displayed when you shake the Calliope mini. The gesture upright active? block can be found in Sensors. Use the dropdown menu to choose the condition.
You can program the Calliope mini to respond to more than one input. There are two possible ways of doing this:
a) Linear processing of inputs
This way of programming requires you to decide on the sequence the inputs must follow in order to allow your program to run in a linear fashion.
If you use a number of Wait until blocks in a row, the Calliope mini will wait until each block’s condition has been met before moving on to the next.
b) Non-linear processing of inputs
Use the wait until …or wait for block to test for more than one input at the same time.
To do this, press on the + in the wait until block to expand the block’s options. Depending on which of the conditions is met, the corresponding program section will be run.