
PicoBlocks - Reference
2
Action
Block
Word
Example Usage
motor
on
motor
off
motoron
motoroff
Turns a motor on or off.
motoron wait 10 motoroff
The motor spins for 1 second.
motor
onfor
motoronfor
number
Turns the motor on for a set period of time (in
tenths of a second).
motoronfor 10
The motor spins for 1 second.
reverse
reverse
Change the direction in which the motor spins.
repeat 6 [motoronfor 3 reverse]
The motor wiggles back and forth.
this
way
that
way
thisway
thatway
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.
set
power
setpower
number
Setpower
takes an input from 0 to 100.
setpower 100 motoronfor 10
The motor spins quickly.
setpower 30 motoronfor 10
The motor spins slowly.
text only
brake
Causes the motor to stop immediately. This is
slightly different from
motoroff
, which does a
short
brake
followed by a
coast
.
motoron wait 10 brake
The motor spins for 1 second, then immediately
comes to rest.
text only
coast
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.
Sensors
Block
Word
Example Usage
touch?
touch?
Reports true if the touch sensor is pressed.
waituntil [touch?] chirp
The Cricket waits until the touch sensor is pressed before
chirping.
brightness
brightness
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.