
PicoBlocks - Reference
3
Use the keyword
bblock
when you want to make a block that outputs the result of a true/
false condition:
bblock dark?
output brightness < 10
end
dark?
Using Tags in the Text Language
PicoBlocks “tags” are used when you are plugging in more than one of the same kind of part,
two lights or two motors for example, and you want these parts to act differently. (See the
previous section on Tags on pages 10 and 11.) In programs written in the Text Language,
a word without a tag will address all parts of the same type. For example, if two lights are
plugged into your Cricket, the command
setlightcolor 90
will turn both lights blue.
If you want to refer only to the light plugged into the port, add a period to the end of the
word, without a space:
setlightcolor. 90
Similarly, to refer only to the light plugged into the port, add two periods to the end of
the word, without spaces:
setlightcolor.. 90
To refer only to the light plugged into the port, add a period and a colon to the end of the
word, without spaces:
setlightcolor.: 90
To refer only to the light plugged into the port just add two colons to the end of the
word, without spaces:
setlightcolor:: 90
This method of tagging text words will work with other words
2
. For example
display.: 57
will display the number 57 on a display plugged into the port and
forever [if touch?: [chirp]]
will cause the Cricket to chirp if a touch sensor that is plugged into the port is pressed.
Global Variables
In the “My Blocks” tab you will find blocks for storing numbers in two different “global
variables” called box1 and box2. In the Text Language you can use the keyword
global
: to
create up to five additional global variables. For example, by including the line:
global: times, pause
Note
: Tags will not work with words related to the sound box.
2