Mitchel Resnick
Brian Silverman
Paula Bontá
Robbie Berg
Natalie Rusk
Industrial Design: Smart Design
Graphic Design: Big Blue Dot
We would like to give special thanks to:
PICO staff members Chad Burt and Mike Durcak for their invaluable ideas and enthusiasm.
Diana Gee Silverman for the on-line help, Danny Lutz for the sounds, and Lawrence
Shubert for guiding PICO through the intricate aspects of compliance testing and
manufacturability.
staff from the Playful Invention and Exploration (PIE) project for developing new Cricket
activities, particularly Keith Braafladt, Stephanie Hunt, Chip Lindsey, Hideki Mori, Kristen
Murray, Mike Petrich, Margaret Pezalla-Granlund, Natalie Rusk, Michael Smith-Welch, Karen
Wilkinson, and Diane Willow.
MIT researchers and students who contributed to Cricket R&D, particularly Andy Begel,
Robbie Berg, Rahul Bhargava, Rick Borovoy, Fred Martin, Bakhtiar Mikhak, Mitchel Resnick,
and Brian Silverman.
the LEGO Company for its continuing support, particularly Kjeld Kirk Kristiansen, Lisbeth
Valther Pallesen, Jens Maibom, and Erik Hansen.
Welcome! This Reference Guide provides an overview of the PicoCricket family of parts and
the PicoBlocks software used to program the PicoCricket.
If you are just getting started with the PicoCricket and PicoBlocks, please go through the
Setup Guide and Getting Started booklet first, to get an overall introduction. If you want more
detailed information, then come back to this Reference Guide.
We are continually updating the Reference Guide. You can download the latest version from
www.picocricket.com/support
PicoCricket Family
The PicoCricket family includes the following parts:
PicoCricket
The PicoCricket is a tiny computer that can control things in the world. The Cricket has four
ports where you can plug in other devices, such as sensors, motors, and lights. You can plug
any of these devices into any of the Crickets ports.
4
PicoBlocks - Reference
The Cricket has three types of indicator lights:
The on-off indicator light turns on (orange) when you turn on the Cricket. If the
batteries are low, the light flashes rapidly when you turn on the Cricket.
The program-running indicator light turns on (green) when the Cricket is running a
program, and it changes color to amber when the Cricket is running two programs at
the same time.
The IR-communication indicator lights flash (yellow) when the Cricket is
communicating through its infrared transmitter.
If you push the Cricket button while the Cricket is running a program, the program will stop. If
you push the button when no program is running, the Cricket will re-run the last program that
it ran.
Even when you turn the Cricket off, it remembers the last program that it ran. So if you run a
program, turn off the Cricket, turn it back on later, and push the button, the Cricket will run the
program again.
Beamer
The Beamer transmits information (via infrared signals) from your computer to your Cricket.
When you write a program using PicoBlocks software on your computer, you send the
program to the Cricket via the Beamer.
PicoBlocks - Reference
5
The PicoCricket Kit includes a USB-serial cable for connecting the Beamer to a USB port on
your computer. Alternatively, you can connect the Beamer to a serial port, using a standard
serial cable (not included).
When you are sending information to the Cricket, make sure that the antennas on the
Beamer are facing towards the antennas on the Cricket. While the Beamer and Cricket are
communicating, the indicator lights in the antennas will flash yellow (on both the Beamer and
the Cricket).
The Beamer has a range of about a 1 meter. Note that a Beamer can communicate with one
Cricket at a time. If you have multiple Crickets, make sure that only one of them is in range of
the Beamer at any time.
Actuators
Actuators are devices that make things happen in the world. The PicoCricket Kit includes four
types of actuators: colored lights, sound box, motor (with motor board), and numeric display.
NameDescriptionProgramming BlocksIcon
LightYou can set the color of the light across
the entire rainbow, from red to violet. You
can also set the brightness of the light.
Sound
Box
Motor
and
Motor
Board
Display
The sound box is a small synthesizer that
can play notes, melodies, sound effects,
and rhythms. PicoBlocks software includes
special editors for creating melodies and
rhythms. You can set and change which
instrument will play notes and melodies.
The motor board connects to the Cricket,
and the LEGO motor connects to the
motor board. You can turn the motor on
and off, and set its power and direction.
The three-digit display can show any
number between 0 and 999. It is especially
useful for displaying sensor values.
note
6
PicoBlocks - Reference
Sensors
Sensors allow your Cricket to respond to sounds, lights, or other changes in its environment.
NameDescriptionProgramming
Blocks
Light
Sensor
Reports the brightness of light. For example, you can
use the light sensor to detect when someone casts
brightness
a shadow with their hand – or when the sun shines
through the window.
Sound
Sensor
Reports the loudness (or volume) of sound. For
example, you can use the sound sensor to detect
when someone claps their hands – or when someone
loud?
loudness
sings into the sensor.
Touch
Sensor
Reports if the button is pressed. For example, you
can write a program that makes something happen
touch?
(a motor spinning or a light changing color) when
someone presses the touch sensor.
Resistance
Sensor
Reports the resistance in the circuit formed by the
alligator-clip cables. If you put different materials
connected?
(for example, play-dough or a banana) between the
alligator clips, the resistance will change. You can also
resistance
use the resistance sensor to detect when the alligator
clips are touching each other (or connected through a
conductive material, such as aluminum foil).
Icon
Each of the programming blocks will be described further in the following pages. For
examples of how to use the actuators and sensors, see “Magic Lantern” and other sample
project placemats.
Cricket Care
1. Remember to turn off the Cricket when you aren’t using it.
2. If the orange on-off indicator light flashes, it means that your Cricket is running out of
batteries. To change the batteries, follow the instructions in the Setup Guide.
3. Be gentle with the cable connectors. If you push the connectors up and down with too
much force, the connectors will break.
4. Keep your Cricket devices away from water and other liquids.
5. If your Cricket is misbehaving, check the Troubleshooting section in our website:
www.picocricket.com/troubleshooting
PicoBlocks - Reference
7
PicoBlocks
Overview
PicoBlocks is a programming language designed specifically for programming your Cricket.
With PicoBlocks, you create programs by snapping graphical blocks together into stacks.
These are the tools
Click on the tabs
to get different
categories of
blocks
This is a stack
This is your Workspace
Drag and drop blocks to
create your stacks
Blocks Palette
Tools
?
?
The tools are used for taking different actions on the blocks, such as copying blocks, deleting
blocks, or sending blocks to the Cricket. When you click on a tool, the cursor turns into that
tool.
Arrow
Use the Arrow to drag blocks from the Blocks Palette to the Workspace, or within the
Workspace. To move an entire stack, drag from the top block. Dragging a block from the
middle of a stack will also move any blocks attached beneath the one you are dragging.
2
Undo
STOP
You can get rid of blocks by dragging them off of the Workspace, in any direction. If you delete
blocks by mistake, click Undo
8
PicoBlocks - Reference
Magic Wand
Use the Magic Wand to run a program. When you click on a block or stack with the Magic
Wand, it sends the program to the Cricket and tells the Cricket to run the program.
forever
chirp
setlight
color
brightness
You can use the Magic Wand to click on blocks in the Blocks Palette, the same way you click on
blocks in the Workspace. This feature is useful for testing out a block.
Another way to run a program is by double-clicking with the Arrow, instead of single-clicking
with the Magic Wand.
Scissors
Use the Scissors to get rid of blocks. Clicking on a block in a stack will also cut all blocks
attached below it.
If you delete blocks by mistake, click Undo
You can also get rid of blocks by dragging them out of the Workspace.
motor
on
waituntil
reverse
touch?
motor
on
waituntil
touch?
motor
onfor
10
Stamper
Use the Stamper to copy blocks and stacks. Click once to copy, then move to a new location
and click a second time to paste. When you click on a block in a stack with the Stamper, it also
copies all blocks attached below it.
You can switch to the Stamper temporarily using Ctrl +
motor
on
waituntil
reverse
reverse
motor
onfor
motor
onfor
touch?
10
10
, or +
PicoBlocks - Reference
9
Help
?
?
Use the Help tool to get more information. If you click on a block with the Help tool, a window
with more information will appear.
setlight
color
wait
setlight
color
?
?
wait
10
10
2
Second Wand
Use the Second Wand to tell the Cricket to run a second stack at the same time as it is running
something else. To run two stacks, click on one with the Magic Wand, then the other with the
Second Wand.
For example, you can use the Second Wand to start background music or display sensor
values while another program is running.
melody1
2
forever
2
display
brightness
Tags
Use the Tags tool when you want to tell two devices of the same type to do different things.
For example, if you plug two colored lights into a Cricket, and then send a setlight-color
command to the Cricket, the Cricket will change the color of both lights. If you want to turn
each light to a different color, you need to use Tags.
10
PicoBlocks - Reference
Each of the four ports on the Cricket is labelled with a different number of dots. If you want to
send a command to a particular port, then you need to “tag” the block with the appropriate
number of dots. For example, if you plug colored lights into ports and , then you can set
the color of each light individually with the following blocks:
setlight
color
setlight
color
To tag a block, click on the appropriate dot in the Tags tool, then click on the block that you
want to tag.
setlight
color
To remove a tag from a block, click in the center of the Tags tool and then click on the block.
setlight
color
STOP
Stop
Click on the Stop sign to stop all programs running on the Cricket. Make sure that the Cricket
is “in sight” of the Beamer. Alternatively, you can stop programs on the Cricket by pressing the
white button on the Cricket. Note that stopping programs on the Cricket does not turn off
lights attached to the Cricket. If you want to turn off the lights, slide the on-off switch into the
off position.
PicoBlocks - Reference
11
Blocks Summary
This list shows all of the basic blocks in PicoBlocks.
setlight
color
setlight
power
light
turns the light off
off
display
chirp
note
play
sound
set
inst
the next note or melody
set
for the next note, melody
tempo
displays a value on the display
makes the Cricket chirp
plays a note (pitch and duration)
Kitten
Piano
set
volume
sets the light’s color
sets the light’s power
plays a sound
sets an instrument for
sets the tempo or volume
or rhythm
connected?
reports true if the resistance sensor
detects a resistance of 0
resistance
reports a value from the
resistance sensor
beamIR
infrared from another Cricket
newIR?
beamed a new value by infrared
beams a value to another Cricket
reports a value beamed by
IR
reports true if another Cricket has
timer
reports the Cricket’s timer value
in 100ths of a second
reset
timer
sets the Cricket’s timer to 0
waits a number of ticks (where 10
wait
ticks = 1 second)
waituntil
waits until the condition is true
motor
on
motor
onfor
period of time
reverse
this
way
set
power
touch?
pressed
brightness
sensor
motor
turns motor on or off
off
turns the motor on for a certain
reverses the motor’s direction
that
sets the motor’s direction
way
sets the motor’s power
reports true if the touch sensor is
reports a value from the light
reports true if the sound sensor
loud?
detects a loud sound
loudness
reports a value from the sound
sensor
forever
forever
repeat
repeats a block or stack
a certain number of times
repeats a block or stack
if
condition is true
if
runs a block or stack if the
then
if condition
is true, run one
stack; if not, run
thenelse
the other stack
stopall
stops everything
stop
stops this stack
stack
12
PicoBlocks - Reference
Blocks Summary - Continued
creates space between blocks,
so that they don’t overlap one another
number
+
and
or
not
specifies a number (click to highlight, and then type in a number)
x
-
r a n d o m
/
computes arithmetic operations
picks a random value between the two numbers
>
<
makes a comparison between two numbers
and reports true or false
=
reports true if both conditions are true
reports true if either condition is true
reports the opposite of a condition
sits on top of stack, and allows you to type in name for the stack
store in
box1
store in
box2
box1
set and report values for variables
box2
PicoBlocks - Reference
13
Blocks - Detailed by Category
Light Blocks
setlight
color
which color
waits for 4 ticks
turns the light pink (color
setlight
color
wait
setlight
color
turns the light blue
4
5
5)
Sets the LED’s color and turns it on. You can set the color by using the color slider, or choosing
a number between 0 and 100. Colors are numbered as follows:
pink red yellow aqua light blue violet
0 20 40 60 80 100
10 30 50 70 90
magenta orange green cyan blue
Default value:
setlightcolor 0
setlight
power
how bright
waits for 40 ticks
sets light back to full power
setlight
power
wait
setlight
power
40
100
sets light to half power and turns it on
setlightpower can take numbers between 0 (no light) and 100 (full power). You can set the
power by using the slider or a number block.
Default value: setlightpower 100
light
off
setlight
turns the light green
color
waits for 15 ticks
turns the light off
wait
light
off
15
lightoff turns the light off.
14
PicoBlocks - Reference
display
display what
r a n d o m
display
15
95
displays a random number
Displays a value on the display
Sound Blocks
The Sound palette starts with six basic blocks (shown below). You can create additional blocks
with the Melody and Rhythm editors. See page 3
rhythms.
0 for information on creating melodies and
chirp
makes the Cricket chirp once
Making the Cricket chirp is a good way to test whether your computer is communicating
properly with the Cricket.
how high a note
note
note
for 5 ticks (half a second)
50
5
plays the note 50
how longnote can play notes between 0 (lowest) and 100 (highest).
You can play notes with the Cricket speaker or with the Sound Box (but it will sound much
better with the Sound Box). For composing melodies, we suggest using the Melody Editor
rather than putting individual note blocks together.
Default value: note 50 2
play
sound
plays this sound (kitten)
play
sound
play
sound
Select a sound with the slider or enter a number between 0 and 100. There are 24 sounds
available (see table below).
All these sounds require the Sound Box. Sound 0 is the Cricket chirp. For numbers greater
than 24, playsound plays the next sound in the list: 25 plays sound 1, 26 plays sound 2, ... and
so on.
Default value:
playsound 24 (kittten)
set
inst
plays note 16 (on the trombone)
for 5 ticks (half a second)
setinstrumentwhich instrument
set
inst
Trombone
16
sets instrument to trombone
note
5
Sets the instrument to be used for subsequent notes or melodies. You can select the
instrument with the slider or attach a number between 0 and 100. setinstrument 0 sets the
note or melody with the Cricket’s beeper.
The inputs for setinstrument are the same as for playsound (shown in table above). You can
use any sound as an instrument, but they don’t all work well.
Default value: setinstrument 1 (piano)
set
tempo
set
tempo
plays melody1 at the fastest tempo
melody1
settempo takes values between 0 (slowest) and 100 (fastest). The fastest tempo (100) equals
to 240 bpm (beats per minute), while the slowest (0) equals to 60 bpm.
Default value: settempo 50 (120bpm)
100
sets tempo to 100 (fastest)
16
PicoBlocks - Reference
set
volume
set
volume
30
sets the volume to 30 (quiet)
plays note 50
for 5 ticks (half a second)
note
50
5
setvolume takes values between 0 (no sound) and 100 (loudest). Setvolume only works
with the Sound Box. Default value:
setvolume 80
Action Blocks
motor
on
waits for 20 ticks (2 seconds)
turns the motor off
motoroff makes the motor coast to a stop. If you want the motor to stop more abruptly or
more gently, try using the brake and coast commands in the PicoBlocks Text Language.
motor
off
motor
on
wait
motor
off
20
turns the motor on
motor
onfor
how long
motor
onfor
20
turns on motor for 20 ticks (2 seconds)
10 ticks = 1 second
Turns the motor on for the specified number of ticks, then turns it off. motoronfor does the
same thing as a stack with motoron, then wait, then motoroff.
Default value: motoronfor 10
reverse
changes direction
goes the other way for 40 ticks
motor
onfor
reverse
motor
onfor
20
40
motor goes one way for 20 ticks
reverse causes the motor to change the direction in which it is spinning. reverse does not
turn the motor on, it only changes the direction.
PicoBlocks - Reference
17
this
way
that
way
this
way
sets motor to one direction
turns on for 10 ticks
sets motor to the opposite direction
turns on again for 10 ticks
motor
onfor
that
way
motor
onfor
10
10
thisway sets the motor in one direction, thatway sets it in the other direction. Which direction
is which depends on how the motor is plugged in. thisway and thatway do not turn on the
motor, they only set the direction.
set
power
turns the motor on
set
power
motor
on
10
sets motor power to 10
setpower takes values between 0 (no power) and 100 (strongest power). setpower does not
turn on the motor, it only sets the power.
Default value: setpower 100
Sensors Blocks
touch?
is the touch sensor
forever
if
touch?
then
chirps if the touch sensor
is pressed
chirp
touch? reports true when the touch sensor is being pressed. The example above will make
the Cricket chirp continuously while you are pressing the button on the touch sensor. If you
want to chirp only once each time you push the button, you should make a stack similar to
the one shown below:
being pressed?
18
PicoBlocks - Reference
forever
waituntil
chirp
touch?
sensor
brightness
display
waituntil
brightness
not
touch?
displays the number reported by the
waits until the touch
is released
light sensor
brightness reports numbers between 0 (no light) and 100 (lots of light)
loud?
waituntil
loud?
waits until the sound sensor
detects a sound
turns the light pink
setlight
color
loud? reports true if the sound sensor detects a sound with loudness greater than 15.
loudness
sensor detects a clap
turns the light green
waituntil
setlight
loudness
>
30
waits until the sound
color
loudness reports numbers between 0 (no sound) and 100 (loud sound).
connected?
to detect a connection
forever
waituntil
connected?
waits for resistance sensor
chirp
when a connection is sensed, it chirps
connected? reports true if the resistance sensor detects a resistance of less than 50.
PicoBlocks - Reference
19
resistance
forever
display
resistance
displays the number reported
by the resistance sensor
resistance reports numbers between 0 (no resistance) and 100 (lots of resistance). If you are
getting numbers in a very narrow range, you should adjust the sliders as follows:
resistance
resistance
try this if you aren’t getting low numbers
try this if you aren’t getting high numbers
Remember to use the magic wand after moving the sliders
beamIR
forever
beamIR
0
r a n d o m
100
beams a number between
0 and 100
wait
10
beamIR beams a number to another Cricket via infrared (IR). To use this command, you need
two Crickets: one beaming the IR signal, the other receiving the IR signal. See example for
IR block below. We recommend using numbers in the range 0 to 100. Numbers outside this
range may produce unexpected results.
newIR?
IR
forever
waituntil
newIR?
waits for a new IR message from
another Cricket
IR
plays a note based on the
number received
note
10
IR stands for Infra Red.
newIR? reports true if a new infrared (IR) signal has been received. IR reports the value of the
latest infrared signal received.
20
PicoBlocks - Reference
reset
timer
timer
reset
timer
is greater than 500
turns on motor
waituntil
motor
on
sets timer to 0
timer
>
waits until the timer
500
100 ticks of the timer equals 1 second
Flow Blocks
wait
waits for 20 ticks (2 seconds)
turns the light off
setlight
color
wait
light
off
turns the light pink
20
10 ticks equals 1 second
Default value: wait 10
waituntil
waits until the touch sensor is pressed
turns off motor
Waits until
the condition is true.
motor
on
waituntil
motor
off
turns on motor
touch?
PicoBlocks - Reference
21
forever
forever
To stop the forever, push the button on your Cricket or click on
motor
onfor
wait
3
repeat this forever
3
STOP
repeat
how many times
repeat
10
place here
whatever you want
to do after the
repeat finishes
motor
onfor
reverse
4
repeat this 10 times
if
if this is true...
then
forever
if
connected?
then
this will happen
chirp
place here whatever you want
to do after the if finishes
If the condition reports true, then the Cricket will run the blocks below the word “then.”
22
PicoBlocks - Reference
if
is this true?
thenelse
forever
if
touch?
thenelse
motor
on
motor
off
otherwise do this
if true, do this
If the condition reports true, then run the blocks under the word “then”; if not, run the blocks
under “else”.
stopall
motor
on
if this is true...
forever
if
everything stops (including
the motor)
chirp
touch?
then
stopall
Stops all programs and motors (but leaves lights on). stopall is equivalent to pressing the
button on the Cricket.
stop
stack
forever
this stack stops
stopstack stops only the current stack. You can use this block to stop one stack while
continuing another stack.
if
chirp
touch?
then
stop
stack
if this is true...
PicoBlocks - Reference
23
For example:
colors
forever
if
touch?
colors will stop when the touch
sensor is pressed, yet the other
stack will continue. The light
will be turned off and melody1
will be played.
setlight
color
then
stop
stack
brightness
Vertical Spacer
Without Spacers With Spacers
colors
light
off
melody1
repeat
motor
onfor
10
motor
onfor
4
reverse
repeat
4
motor
onfor
10
motor
onfor
reverse
4
4
Use spacers to keep the blocks from overlapping. (Adding spacers does not change the way
the program runs.)
Horizontal Spacer
Without Spacers With Spacers
repeat
motor
onfor
10
motor
onfor
4
reverse
repeat
4
motor
onfor
10
motor
onfor
4
reverse
4
Use spacers to keep the blocks from overlapping. (Adding spacers does not change the way
the program runs.)
24
PicoBlocks - Reference
Numbers Blocks
number
turns on motor for 20 ticks (2 seconds)
Click on
Default Value: 10
Numbers in PicoBlocks are limited to integers between -32768 and +32767.
adds two values this plus that
+
turns on motor for 10 plus the value of the brightness sensor (for example, if the brightness
sensor is 30, motor turns on for 40 ticks).
subtracts two values this minus that
-
turns on light with a power of 100 minus the value of the brightness sensor (for example, if
the brightness sensor is 60, light power will be 40).
to type in a number. accepts negative numbers.
set
power
motor
onfor
motor
onfor
setlight
power
50
20
10
100
sets motor power to 50 (half power)
+
-
brightness
brightness
multiplies two values this multiplied by that
x
r a n d o m
setlight
color
Sets the light’s color to a random number multiplied by 10 (for example, if the random
number is 7, sets the color to 70 which is cyan).
divides the first value by the second value
/
this divided by that
turns on motor for the value of brightness sensor divided by 10 (for example, if the brightness
sensor is 50, motor turns on for 5).
0
10
motor
onfor
x
brightness
10
/
10
PicoBlocks - Reference
25
r a n d o m
reports a random number
between this and that
10
r a n d o m
turns on motor for a random number of
50
motor
ticks (in this case it could be 10, or 50, or
onfor
anything in between...)
Default value: random 0 100
>
if this is greater than that...
forever
if
this will happen
number1 > number2 reports true if number1 is greater than number2.
brightness
then
chirp
>
50
<
if this is less than that...
forever
if
this will happen
number1 < number2 reports true if number1 is less than number2.
brightness
then
chirp
<
60
=
if this is equals that...
forever
if
this will happen
number1 = number2 reports true if the two numbers are equal.
brightness
then
chirp
=
50
26
PicoBlocks - Reference
and
waits until this and that are both true...
waituntil
touch?
then, this will happen
chirp
and
loud?
and reports true if the result of the first condition (touch?) and the second condition (loud?)
are both true.
or
if this or that is true...
forever
if
this will happen
touch?
then
chirp
or
loud?
or reports true if the result of the first condition (touch?) or the second
condition (loud?) is true.
not
waituntil
motor
on
is not pressed
waituntil
motor
off
touch?
not
touch?
waits until the touch sensor
not reports true if the condition is false. not reports false if the condition is true.
PicoBlocks - Reference
27
My Blocks
You can use this block to give a name to a stack of blocks – and create a new
block that does the same thing as the entire stack. Here’s how:
1. attach the block at the top of the stack you want to name
chirp
chirp
2. click and type a name 3. a new block with that name appears in
4. Use it in other stacks
4
2chirps
chirps 8 times
box2
Use these blocks for setting and
store in
box1
box1
repeat
store in
box2
retrieving the values of variables.
store in
Use
box1
random number
to store a value, and use
store in
box1
setlight
turns a light that random color
waits for 5 ticks
color
wait
setlight
turns a second light the same color
color
box1
5
box1
30
r a n d o m
box1
to retrieve it.
49
box1 stores a
28
PicoBlocks - Reference
To change the name of a variable, drag it into the workspace, click on it, and type in the new
name.
store in
box1
setlight
color
10
box1
store in
my-color
setlight
color
my-color
rename the block
When box1 is renamed in the workspace, the
blocks in the palette are automatically updated.
10
PicoBlocks - Reference
29
Melody and Rhythm Editors
PicoBlocks has two editors for creating music: a Melody Editor and a Rhythm Editor.
To create a new melody or rhythm (or to edit an existing one), first click on the Sound tab. At
the bottom of Sound palette are two buttons, one for opening the Melody Editor, the other for
opening the Rhythm Editor.
After you create a new melody or rhythm, it will appear as a new block in the Sound palette.
You can drag these music blocks into the workspace, and connect them to stacks, just as you
would with any other block in PicoBlocks.
These blocks were created using the
Melody Editor and Rhythm Editor.
Opens the
Melody Editor
Opens the
Rhythm Editor
30
PicoBlocks - Reference
Melody Editor
Click on to open the Melody Editor.
If this is your first melody, you will see a blank Melody Workspace for creating your melody.
If you have previously created melodies, you will see one of your existing melodies in the
Melody Workspace. You can edit this melody – or select one of your other existing melodies
to edit (by clicking on a block in the palette on the left side) – or create a new melody (by
clicking on the “Create” button at the top-left).
To add notes to your melody, either click on the keyboard, or click directly in the Melody
Workspace.
When you are finished creating your melody, click
and exit the Melody Editor.
Click here to create
a new melody
Middle C
You can import and export melody
files with extension .pbm
To create a new note, click
on the keyboard or directly
in the Melody Workspace
click here to insert a rest
Melody Workspace
OK
to turn your melody into a block
Change instrument,
volume, or tempo
Insertion point: the next note
pressed on the keyboard will
start here
Drag this end to change
length of note
Drag here to make the
Melody Workspace
bigger or smaller
Select the duration
Click here to save the melody as a
block and exit the Melody Editor
Play or stop
PicoBlocks - Reference
31
twinkle
twinkle
All of your melodies appear at the left of the
Melody Editor. Click on the melody that you
want to edit.
To change the name of a melody, click on the
block and type a new name.
Use
to make a copy of a melody. Use
to delete melodies.
Drag on the background to select
notes. Move the selected notes by
dragging them to other location.
You can also copy
and play
the selection.
, cut
You can also play the selection by
double clicking on it.
32
PicoBlocks - Reference
Rhythm editor
Click on to open the Rhythm Editor.
If this is your first rhythm, you will see a blank Rhythm Workspace for creating your rhythm. If
you have previously created rhythms, you will see one of your existing rhythms in the Rhythm
Workspace. You can edit this rhythm – or select one of your other existing rhythms to edit (by
clicking on a block in the palette on the left side) – or create a new rhythm (by clicking on the
“New Rhythm” button at the top-left).
When you are finished creating your rhythm, click
and exit the Rhythm Editor.
Click here to create
a new rhythm
You can import and export rhythm
files with extension .pbr
Click or drag here
to create a note
OK
to turn your rhythm into a block
Change volume, or tempo
Drag here to make the
Rhythm Workspace
bigger or smaller
Click here to save the rhythm as a
block and exit the Rhythm Editor
PicoBlocks - Reference
Loop, play or stop
33
All of your rhythms appear at the left of the
Rhythm Editor. Click on the rhythm that you
want to edit.
To change the name of a rhythm, click on the
block and type a new name.
Use to make a copy of a rhythm. Use
to delete rhythms.
34
PicoBlocks - Reference
The PicoBlocks Text Language
Overview
PicoBlocks lets you construct computer programs by snapping different blocks together, like
pieces of a puzzle. This approach makes it easy to get started; different kinds of blocks have
different shapes and can only snap together in certain ways. The shapes of the pieces provide
a lot of guidance as to how structure your programs, helping you build programs that work
the way you want them to work. But if you try to write longer programs you may find that
using the blocks can get cumbersome. For example, all of your stacks may no longer fit a the
screen at the same time. Also, there are some advanced
programming features that are not available using the
blocks. As your programs become longer and more
complex, you may want to consider using the Text
Language that is available from within the PicoBlocks
software. The PicoBlocks Text Language is similar to the
computer language Logo. (For more information on
Logo see www. logofoundation.org.) To begin writing
programs in the Text Language, click on the text icon
located in the lower left hand corner of the PicoBlocks
Workspace. The Text Language Workspace, shown in the
figure below, will appear.
Click on the text icon
to switch to the text
language Workspaces
Click here to switch back
and forth between the
Text and the Blocks
Workspaces
Procedure Area
Define new words here
Command Center
Type commands here and
then press Enter
PicoBlocks - Reference
35
Try typing the following commands in the Command Center. (Press the Enter key to run each line.)
chirp The Cricket chirps!chirp wait 2 chirp The Cricket chirps twice.
Note that spaces are very important in the Text Language; they are used to determine where words
start and end. For example, if you leave out the space between wait and 2 in the last example you
will get an error message that says “I don’t know how to wait2”. This is because PicoBlocks does not
understand the word wait2.
Each block in PicoBlocks has an associated word in the text language. The general rule for finding the
1
name of the word in the text language that is associated with a particular block is a very simple one
:
Just copy what’s written on the block, leaving out a space if there is one.
For example, plug a light into your Cricket and type the following in the Command Center:
setlightcolor 20 The light turns red
Note that there are no spaces in the word setlightcolor.
Now try typing the following line in the Command Center:
repeat 5 [chirp wait 2]
In the Text Language square brackets are used to enclose the list of words that are to be repeated. You
can get guidance about how the text word corresponding to a particular block is meant to be used
by clicking on that block, which you can find on the left hand side of the Text Language Workspace.
For example if you click on the “repeat” block the following text will appear in the Command Center:
repeat 10 [ WHATEVER ]
In this message “WHATEVER” is meant as a place holder for the list of commands that you want
repeated.
Other Examples
Plug in a touch sensor and a sound box and type:
waituntil [touch?] playsound 23
You should here a “meow” when you press the touch sensor on the touch sensor.
If you type: forever [waituntil [touch?] playsound 23]
you should now hear the “meow” each time you press the touch sensor. In these last two examples
you will need to make sure you type the square brackets in the proper places.
Plug in a display and type: display 7 * 9 + 6
The Text language uses parentheses to determine the order of in which things are done. Compare the
above result to what you get if you type:
display 7 * (9 + 6)
1
Exceptions to this rule occur for the cases of the if and ifelse words; since the text word does
not include “then”. For a complete list of the blocks and corresponding text words, see the Summary
of Text Language Words chart at the end of this section.
36
PicoBlocks - Reference
Procedures
You can “teach” your Cricket to understand new words by defining procedures in the Procedures
Area of the Text Language Workspace. Procedures are defined using the following general form:
to procedure-name
procedure-body
end
The procedure definition starts with the keyword to, followed by the name of the procedure.
Next comes the body of the procedure, which is a list of words that describe what the procedure
is to do. The keyword end is used to complete the procedure definition.
For example, in the Procedure Area type:
to chirp-twice
chirp wait 5 chirp
end
You’ve now taught your Cricket a new word; if you type the word chirp–twice in the
Command Center, the Cricket will chirp twice.
Procedures with Inputs and Outputs
You can create procedures that take inputs or produce an output. For example, you can create a
procedure named chirps that takes an input that is used as the counter in a repeat loop. Note
that the name of the input must begin with a colon.:
to chirps :num
repeat :num [chirp wait 5]
end
Typing
chirps 10
in the Command Center will cause the Cricket to chirp 10 times.
You can create a procedure that takes two inputs that will determine both the number of chirps
and the duration of the pause between chirps:
to chirps2 :num :pause
repeat :num [chirp wait :pause]
end
Typing
chirps2 10 3
in the Command Center will cause the Cricket to chirp 10 times, with a pause of 3 tenths of a
second between chirps.
Procedures may return values using the output command. For example, you can define a
procedure called half by:
to half
output brightness / 2
end
PicoBlocks - Reference
37
Then, with a display and a light sensor plugged in, try typing in the Command Center:
display half
Or, you can define a procedure called dark? that returns a true of false result:
to dark?
output (brightness < 20)
end
Now if try typing in the Command Center:
forever [if dark? [chirp]]
your Cricket should chirp when it is dark enough.
Make Your Own Blocks
You can use the Text Language to make different kinds of blocks, which you can then use to
build programs in the PicoBlocks Workspace. This feature allows you to continue doing much
of your programming using the Blocks Language, with the Text Language being used as a
supplement when its advanced features are needed.
New blocks are defined by typing in the Procedures Area. The block definitions begin with the
keyword
block chirp1
chirp wait 3 chirp
end
block. For example:
chirp1
Makes a block that chirps twice.
Blocks that you have defined will automatically be created and placed in the “My Blocks” area.
You can create blocks with up to three inputs. For example, to create a block with one input:
block chirp2 :num
repeat :num [chirp wait 3]
end
chirp2
Makes a block that chirps a number of times.
To create a block with two inputs:
block chirp3 :num :pause
repeat :num [chirp wait :pause]
end
chirp3
Makes a block that chirps a number of times,
with the ability to vary the length of the pause
between chirps.
When you define a block that outputs a number, PicoBlocks will automatically create a
number–shaped reporter block:
block bright2
output 2 * brightness
end
Reports a number twice as big as the brightness
bright2
measured by the light sensor.
38
PicoBlocks - Reference
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 words2 . 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
2
Note: Tags will not work with words related to the sound box.
PicoBlocks - Reference
39
in the Procedures Area you will create two new global variables called times and pause. Now,
try typing the following in the command center:
storeintimes 5 storeinpause 3
repeat times [chirp wait pause]
The Cricket should chirp 5 times, with pauses of 3 tenths of a second between chirps.
If you click on the My Blocks tab you will also find that new blocks corresponding to the new
variables times and pause have been created.
Local Variables
The word make allows you to change the value of an input to a procedure. For example, if you
define a procedure called rainbow by:
to rainbow :a
repeat 30 [setlightcolor :a make “a :a + 1 wait 2]
end
then, with a light plugged into your Cricket, typing
rainbow 20
in the Command Center will cause colors 20 through 49 to flash.
Variables of this kind are called “local variables” because they are only available for use
by the procedure in which they are defined. Because PicoBlocks has a very limited
number of global variables (7), local variables can be helpful because they do not use any
of the global variable slots.
Tool Not Available in the Text Language
The “second wand” is not available in the Text Language.
Summary of Text Language Words
The following table shows the text word that corresponds to each PicoBlocks block and gives
an example of how the word can be used.
Light
BlockWordExample Usage
setlight
color
setlight
power
light
off
setlightcolor
setlightpower
lightofflightoff
number
number
Setlightcolor takes an input from 0 to 100.
setlightcolor 70
The light changes to cyan and turns on.
Setlightpower takes an input from 0 to
100.
setlightpower 50
The light turns on at half power.
The light turns off.
40
PicoBlocks - Reference
Light
BlockWordExample Usage
display
display
number
Displays a value on the digit display:
display 709
The display shows the number 709.
Sets the color of the light. Setrgb takes 3 inputs (red,
Text
only
setrgb
number
number number
green, and blue), each with a range from 0 to 100. The
three inputs mix to give one particular light color.
setrgb 0 100 100 The light turns cyan.
Sound
BlockWordExample Usage
chirp
note
play
sound
set
inst
set
tempo
set
volume
In addition to the blocks above can add your own blocks to the Sound tab by creating melodies and/or
rhythms in their respective editors. The melody or rhythm name becomes a text word that you can use.
chirpchirp wait 3 chirp
The Cricket chirps twice.
Note takes two inputs. The first input (a number
between 0 and 100) determines the pitch of the note
note
number number
and the second input determines the duration of the
note (in tenths of a second).
note 36 5
The sound box plays a note for half a second.
Plays a sound on the sound board. Playsound takes
playsound
number
any number between 0 and 100. There are 24 built-in
sounds. Playsound repeats the list in sequence for
numbers greater than 24.
playsound 24 The sound box meows.
Sets the instrument for the next note, or melody to be
setinstrument
number
played on the sound board. Setinstrument takes any
number between 0 and 100:
setinstrument 4 note 36 5
The sound box plays violin note.
Sets the tempo at which the next rhythm or melody
will be played on the sound board. Settempo takes any
settempo
number
number between 0 -lowest pace- and 100 -fastest pace.
settempo 50 melody1
The sound box plays a melody at the standard tempo.
setvolume
number
Sets the volume at which the next note, sound,
rhythm or melody will be played on the sound board.
Setvolume takes any number
between 0 -lowest volume- and 100 -highest volume:
The motor spins for 1 second.
Turns the motor on for a set period of time (in
tenths of a second).
motoronfor 10
The motor spins for 1 second.
Change the direction in which the motor spins.
repeat 6 [motoronfor 3 reverse]
The motor wiggles back and forth.
Set the motor to spin in a specific direction.
thisway motoronfor 10
thatway motoronfor 10
The motor spins one way for 1 second, then the
other way for 1 second.
Setpower takes an input from 0 to 100.
setpower 100 motoronfor 10
The motor spins quickly.
setpower 30 motoronfor 10
The motor spins slowly.
Causes the motor to stop immediately. This is
slightly different from
short brake followed by a coast.
motoron wait 10 brake
The motor spins for 1 second, then immediately
comes to rest.
Turns off the power to the motor but does not
brake it, so that the motor slowly comes to rest.
motoron wait 10 coast
The motor spins for 1 second, then slowly comes
to rest.
motoroff, which does a
BlockWordExample Usage
touch?
brightness
touch?
brightness
Sensors
Reports true if the touch sensor is pressed.
waituntil [touch?] chirp
The Cricket waits until the touch sensor is pressed before
chirping.
Reports the value measured by the light sensor as a number
from 0 to 100.
forever [display brightness wait 1]
The display shows, and continually updates, the light level
measured by the light sensor.
42
PicoBlocks - Reference
Sensors
BlockWordExample Usage
loud?
loudness
connected?
resistance
text only
text only
beamIR
loud?
loudness
connected?
resistance
rawresistance
rawrange
beamir
number
Reports true (the number 1) if the value measured by the
sound sensor is greater than 15.
waituntil [loud?] chirp
The Cricket will chirp after the sound sensor detects a loud
sound.
Reports the value measured by the sound sensor as a
number from 0 to 100.
forever [display loudness]
The display shows, and continually updates, the sound level
measured by the sound sensor.
Reports true if the value measured by the resistance sensor
is less than 50.
waituntil [connected?] chirp
The Cricket waits until the alligator clips on the resistance
sensor connect before chirping.
Reports a number from 0 to 100. The sliders are not
available in text language.
forever [display resistance wait 1]
The display shows, and continually updates, the electrical
resistance measured by the resistance sensor.
Reports the value measure by the resistance sensor as a
number between 0 and 1023; rawresistance provides
finer resolution than resistance.
forever [display rawresistance wait 1]
The display shows, and continually updates, the electrical
resistance measured by the resistance sensor on a scale of 0
to 1023. (Numbers of 1000 or greater appear as dashes.)
Rawrange is used to adjust the sensitivity of the resistance
sensor. It takes as an input either the number 0 , 1, or 2.
An input of 0 results in the highest sensitivity and should
be used when measuring resistances of 1000 ohms or
less. An input of 1 is medium sensitivity and is the default
setting. It works best for resistances of about 10,000 ohms.
2 is the lowest sensitivity and should be used to measure
resistances of 100,000 ohms or more.
rawrange 0
display rawresistance
Beams a number from the Cricket’s infrared transmitter.
beamir 4
newIR?
newir?
Reports true (the number 1) if the Cricket’s infrared receiver
has received a new value.
waituntil [newir?] chirp
The Cricket chirps when a new number is beamed to it.
PicoBlocks - Reference
43
Sensors
BlockWordExample Usage
Reports the value of the most recent number beamed to the
Cricket.
IR
reset
timer
timer
ir
resettimer
timer
to test
waituntil [newir?]
if ir = 10 [chirp]
end
The Cricket chirps if the number beamed to it is equal to 10.
Resets to zero the value of the Cricket’s internal timer. See next
example.
Reports the Cricket’s timer value. Timer measures time in
hundreths of a second.
to test
resettimer
chirp
waituntil [touch?]
display timer
end
The display shows the amount of time that has elapsed between
when the Cricket chirps and when the touch sensor is pressed.
Flow
BlockWordExample Usage
Waits a certain amount of time (in tenths of a
wait
text only
text only
waituntil
forever
wait
mwait
no-op
waituntil [
forever [
number
number
list
condition
]
second).
chirp wait 10 chirp
The Cricket pauses for a second between the
two chirps.
Waits a certain amount of time (in
milliseconds).
setlightcolor 20 mwait 10 lightoff
The light flashes very briefly.
Does nothing for about 40 microseconds.
repeat 10 [no-op]
The Cricket waits for 400 microseconds.
Waits until the condition is true.
]
waituntil [touch?] chirp
The Cricket waits until you press the touch
sensor before chirping.
Repeats a list of instructions forever.
forever [chirp wait 3]
The Cricket chirps continuously.
44
PicoBlocks - Reference
Flow
BlockWordExample Usage
repeat
if
if
thenelse
stopall
stop
stack
then
repeat
[
if
[
ifelse
[
[
stopall
stopstack
number
condition
list
condition
list1
list2
list
]
]
]
]
Repeats a list of instructions a set number of
times.
repeat 5 [chirp wait 2]
The Cricket chirps five times.
Runs a list of instructions if a certain condition is
met.
forever [if touch?
[chirp wait 1]
]
The Cricket chirps if you press the touch sensor
and is quiet if you do not press it.
Runs the first list of instructions if a certain
condition is met and the second list if it is not.
to test
forever [ifelse touch?
[setlightcolor random 0 99]
[lightoff]
]
end
The light flashes random colors if you press the
touch sensor and turns off if it you do not press it.
Stops everything: programs, motors, etc. Stopall is
equivalent to pressing the button on the Cricket.
to test
motoron
forever [if touch? [stopall]
setlightcolor random 0 99]
end
The lights and motors stop when you press the
button.
Terminates execution of a procedure, returning
control to the calling procedure.
to test
forever [if touch? [stopstack]
setlightcolor random 0 99]
end
There is no need for spacers in the text language.
There is no need for spacers in the text language.
PicoBlocks - Reference
45
Numbers
BlockWordExample Usage
Reports a number. Numbers in PicoBlocks are
number
+
-
x
/
text only
r a n d o m
number
number
number
number
number
%
random
number
+
number
-
number
*
number
/
number
number
limited to integers between -32768 and +32767.
display 7 The display shows the number 7.
Reports the sum of two numbers.
display 7 + 4
The display shows the number 11.
Reports the difference of two numbers.
display 7 - 4
The display shows the number 3
Reports the product of two numbers.
display 7 * 4
The display shows the number 28.
Reports the quotient of two numbers, rounded
down to the nearest integer.
display 7 / 4
The display shows the number 1.
Reports the remainder when two numbers are
divided.
display 7 % 4
The display shows the number 3.
Report a random number, the two inputs
determining the lower and upper limits
display random 0 10
The display shows a random number from 0 to 10.
Reports true (the number 1) if the value of the first
input is greater than the value of the second input.
to test
>
number
>
number
forever [if brightness > 30 [chirp]]
end
The Cricket chirps if the light sensor measures a
value greater than 30.
Reports true (the number 1) if the value of the first
input is less than the value of the second input.
to test
<
number
<
number
forever [if brightness < 30 [chirp]]
end
The Cricket chirps if the light sensor measures a
value less than 30.
Reports true (the number 1) if the value of the first
input is equal the value of the second input.
=
number
=
number
forever [if brightness = 30 [chirp]]
The Cricket chirps if the light sensor measures a
value exactly equal to 30.
46
PicoBlocks - Reference
Numbers
BlockWordExample Usage
Reports true (the number 1) if the first and second
conditions are both true.
and
not
or
condition
condition
not
condition
and
or
condition
condition
to test
forever [if (brightness < 30) and touch?
[chirp]]
end
The Cricket chirps if the light sensor measures a
value less than 30
and
the touch sensor is also
pressed
Reports true (the number 1) if the first or the second
conditions are both true.
to test
forever [if (brightness < 30) or touch?
[chirp]]
end
The Cricket chirps if the light sensor measures a
value less than 30 or the touch sensor is pressed
Reports true (the number 1) if the result of the
condition is false (number 0).
to test
forever [if not touch? [chirp]]
end
The Cricket chirps if the touch sensor is
not
pressed.
My Blocks
BlockWordExample Usage
store in
box1
box1
text only
text only
block
block-denition
end
storeinbox1
box1
global:
make
name
number
“name value
You can use the text language to make your own
blocks. (See section Make Your Own Blocks above.)
Stores a number in the global variable called box1.
storeinbox1 57
display box1
The display shows the number 57.
Reports the number stored in the global variable
called box1.
storeinbox1 57
You can use the text language to create new
global variables. (See section Global Variable
above.)
Make allows you to change the value of a local
variable. (See section Local Variables above.)
s
PicoBlocks - Reference
47
Common Error Messages
Error MessageExplanation
The Beamer cannot see
the Cricket
Can’t find the BeamerPicoBlocks wasn’t able to open the communication port.
Can’t save an empty score You tried to export a melody or rhythm that is empty.
Can’t use ____ as a name
The Beamer is sending, but no Cricket is responding.
Solution: Make sure the Cricket is turned on, and that the Cricket
and the Beamer are facing each other.
For more information, see
www.picocricket.com/troubleshooting
Solution: Make sure the Beamer is properly connected to your
computer. If you are using Windows, make sure only one copy of
PicoBlocks is running. For more information, see:
www.picocricket.com/support
Solution: Make sure the block contains notes, then click Export
again.
PicoBlocks does not allow that word as a name. Numbers, names
starting with % or [ , and existing words are considered invalid.
Solution: Type another name.
Communication problem
There was a communication problem while PicoBlocks was
downloading data to your Cricket.
Solution: Make sure that the Beamer and the Cricket are facing
each other, then try again. If the Cricket’s yellow antenna lights
keep flashing even when you are not downloading, the Cricket
is probably receiving infrared interference from a monitor or
other device. Shield the Cricket from the monitor. For more
information, see www.picocricket.com/troubleshooting
Missing input to _______One (or more) of the blocks requires input.
Solution: Check that every block has something attached on its
right side when required. (You can tell by the shape of a block
whether it takes an input.)
For example, display needs a number (or other value) attached
as an input:
display
100
Repeat requires a number value at the top right. It also requires
plus one or more blocks under its “arm” to repeat:
repeat
10
chirp
Tip: To check if a block needs inputs, click on the block with the
?
Help tool
?
48
PicoBlocks - Reference
Error MessageExplanation
I don’t know how to ______
PicoBlocks tried to run a name that doesn’t exist.
Solution: If you name a stack, then PicoBlocks creates a
block with that name. To run the block, you need to keep
the named stack in the Workspace, so PicoBlocks knows
what to do.
The name ____ already exists
There is already an existing block with the same name.
Solution: Type another name.
Number block doesn’t like
You typed an invalid character in
_____
Solution: Type only numbers.
Project contains too many
Your project contains too many blocks.
blocks
Solution: Delete all stacks, melodies and rhythms that are
not being used.
Too many blocks in the stackThe stack contains too many blocks (and uses up too much
memory).
Solution: Use a repeat to do more with fewer blocks. Or,
place a
on the top of the stack, and click on it
to type in a name.
Too many music blocks: Limit
of 24
You have made more than the maximum number of music
blocks. The maximum number of melodies and rhythms is
24 blocks.
Solution: Delete some of the melody or rhythm blocks so
that the project has no more than 24 total.
Too many notes for one music
The current melody or rhythm is too long.
block
Solution: Divide the melody or rhythm into two blocks.
To do this, first copy the current music block. In this block,
delete the second half of the notes. In the other block,
delete the first half of the notes. Now you can use these two
blocks together to play the entire sequence.
waituntil needs inputThe waituntil block needs an input block that fits.
Solution: Attach a block that fits onto the right side of the
waituntil block.
Examples:
waituntil
loud?
or
waituntil
brightness
>
50
PicoBlocks - Reference
49
Error MessageExplanation
You can’t copy an empty music
block
You can’t name a stack ______
You don’t say what to do with
________
You tried to copy a melody or rhythm that is empty.
Solution: Add notes, then copy the block.
The name typed on the contains invalid
characters. It cannot contain the following characters:.
% “ + - * / ] [ or a space. Numbers can only be used in
combination with letters.
Solution: Type letters on the
PicoBlocks tried to run a block that returns a value, but
there was no block attached to receive that value.
Solution: Attach a block that will fit that shape (and receive
the value). For example:
waituntil
touch?
Text-Only Error Messages
The following error messages only appear when using the PicoBlocks Text Language.
Error MessageExplanation
_______: a block can’t have
more than 3 inputs
______ has no value
_______: output block can
only have 1 input
You can’t make a block with more than 3 inputs.
Solution: Store the other values as global variables, and use
the names of these variables in your program. For more
information, see Global Variables in the PicoBlocks Text
Language section of this reference guide.
PicoBlocks could not find a value for the specified name.
Solution: In the Text Area, check that you have correctly
typed the name of the input. Inputs should have a colon
preceding them, but global variables should not.
A block that outputs can only have 1 input.
Solution: Store the other values as global variables, and use
the names of these variables in your program. For more
information, see Global Variables in the PicoBlocks Text
Language section of this reference guide.
() error
misplaced )
A parenthesis is missing or misplaced.
Solution: Check that there are an equal number of open and
closed parenthesis ( ), and that they are correctly placed.
50
PicoBlocks - Reference
Error MessageExplanation
Can’t name a global _______
Can’t use _____ as name of an
input
Missing [
Missing ]
Missing name after
to
Missing name after block
Missing name after bblock
You need to type in a different name for the global variable.
Solution: Use only letters and numbers as names for
global variables. See Global Variables in the PicoBlocks
Text Language section of this reference guide for more
information.
PicoBlocks doesn’t like numbers as the name of an input.
Solution: You need to type in a different name for the input.
Avoid using numbers as input. Also, make sure to put a
colon before the name of the input.
For example:
block mydance :turns
repeat :turns [motoronfor 10 reverse]
end
There is a missing bracket: ] or [
Solution: Make sure there are an equal number of open and
closed brackets.
Solution: The words to, block, and bblock need to be
followed by a valid name. For example:
block mylights
setlightcolor 60
wait 10
lightoff
end
No output from _____ The word or block indicated does not provide output.
Solution: Make sure every block has something attached
on its right side when required. See the PicoBlocks Text
Language section for more on how to use output.
Too many globals
There are too many global variables in the project. The
maximum number of variables is 7 (including box1 and
box2).
Solution: Delete some of the global variables so that the
project has no more than 7 total.
waituntil needs a list as input.waituntil needs a list as input.
Solution: Add a list in brackets after waituntil
For example:
waituntil [touch?]
chirp
PicoBlocks - Reference
51
Error MessageExplanation
make needs a local variableMake needs to be followed by the name for a local variable.
Solution: Check that the word after make has a quotation
mark before it, and is a local variable.
For example:
block fastlight :n
setlightcolor :n
make “n :n / 10
wait :n
lightoff
end
52
PicoBlocks - Reference
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.