52
PicoCricket Reference Guide The Playful Invention Company PicoCricket Reference Guide Version 1.0

PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

Embed Size (px)

Citation preview

Page 1: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoCricketReference Guide

ThePlayfulInventionCompany

PicoCricketReference Guide

Version1.0

Page 2: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

Credits

Design Team MitchelResnick BrianSilverman PaulaBontá RobbieBerg NatalieRusk

Industrial Design: SmartDesign

Graphic Design: BigBlueDot

Wewouldliketogivespecialthanksto:

PICOstaffmembersChadBurtandMikeDurcakfortheirinvaluableideasandenthusiasm.

DianaGeeSilvermanfortheon-linehelp,DannyLutzforthesounds,andLawrenceShubertforguidingPICOthroughtheintricateaspectsofcompliancetestingandmanufacturability.

stafffromthePlayfulInventionandExploration(PIE)projectfordevelopingnewCricketactivities,particularlyKeithBraafladt,StephanieHunt,ChipLindsey,HidekiMori,KristenMurray,MikePetrich,MargaretPezalla-Granlund,NatalieRusk,MichaelSmith-Welch,KarenWilkinson,andDianeWillow.

MITresearchersandstudentswhocontributedtoCricketR&D,particularlyAndyBegel,RobbieBerg,RahulBhargava,RickBorovoy,FredMartin,BakhtiarMikhak,MitchelResnick,andBrianSilverman.

theLEGOCompanyforitscontinuingsupport,particularlyKjeldKirkKristiansen,LisbethValtherPallesen,JensMaibom,andErikHansen.

©2006.ThePlayfulInventionCompanyInc.Allrightsreserved.Thismaterialmaynotbereproduced,displayed,modified,ordistributedwithouttheexpresspriorwrittenpermissionofthecopyrightholder.

Page 3: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

Contents

Credits 2lntroduction 4PicoBlocks 8Blocks Summary 12Blocks - Detailed by Category 14Melody and Rhythm Editors 30The PicoBlocks Text Language 35Error Messages 48

Page 4: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference�

lntroduction

Welcome!ThisReferenceGuideprovidesanoverviewofthePicoCricketfamilyofpartsandthePicoBlockssoftwareusedtoprogramthePicoCricket.

IfyouarejustgettingstartedwiththePicoCricketandPicoBlocks,pleasegothroughtheSetupGuideandGettingStartedbookletfirst,togetanoverallintroduction.Ifyouwantmoredetailedinformation,thencomebacktothisReferenceGuide.

WearecontinuallyupdatingtheReferenceGuide.Youcandownloadthelatestversionfromwww.picocricket.com/support

PicoCricket Family

ThePicoCricketfamilyincludesthefollowingparts:

PicoCricket

ThePicoCricketisatinycomputerthatcancontrolthingsintheworld.TheCrickethasfourportswhereyoucanpluginotherdevices,suchassensors,motors,andlights.YoucanpluganyofthesedevicesintoanyoftheCricketsports.

Page 5: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference �

TheCrickethasthreetypesofindicatorlights:

Theon-off indicator lightturnson(orange)whenyouturnontheCricket.Ifthebatteriesarelow,thelightflashesrapidlywhenyouturnontheCricket.

Theprogram-running indicator lightturnson(green)whentheCricketisrunningaprogram,anditchangescolortoamberwhentheCricketisrunningtwoprogramsatthesametime.

TheIR-communication indicator lightsflash(yellow)whentheCricketiscommunicatingthroughitsinfraredtransmitter.

IfyoupushtheCricketbuttonwhiletheCricketisrunningaprogram,theprogramwillstop.Ifyoupushthebuttonwhennoprogramisrunning,theCricketwillre-runthelastprogramthatitran.

EvenwhenyouturntheCricketoff,itremembersthelastprogramthatitran.Soifyourunaprogram,turnofftheCricket,turnitbackonlater,andpushthebutton,theCricketwillruntheprogramagain.

Beamer

TheBeamertransmitsinformation(viainfraredsignals)fromyourcomputertoyourCricket.WhenyouwriteaprogramusingPicoBlockssoftwareonyourcomputer,yousendtheprogramtotheCricketviatheBeamer.

Page 6: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference�

ThePicoCricketKitincludesaUSB-serialcableforconnectingtheBeamertoaUSBportonyourcomputer.Alternatively,youcanconnecttheBeamertoaserialport,usingastandardserialcable(notincluded).

WhenyouaresendinginformationtotheCricket,makesurethattheantennasontheBeamerarefacingtowardstheantennasontheCricket.WhiletheBeamerandCricketarecommunicating,theindicatorlightsintheantennaswillflashyellow(onboththeBeamerandtheCricket).

TheBeamerhasarangeofabouta1meter.NotethataBeamercancommunicatewithoneCricketatatime.IfyouhavemultipleCrickets,makesurethatonlyoneofthemisinrangeoftheBeameratanytime.

Actuators

Actuatorsaredevicesthatmakethingshappenintheworld.ThePicoCricketKitincludesfourtypesofactuators:coloredlights,soundbox,motor(withmotorboard),andnumericdisplay.

Name Description Programming Blocks Icon

Light Youcansetthecolorofthelightacrosstheentirerainbow,fromredtoviolet.Youcanalsosetthebrightnessofthelight.

SoundBox

Thesoundboxisasmallsynthesizerthatcanplaynotes,melodies,soundeffects,andrhythms.PicoBlockssoftwareincludesspecialeditorsforcreatingmelodiesandrhythms.Youcansetandchangewhichinstrumentwillplaynotesandmelodies.

note

Motorand

MotorBoard

ThemotorboardconnectstotheCricket,andtheLEGOmotorconnectstothemotorboard.Youcanturnthemotoronandoff,andsetitspoweranddirection.

DisplayThethree-digitdisplaycanshowanynumberbetween0and999.Itisespeciallyusefulfordisplayingsensorvalues.

Page 7: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference �

Sensors

SensorsallowyourCrickettorespondtosounds,lights,orotherchangesinitsenvironment.

Name Description Programming Blocks

Icon

LightSensor

Reportsthebrightnessoflight.Forexample,youcanusethelightsensortodetectwhensomeonecastsashadowwiththeirhand–orwhenthesunshinesthroughthewindow.

brightness

SoundSensor

Reportstheloudness(orvolume)ofsound.Forexample,youcanusethesoundsensortodetectwhensomeoneclapstheirhands–orwhensomeonesingsintothesensor.

loud?

loudness

TouchSensor

Reportsifthebuttonispressed.Forexample,youcanwriteaprogramthatmakessomethinghappen(amotorspinningoralightchangingcolor)whensomeonepressesthetouchsensor.

touch?

ResistanceSensor

Reportstheresistanceinthecircuitformedbythealligator-clipcables.Ifyouputdifferentmaterials(forexample,play-doughorabanana)betweenthealligatorclips,theresistancewillchange.Youcanalsousetheresistancesensortodetectwhenthealligatorclipsaretouchingeachother(orconnectedthroughaconductivematerial,suchasaluminumfoil).

connected?

resistance

Eachoftheprogrammingblockswillbedescribedfurtherinthefollowingpages.Forexamplesofhowtousetheactuatorsandsensors,see“MagicLantern”andothersampleprojectplacemats.

Cricket Care

1.RemembertoturnofftheCricketwhenyouaren’tusingit.

2.Iftheorangeon-offindicatorlightflashes,itmeansthatyourCricketisrunningoutofbatteries.Tochangethebatteries,followtheinstructionsintheSetupGuide.

3.Begentlewiththecableconnectors.Ifyoupushtheconnectorsupanddownwithtoomuchforce,theconnectorswillbreak.

4.KeepyourCricketdevicesawayfromwaterandotherliquids.

5.IfyourCricketismisbehaving,checktheTroubleshootingsectioninourwebsite:www.picocricket.com/troubleshooting

Page 8: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference �

PicoBlocks

Overview

PicoBlocksisaprogramminglanguagedesignedspecificallyforprogrammingyourCricket.WithPicoBlocks,youcreateprogramsbysnappinggraphicalblockstogetherintostacks.

Tools

?? STOPUndo

2

Thetoolsareusedfortakingdifferentactionsontheblocks,suchascopyingblocks,deletingblocks,orsendingblockstotheCricket.Whenyouclickonatool,thecursorturnsintothattool.

Arrow

UsetheArrowtodragblocksfromtheBlocksPalettetotheWorkspace,orwithintheWorkspace.Tomoveanentirestack,dragfromthetopblock.Draggingablockfromthemiddleofastackwillalsomoveanyblocksattachedbeneaththeoneyouaredragging.

YoucangetridofblocksbydraggingthemoffoftheWorkspace,inanydirection.Ifyoudeleteblocksbymistake,clickUndo

ThisisyourWorkspaceDraganddropblockstocreateyourstacks

These are the tools

Click on the tabs to get different categories of blocks

This is a stack

BlocksPalette

Page 9: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference �

Magic Wand

UsetheMagicWandtorunaprogram.WhenyouclickonablockorstackwiththeMagicWand,itsendstheprogramtotheCricketandtellstheCrickettoruntheprogram.

chirp

foreversetlight color

brightness

YoucanusetheMagicWandtoclickonblocksintheBlocksPalette,thesamewayyouclickonblocksintheWorkspace.Thisfeatureisusefulfortestingoutablock.

Anotherwaytorunaprogramisbydouble-clickingwiththeArrow,insteadofsingle-clickingwiththeMagicWand.

Scissors

UsetheScissorstogetridofblocks.Clickingonablockinastackwillalsocutallblocksattachedbelowit.

Ifyoudeleteblocksbymistake,clickUndo

YoucanalsogetridofblocksbydraggingthemoutoftheWorkspace.

waituntil

motoron

reverse

motoronfor

touch?

10

waituntil

motoron

touch?

Stamper

UsetheStampertocopyblocksandstacks.Clickoncetocopy,thenmovetoanewlocationandclickasecondtimetopaste.WhenyouclickonablockinastackwiththeStamper,italsocopiesallblocksattachedbelowit.

YoucanswitchtotheStampertemporarilyusingCtrl+ ,or +

waituntil

motoron

reverse

motoronfor

touch?

10reverse

motoronfor 10

Page 10: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 10

?? Help

UsetheHelptooltogetmoreinformation.IfyouclickonablockwiththeHelptool,awindowwithmoreinformationwillappear.

2 Second Wand

UsetheSecondWandtotelltheCrickettorunasecondstackatthesametimeasitisrunningsomethingelse.Toruntwostacks,clickononewiththeMagicWand,thentheotherwiththeSecondWand.

Forexample,youcanusetheSecondWandtostartbackgroundmusicordisplaysensorvalueswhileanotherprogramisrunning.

melody12

display

forever brightness2

Tags

UsetheTagstoolwhenyouwanttotelltwodevicesofthesametypetododifferentthings.Forexample,ifyouplugtwocoloredlightsintoaCricket,andthensendasetlight-colorcommandtotheCricket,theCricketwillchangethecolorofbothlights.Ifyouwanttoturneachlighttoadifferentcolor,youneedtouseTags.

setlightcolor

wait 10

setlightcolor

wait 10

??

Page 11: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 11

EachofthefourportsontheCricketislabelledwithadifferentnumberofdots.Ifyouwanttosendacommandtoaparticularport,thenyouneedto“tag”theblockwiththeappropriatenumberofdots.Forexample,ifyouplugcoloredlightsintoports and ,thenyoucansetthecolorofeachlightindividuallywiththefollowingblocks:

setlightcolor

setlightcolor

Totagablock,clickontheappropriatedotintheTagstool,thenclickontheblockthatyouwanttotag.

setlightcolor

Toremoveatagfromablock,clickinthecenteroftheTagstoolandthenclickontheblock.

setlightcolor

STOP Stop

ClickontheStopsigntostopallprogramsrunningontheCricket.MakesurethattheCricketis“insight”oftheBeamer.Alternatively,youcanstopprogramsontheCricketbypressingthewhitebuttonontheCricket.NotethatstoppingprogramsontheCricketdoesnotturnofflightsattachedtotheCricket.Ifyouwanttoturnoffthelights,slidetheon-offswitchintotheoffposition.

Page 12: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference12

Blocks Summary

ThislistshowsallofthebasicblocksinPicoBlocks.

setlight color setsthelight’scolor

setlight power setsthelight’spower

lightoff turnsthelightoff

displaydisplaysavalueonthedisplay

chirp makestheCricketchirp

note playsanote(pitchandduration)

playsound

Kitten playsasound

setinst

Piano setsaninstrumentforthenextnoteormelody

settempo

set

volume

setsthetempoorvolumeforthenextnote,melodyorrhythm

motoron motor

off turnsmotoronoroff

motoronfor

turnsthemotoronforacertainperiodoftime

reverse reversesthemotor’sdirection

thisway that

way setsthemotor’sdirection

setpower setsthemotor’spower

touch?reportstrueifthetouchsensoris

pressed

brightness reportsavaluefromthelightsensor

loud?reportstrueifthesoundsensor

detectsaloudsound

loudness reportsavaluefromthesoundsensor

connected? reportstrueiftheresistancesensordetectsaresistanceof0

resistance reportsavaluefromtheresistancesensor

beamIR beamsavaluetoanotherCricket

IRreportsavaluebeamedby

infraredfromanotherCricket

newIR? reportstrueifanotherCrickethasbeamedanewvaluebyinfrared

timer reportstheCricket’stimervaluein100thsofasecond

resettimer

setstheCricket’stimerto0

waitwaitsanumberofticks(where10

ticks=1second)

waituntil waitsuntiltheconditionistrue

foreverrepeatsablockorstack

forever

repeatrepeatsablockorstack

acertainnumberoftimes

if

then

runsablockorstackiftheconditionistrue

if

then else

ifconditionistrue,runonestack;ifnot,runtheotherstack

stopall stopseverything

stackstop stopsthisstack

Page 13: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 13

Blocks Summary - Continued

createsspacebetweenblocks, sothattheydon’toverlaponeanother

number specifiesanumber(clicktohighlight,andthentypeinanumber)

+ - x / computesarithmeticoperations

r a n d o m

picksarandomvaluebetweenthetwonumbers

>

< makesacomparisonbetweentwonumbers

=andreportstrueorfalse

and reportstrueifbothconditionsaretrue

or reportstrueifeitherconditionistrue

not reportstheoppositeofacondition

sitsontopofstack,andallowsyoutotypeinnameforthestack

store inbox1 box1 setandreportvaluesforvariables

store inbox2

box2

Page 14: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference1�

Blocks - Detailed by Category

Light Blocks

setlight color

whichcolor

wait

setlight color

5

4

setlight color

turnsthelightblue

waitsfor4ticks

turnsthelightpink(color5)

SetstheLED’scolorandturnsiton.Youcansetthecolorbyusingthecolorslider,orchoosinganumberbetween0and100.Colorsarenumberedasfollows:

Defaultvalue:setlightcolor 0

setlight power

howbright

setlight power

wait 40

setlight power 100

setslighttohalfpowerandturnsiton

waitsfor40ticks

setslightbacktofullpower

setlightpowercantakenumbersbetween0(nolight)and100(fullpower).Youcansetthepowerbyusingtheslideroranumberblock.Defaultvalue:setlightpower 100

lightoff

wait

setlight color

15

lightoff

turnsthelightgreen

waitsfor15ticks

turnsthelightoff

lightoffturnsthelightoff.

pinkredyellowaqualightblueviolet020406080100

1030507090magentaorangegreencyanblue

Page 15: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 1�

display

displaywhat

r a n d o mdisplay 15 95 displaysarandomnumber

Displaysavalueonthedisplay

Sound Blocks

TheSoundpalettestartswithsixbasicblocks(shownbelow).YoucancreateadditionalblockswiththeMelodyandRhythmeditors.Seepage30forinformationoncreatingmelodiesandrhythms.

chirp makestheCricketchirponce

MakingtheCricketchirpisagoodwaytotestwhetheryourcomputeriscommunicatingproperlywiththeCricket.

note howhighanote

note5

50 playsthenote50 for5ticks(halfasecond)

howlongnotecanplaynotesbetween0(lowest)and100(highest).YoucanplaynoteswiththeCricketspeakerorwiththeSoundBox(butitwillsoundmuchbetterwiththeSoundBox).Forcomposingmelodies,wesuggestusingtheMelodyEditorratherthanputtingindividualnoteblockstogether.Defaultvalue:note 50 2

playsound playsthissound(kitten)

playsound

Kitten

23playsound playssound23(horse)

Selectasoundwiththesliderorenteranumberbetween0and100.Thereare24soundsavailable(seetablebelow).

Page 16: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference1�

# Sound # Sound # Sound

1 Piano 9 Claps 17 Cricket

2 Flute 10 Cowbell 18 Fairydust

3 Pizzicato 11 Maracas 19 HighQ

4 Strings 12 Slap 20 Dog

5 Trombone 13 Timbale 21 Rooster

6 Vibes 14 WoodBlock 22 Goose

7 Agogo 15 Guiro 23 Horse

8 Cabasa 16 Bloops 24 Kitten

AllthesesoundsrequiretheSoundBox.Sound0istheCricketchirp.Fornumbersgreaterthan24,playsoundplaysthenextsoundinthelist:25playssound1,26playssound2,...andsoon.Defaultvalue:playsound 24 (kittten)

setinst

setinstrumentwhichinstrument

note5

16

setinst

Trombone setsinstrumenttotrombone

playsnote16(onthetrombone)for5ticks(halfasecond)

Setstheinstrumenttobeusedforsubsequentnotesormelodies.Youcanselecttheinstrumentwiththesliderorattachanumberbetween0and100.setinstrument 0setsthenoteormelodywiththeCricket’sbeeper.Theinputsforsetinstrumentarethesameasforplaysound(shownintableabove).Youcanuseanysoundasaninstrument,buttheydon’tallworkwell.Defaultvalue:setinstrument 1 (piano)

settempo

melody1

settempo 100 setstempoto100(fastest)

playsmelody1atthefastesttempo

settempotakesvaluesbetween0(slowest)and100(fastest).Thefastesttempo(100)equalsto240bpm(beatsperminute),whiletheslowest(0)equalsto60bpm.Defaultvalue:settempo 50 (120bpm)

Page 17: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 1�

setvolume

setvolume 30

note5

50

setsthevolumeto30(quiet)

playsnote50for5ticks(halfasecond)

setvolumetakesvaluesbetween0(nosound)and100(loudest).SetvolumeonlyworkswiththeSoundBox.Defaultvalue:setvolume 80

Action Blocks

motoron

motoroff

motoron

motoroff

wait 20

turnsthemotoron

waitsfor20ticks(2seconds)

turnsthemotoroff

motoroffmakesthemotorcoasttoastop.Ifyouwantthemotortostopmoreabruptlyormoregently,tryusingthebrakeandcoastcommandsinthePicoBlocksTextLanguage.

motoronfor howlong

motoronfor 20 turnsonmotorfor20ticks(2seconds)

10ticks=1secondTurnsthemotoronforthespecifiednumberofticks,thenturnsitoff.motoronfordoesthesamethingasastackwithmotoron,thenwait,thenmotoroff.Defaultvalue:motoronfor 10

reverse

reverse

motoronfor 20

motoronfor 40

motorgoesonewayfor20ticks

changesdirection

goestheotherwayfor40ticks

reversecausesthemotortochangethedirectioninwhichitisspinning.reversedoesnotturnthemotoron,itonlychangesthedirection.

Page 18: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference1�

thisway that

way

thisway

thatway

motoronfor 10

motoronfor 10

setsmotortoonedirection

turnsonfor10ticks

setsmotortotheoppositedirection

turnsonagainfor10ticks

thisway setsthemotorinonedirection,thatway setsitintheotherdirection.Whichdirectioniswhichdependsonhowthemotorispluggedin.thiswayandthatwaydonotturnonthemotor,theyonlysetthedirection.

setpower

set

power 10

motoron

setsmotorpowerto10

turnsthemotoron

setpowertakesvaluesbetween0(nopower)and100(strongestpower).setpowerdoesnotturnonthemotor,itonlysetsthepower.Defaultvalue:setpower 100

Sensors Blocks

touch? isthetouchsensor

if

then

forever

chirp

touch?

beingpressed?

chirpsifthetouchsensorispressed

touch? reportstruewhenthetouchsensorisbeingpressed.TheexampleabovewillmaketheCricketchirpcontinuouslywhileyouarepressingthebuttononthetouchsensor.Ifyouwanttochirponlyonceeachtimeyoupushthebutton,youshouldmakeastacksimilartotheoneshownbelow:

Page 19: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 1�

foreverwaituntil touch?

touch?

chirp

waituntil notwaitsuntilthetouch

sensorisreleased

brightness

brightnessdisplay displaysthenumberreportedbythelightsensor

brightnessreportsnumbersbetween0(nolight)and100(lotsoflight)

loud?

setlight color

loud?waituntil waitsuntilthesoundsensordetectsasound

turnsthelightpink

loud?reportstrueifthesoundsensordetectsasoundwithloudnessgreaterthan15.

loudness

waituntil > loudness 30

setlight color

waitsuntilthesoundsensordetectsaclap

turnsthelightgreen

loudnessreportsnumbersbetween0(nosound)and100(loudsound).

connected?

foreverwaituntil

chirp

connected?waitsforresistancesensor

todetectaconnection

whenaconnectionissensed,itchirps

connected? reportstrueiftheresistancesensordetectsaresistanceoflessthan50.

Page 20: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference20

resistance

resistanceforeverdisplay displaysthenumberreported

bytheresistancesensor

resistancereportsnumbersbetween0(noresistance)and100(lotsofresistance).Ifyouaregettingnumbersinaverynarrowrange,youshouldadjusttheslidersasfollows:

resistance trythisifyouaren’tgettinglownumbers

resistance trythisifyouaren’tgettinghighnumbers

Remembertousethemagicwandaftermovingthesliders

beamIR

beamIRforever

wait 10

r a n d o m

0 100 beamsanumberbetween 0and100

beamIR beamsanumbertoanotherCricketviainfrared(IR).Tousethiscommand,youneedtwoCrickets:onebeamingtheIRsignal,theotherreceivingtheIRsignal.SeeexampleforIRblockbelow.Werecommendusingnumbersintherange0to100.Numbersoutsidethisrangemayproduceunexpectedresults.

newIR? IR

newIR?

IR

foreverwaituntil

note10

waitsforanewIRmessagefromanotherCricket

playsanotebasedonthenumberreceived

IRstandsforInfraRed.newIR?reportstrueifanewinfrared(IR)signalhasbeenreceived.IRreportsthevalueofthelatestinfraredsignalreceived.

Page 21: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 21

resettimer timer

resettimer

waituntil > timer 500

motoron

waitsuntilthetimer isgreaterthan500

turnsonmotor

100ticksofthetimerequals1second

Flow Blocks

wait

wait 20

lightoff

setlight color turnsthelightpink

waitsfor20ticks(2seconds)

turnsthelightoff

10ticksequals1secondDefaultvalue:wait 10

waituntil

touch?

motoron

waituntil

motoroff

turnsonmotor

waitsuntilthetouchsensorispressed

turnsoffmotor

Waitsuntil theconditionistrue.

setstimerto0

Page 22: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference22

forever

motoronfor

wait 3

3forever

repeatthisforever

Tostoptheforever,pushthebuttononyourCricketorclickon STOP

repeat

howmanytimes

10

motoronfor

repeat

4

reverse

repeatthis10times

if

then

ifthisistrue...

if

then

forever

chirp

connected?

thiswillhappen

placeherewhateveryouwanttodoaftertheiffinishes

Iftheconditionreportstrue,thentheCricketwillruntheblocksbelowtheword“then.”

placeherewhateveryouwanttodoaftertherepeatfinishes

Page 23: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 23

if

then else isthistrue?

forever

motoron

motoroff

if

then else

touch?

otherwisedothis iftrue,dothisIftheconditionreportstrue,thenruntheblocksundertheword“then”;ifnot,runtheblocksunder“else”.

stopall

if

then

forever

chirp

touch?

motoron

stopall

ifthisistrue...

everythingstops(includingthemotor)

Stopsallprogramsandmotors(butleaveslightson).stopallisequivalenttopressingthebuttonontheCricket.

stackstop

if

then

forever

chirp

touch?

stackstop

ifthisistrue...

thisstackstops

stopstack stopsonlythecurrentstack.Youcanusethisblocktostoponestackwhilecontinuinganotherstack.

Page 24: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference2�

Forexample:

colorswillstopwhenthetouchif

then

forever touch?

stackstop

setlight color

brightness

colors

colors

lightoff

melody1

sensorispressed,yettheotherstackwillcontinue.Thelightwillbeturnedoffandmelody1willbeplayed.

VerticalSpacer

WithoutSpacers WithSpacers

10

motoronfor

repeat

4

reversemotoronfor 4

10

motoronfor

repeat

4

reverse

motoronfor 4

Usespacerstokeeptheblocksfromoverlapping.(Addingspacersdoesnotchangethewaytheprogramruns.)

HorizontalSpacer

WithoutSpacers WithSpacers

10

motoronfor

repeat

4

reversemotoronfor 4

10

motoronfor 4

reversemotoronfor 4

repeat

Usespacerstokeeptheblocksfromoverlapping.(Addingspacersdoesnotchangethewaytheprogramruns.)

Page 25: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 2�

Numbers Blocks

number

setpower

motoronfor 20

50 setsmotorpowerto50(halfpower)

turnsonmotorfor20ticks(2seconds)

Clickon totypeinanumber. acceptsnegativenumbers.DefaultValue:10NumbersinPicoBlocksarelimitedtointegersbetween-32768and+32767.

+ addstwovaluesthisplusthat

motoronfor 10 + brightness

turnsonmotorfor10plusthevalueofthebrightnesssensor(forexample,ifthebrightnesssensoris30,motorturnsonfor40ticks).

- subtractstwovalues thisminusthat

setlight power - brightness100

turnsonlightwithapowerof100minusthevalueofthebrightnesssensor(forexample,ifthebrightnesssensoris60,lightpowerwillbe40).

x multipliestwovalues thismultipliedbythat

r a n d o m

0 10setlight color x 10

Setsthelight’scolortoarandomnumbermultipliedby10(forexample,iftherandomnumberis7,setsthecolorto70whichiscyan).

/ dividesthefirstvaluebythesecondvalue thisdividedbythat

/motor

onfor 10 brightness

turnsonmotorforthevalueofbrightnesssensordividedby10(forexample,ifthebrightnesssensoris50,motorturnsonfor5).

Page 26: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference2�

r a n d o m

reportsarandomnumberbetweenthisandthat

motoronfor

r a n d o m

10 50turnsonmotorforarandomnumberof

ticks(inthiscaseitcouldbe10,or50,or anythinginbetween...)Defaultvalue: random 0 100

> ifthisisgreaterthanthat...

>brightness 50if

then

chirp

forever

thiswillhappen

number1>number2reportstrueifnumber1isgreaterthannumber2.

<ifthisislessthanthat...

<brightness 60if

then

chirp

forever

thiswillhappen

number1<number2reportstrueifnumber1islessthannumber2.

=ifthisisequalsthat...

=brightness 50if

then

chirp

forever

thiswillhappen

number1=number2reportstrueifthetwonumbersareequal.

Page 27: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 2�

and waitsuntilthisandthatarebothtrue...

waituntil and loud? touch?

chirp

then,thiswillhappen

andreportstrueiftheresultofthefirstcondition(touch?)andthesecondcondition(loud?)arebothtrue.

orifthisorthatistrue...

orif

then

chirp

forever loud? touch?

thiswillhappen

orreportstrueiftheresultofthefirstcondition(touch?)orthesecondcondition(loud?)istrue.

not

waituntil touch?

motoron

motoroff

waituntil touch?notwaitsuntilthetouchsensor

isnotpressed

not reportstrueiftheconditionisfalse.notreportsfalseiftheconditionistrue.

Page 28: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference2�

My Blocks

Youcanusethisblocktogiveanametoastackofblocks–andcreateanew blockthatdoesthesamethingastheentirestack.Here’show:

1.attachtheblockatthetopofthestackyouwanttoname

chirp

chirp

2.clickandtypeaname3.anewblockwiththatnameappearsin

4.Useitinotherstacks

2chirps

4repeat

chirps8times

store inbox1 box1 store in

box2 box2 Usetheseblocksforsettingand retrievingthevaluesofvariables.

Use store inbox1

tostoreavalue,anduse box1 toretrieveit.

store inbox1

r a n d o m

30 49

box1setlightcolor

setlightcolor

wait

box1

5

box1storesa randomnumber

turnsalightthatrandomcolor

waitsfor5ticks

turnsasecondlightthesamecolor

Page 29: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 2�

Tochangethenameofavariable,dragitintotheworkspace,clickonit,andtypeinthenewname.

store inbox1

box1setlight color

10

store inmy-color

my-colorsetlight color

10

Whenbox1isrenamedintheworkspace,theblocksinthepaletteareautomaticallyupdated.

renametheblock

Page 30: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference30

Melody and Rhythm Editors

PicoBlockshastwoeditorsforcreatingmusic:aMelodyEditorandaRhythmEditor.

Tocreateanewmelodyorrhythm(ortoeditanexistingone),firstclickontheSoundtab.AtthebottomofSoundpalettearetwobuttons,oneforopeningtheMelodyEditor,theotherforopeningtheRhythmEditor.

Afteryoucreateanewmelodyorrhythm,itwillappearasanewblockintheSoundpalette.Youcandragthesemusicblocksintotheworkspace,andconnectthemtostacks,justasyouwouldwithanyotherblockinPicoBlocks.

TheseblockswerecreatedusingtheMelodyEditorandRhythmEditor.

OpenstheMelodyEditor

OpenstheRhythmEditor

Page 31: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 31

Melody Editor

Clickon toopentheMelodyEditor.

Ifthisisyourfirstmelody,youwillseeablankMelodyWorkspaceforcreatingyourmelody.Ifyouhavepreviouslycreatedmelodies,youwillseeoneofyourexistingmelodiesintheMelodyWorkspace.Youcaneditthismelody–orselectoneofyourotherexistingmelodiestoedit(byclickingonablockinthepaletteontheleftside)–orcreateanewmelody(byclickingonthe“Create”buttonatthetop-left).

Toaddnotestoyourmelody,eitherclickonthekeyboard,orclickdirectlyintheMelodyWorkspace.

Whenyouarefinishedcreatingyourmelody,click OK toturnyourmelodyintoablockandexittheMelodyEditor.

Playorstop

Insertionpoint:thenextnotepressedonthekeyboardwillstarthere

MiddleC clickheretoinsertarestDragheretomaketheMelodyWorkspacebiggerorsmaller

Tocreateanewnote,clickonthekeyboardordirectlyintheMelodyWorkspace

Changeinstrument,volume,ortempo

Selecttheduration

ClickheretosavethemelodyasablockandexittheMelodyEditor

Clickheretocreateanewmelody

MelodyWorkspace

Youcanimportandexportmelodyfileswithextension.pbm

Dragthisendtochangelengthofnote

Page 32: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference32

Dragonthebackgroundtoselectnotes.Movetheselectednotesbydraggingthemtootherlocation.

Youcanalsocopy ,cut

andplay theselection.

Youcanalsoplaytheselectionbydoubleclickingonit.

AllofyourmelodiesappearattheleftoftheMelodyEditor.Clickonthemelodythatyouwanttoedit.

Tochangethenameofamelody,clickontheblockandtypeanewname.

Use tomakeacopyofamelody.Use todeletemelodies.

twinkle

twinkle

Page 33: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 33

Rhythm editor

Clickon toopentheRhythmEditor.

Ifthisisyourfirstrhythm,youwillseeablankRhythmWorkspaceforcreatingyourrhythm.Ifyouhavepreviouslycreatedrhythms,youwillseeoneofyourexistingrhythmsintheRhythmWorkspace.Youcaneditthisrhythm–orselectoneofyourotherexistingrhythmstoedit(byclickingonablockinthepaletteontheleftside)–orcreateanewrhythm(byclickingonthe“NewRhythm”buttonatthetop-left).

Whenyouarefinishedcreatingyourrhythm,click OK toturnyourrhythmintoablockandexittheRhythmEditor.

Changevolume,ortempo

Loop,playorstop

ClickheretosavetherhythmasablockandexittheRhythmEditor

DragheretomaketheRhythmWorkspacebiggerorsmaller

Clickordragheretocreateanote

Clickheretocreateanewrhythm

Youcanimportandexportrhythmfileswithextension.pbr

Page 34: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference3�

AllofyourrhythmsappearattheleftoftheRhythmEditor.Clickontherhythmthatyouwanttoedit.

Tochangethenameofarhythm,clickontheblockandtypeanewname.

Use tomakeacopyofarhythm.Use todeleterhythms.

Page 35: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 3�

The PicoBlocks Text Language

Overview

PicoBlocksletsyouconstructcomputerprogramsbysnappingdifferentblockstogether,likepiecesofapuzzle.Thisapproachmakesiteasytogetstarted;differentkindsofblockshavedifferentshapesandcanonlysnaptogetherincertainways.Theshapesofthepiecesprovidealotofguidanceastohowstructureyourprograms,helpingyoubuildprogramsthatworkthewayyouwantthemtowork.Butifyoutrytowritelongerprogramsyoumayfindthatusingtheblockscangetcumbersome.Forexample,allofyourstacksmaynolongerfitathescreenatthesametime.Also,therearesomeadvancedprogrammingfeaturesthatarenotavailableusingtheblocks.Asyourprogramsbecomelongerandmorecomplex,youmaywanttoconsiderusingtheTextLanguagethatisavailablefromwithinthePicoBlockssoftware.ThePicoBlocksTextLanguageissimilartothecomputerlanguageLogo.(FormoreinformationonLogoseewww.logofoundation.org.)TobeginwritingprogramsintheTextLanguage,clickonthetexticonlocatedinthelowerlefthandcornerofthePicoBlocksWorkspace.TheTextLanguageWorkspace,showninthefigurebelow,willappear.

ClickonthetexticontoswitchtothetextlanguageWorkspaces

ClickheretoswitchbackandforthbetweentheTextandtheBlocksWorkspaces

ProcedureAreaDefinenewwordshere

CommandCenterTypecommandshereand

thenpressEnter

Page 36: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference3�

TrytypingthefollowingcommandsintheCommandCenter.(PresstheEnterkeytoruneachline.) chirp The Cricket chirps! chirpwait2chirp 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 wordwait2.

EachblockinPicoBlockshasanassociatedwordinthetextlanguage.Thegeneralruleforfindingthenameofthewordinthetextlanguagethatisassociatedwithaparticularblockisaverysimpleone1:

Justcopywhat’swrittenontheblock,leavingoutaspaceifthereisone.

Forexample,plugalightintoyourCricketandtypethefollowingintheCommandCenter:

setlightcolor20ThelightturnsredNotethattherearenospacesinthewordsetlightcolor.

NowtrytypingthefollowinglineintheCommandCenter:

repeat5[chirpwait2]

IntheTextLanguagesquarebracketsareusedtoenclosethelistofwordsthataretoberepeated.Youcangetguidanceabouthowthetextwordcorrespondingtoaparticularblockismeanttobeusedbyclickingonthatblock,whichyoucanfindonthelefthandsideoftheTextLanguageWorkspace.Forexampleifyouclickonthe“repeat”blockthefollowingtextwillappearintheCommandCenter:

repeat10[WHATEVER]Inthismessage“WHATEVER”ismeantasaplaceholderforthelistofcommandsthatyouwantrepeated.

Other Examples

Pluginatouchsensorandasoundboxandtype:

waituntil[touch?]playsound23Youshouldherea“meow”whenyoupressthetouchsensoronthetouchsensor.

Ifyoutype:forever[waituntil[touch?]playsound23]youshouldnowhearthe“meow”eachtimeyoupressthetouchsensor.Intheselasttwoexamplesyouwillneedtomakesureyoutypethesquarebracketsintheproperplaces.

Pluginadisplayandtype:display7*9+6

TheTextlanguageusesparenthesestodeterminetheorderofinwhichthingsaredone.Comparetheaboveresulttowhatyougetifyoutype:

display7*(9+6)

1 Exceptionstothisruleoccurforthecasesoftheifandifelsewords;sincethetextworddoesnotinclude“then”.Foracompletelistoftheblocksandcorrespondingtextwords,seetheSummaryofTextLanguageWordschartattheendofthissection.

Page 37: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 3�

Procedures

Youcan“teach”yourCrickettounderstandnewwordsbydefiningproceduresintheProceduresAreaoftheTextLanguageWorkspace.Proceduresaredefinedusingthefollowinggeneralform: toprocedure-name procedure-body end

Theproceduredefinitionstartswiththekeywordto,followedbythenameoftheprocedure.Nextcomesthebodyoftheprocedure,whichisalistofwordsthatdescribewhattheprocedureistodo.Thekeywordendisusedtocompletetheproceduredefinition.

Forexample,intheProcedureAreatype:

tochirp-twice chirpwait5chirp end

You’venowtaughtyourCricketanewword;ifyoutypethewordchirp–twiceintheCommandCenter,theCricketwillchirptwice.

Procedures with Inputs and Outputs

Youcancreateproceduresthattakeinputsorproduceanoutput.Forexample,youcancreateaprocedurenamedchirpsthattakesaninputthatisusedasthecounterinarepeatloop.Notethatthenameoftheinputmustbeginwithacolon.: tochirps:num repeat:num[chirpwait5] end

Typing chirps10intheCommandCenterwillcausetheCrickettochirp10times.

Youcancreateaprocedurethattakestwoinputsthatwilldetermineboththenumberofchirpsandthedurationofthepausebetweenchirps:

tochirps2:num:pause repeat:num[chirpwait:pause] end

Typing chirps2103intheCommandCenterwillcausetheCrickettochirp10times,withapauseof3tenthsofasecondbetweenchirps.

Proceduresmayreturnvaluesusingtheoutputcommand.Forexample,youcandefineaprocedurecalledhalfby:

tohalf outputbrightness/2 end

Page 38: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference3�

Then,withadisplayandalightsensorpluggedin,trytypingintheCommandCenter:

displayhalf

Or,youcandefineaprocedurecalleddark?thatreturnsatrueoffalseresult:

todark? output(brightness<20) end

NowiftrytypingintheCommandCenter:

forever[ifdark?[chirp]]yourCricketshouldchirpwhenitisdarkenough.

Make Your Own BlocksYoucanusetheTextLanguagetomakedifferentkindsofblocks,whichyoucanthenusetobuildprogramsinthePicoBlocksWorkspace.ThisfeatureallowsyoutocontinuedoingmuchofyourprogrammingusingtheBlocksLanguage,withtheTextLanguagebeingusedasasupplementwhenitsadvancedfeaturesareneeded.

NewblocksaredefinedbytypingintheProceduresArea.Theblockdefinitionsbeginwiththekeywordblock.Forexample:blockchirp1chirpwait3chirpend

chirp1

Makesablockthatchirpstwice.

Blocksthatyouhavedefinedwillautomaticallybecreatedandplacedinthe“MyBlocks”area.Youcancreateblockswithuptothreeinputs.Forexample,tocreateablockwithoneinput:blockchirp2:numrepeat:num[chirpwait3]end

chirp2

Makesablockthatchirpsanumberoftimes.

Tocreateablockwithtwoinputs:

blockchirp3:num:pauserepeat:num[chirpwait:pause]end

chirp3

Makesablockthatchirpsanumberoftimes,withtheabilitytovarythelengthofthepausebetweenchirps.

Whenyoudefineablockthatoutputsanumber,PicoBlockswillautomaticallycreateanumber–shapedreporterblock:blockbright2output2*brightnessend

bright2

Reportsanumbertwiceasbigasthebrightnessmeasuredbythelightsensor.

Page 39: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference 3�

Usethekeywordbblockwhenyouwanttomakeablockthatoutputstheresultofatrue/falsecondition:

bblockdark?outputbrightness<10end

dark?

Using Tags in the Text Language

PicoBlocks“tags”areusedwhenyouareplugginginmorethanoneofthesamekindofpart,twolightsortwomotorsforexample,andyouwantthesepartstoactdifferently.(SeetheprevioussectiononTagsonpages10and11.)InprogramswrittenintheTextLanguage,awordwithoutatagwilladdressallpartsofthesametype.Forexample,iftwolightsarepluggedintoyourCricket,thecommand

setlightcolor90 willturnbothlightsblue.

Ifyouwanttoreferonlytothelightpluggedintothe port,addaperiodtotheendoftheword,withoutaspace:

setlightcolor.90

Similarly,toreferonlytothelightpluggedintothe port,addtwoperiodstotheendoftheword,withoutspaces:

setlightcolor..90

Toreferonlytothelightpluggedintotheport,addaperiodandacolontotheendoftheword,withoutspaces:

setlightcolor.:90

Toreferonlytothelightpluggedintotheportjustaddtwocolonstotheendoftheword,withoutspaces:

setlightcolor::90

Thismethodoftaggingtextwordswillworkwithotherwords2.Forexample

display.:57willdisplaythenumber57onadisplaypluggedintotheportand

forever[iftouch?:[chirp]]willcausetheCrickettochirpifatouchsensorthatispluggedintothe portispressed.

Global Variables

Inthe“MyBlocks”tabyouwillfindblocksforstoringnumbersintwodifferent“globalvariables”calledbox1andbox2.IntheTextLanguageyoucanusethekeywordglobal:tocreateuptofiveadditionalglobalvariables.Forexample,byincludingtheline:

global:times,pause

Note:Tagswillnotworkwithwordsrelatedtothesoundbox.2

Page 40: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference�0

intheProceduresAreayouwillcreatetwonewglobalvariablescalledtimesandpause.Now,trytypingthefollowinginthecommandcenter:

storeintimes5storeinpause3 repeattimes[chirpwaitpause]

TheCricketshouldchirp5times,withpausesof3tenthsofasecondbetweenchirps.

IfyouclickontheMyBlockstabyouwillalsofindthatnewblockscorrespondingtothenewvariablestimesandpausehavebeencreated.

Local Variables

Thewordmakeallowsyoutochangethevalueofaninputtoaprocedure.Forexample,ifyoudefineaprocedurecalledrainbowby:

torainbow:a repeat30[setlightcolor:amake“a:a+1wait2] end

then,withalightpluggedintoyourCricket,typing

rainbow20intheCommandCenterwillcausecolors20through49toflash.

Variablesofthiskindarecalled“localvariables”becausetheyareonlyavailableforusebytheprocedureinwhichtheyaredefined.BecausePicoBlockshasaverylimitednumberofglobalvariables(7),localvariablescanbehelpfulbecausetheydonotuseanyoftheglobalvariableslots.

Tool Not Available in the Text LanguageThe“secondwand”isnotavailableintheTextLanguage.

Summary of Text Language WordsThefollowingtableshowsthetextwordthatcorrespondstoeachPicoBlocksblockandgivesanexampleofhowthewordcanbeused.

LightBlock Word Example Usage

setlight color setlightcolornumber

Setlightcolortakesaninputfrom0to100.setlightcolor70Thelightchangestocyanandturnson.

setlight power setlightpowernumber

Setlightpowertakesaninputfrom0to100.setlightpower50Thelightturnsonathalfpower.

lightoff

lightoff lightoffThelightturnsoff.

Page 41: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference �1

LightBlock Word Example Usage

display displaynumberDisplaysavalueonthedigitdisplay:display709Thedisplayshowsthenumber709.

Textonly

setrgbnumbernumbernumber

Setsthecolorofthelight.Setrgbtakes3inputs(red,green,andblue),eachwitharangefrom0to100.Thethreeinputsmixtogiveoneparticularlightcolor.setrgb0100100Thelightturnscyan.

SoundBlock Word Example Usage

chirpchirp chirpwait3chirp

TheCricketchirpstwice.

note notenumbernumber

Notetakestwoinputs.Thefirstinput(anumberbetween0and100)determinesthepitchofthenoteandthesecondinputdeterminesthedurationofthenote(intenthsofasecond).note365Thesoundboxplaysanoteforhalfasecond.

playsound playsoundnumber

Playsasoundonthesoundboard.Playsoundtakesanynumberbetween0and100.Thereare24built-insounds.Playsoundrepeatsthelistinsequencefornumbersgreaterthan24.playsound24Thesoundboxmeows.

setinst setinstrumentnumber

Setstheinstrumentforthenextnote,ormelodytobeplayedonthesoundboard.Setinstrumenttakesanynumberbetween0and100:setinstrument4note365Thesoundboxplaysviolinnote.

settempo

settemponumber

Setsthetempoatwhichthenextrhythmormelodywillbeplayedonthesoundboard.Settempotakesanynumberbetween0-lowestpace-and100-fastestpace.settempo50melody1Thesoundboxplaysamelodyatthestandardtempo.

setvolume

setvolumenumber Setsthevolumeatwhichthenextnote,sound,rhythmormelodywillbeplayedonthesoundboard.Setvolumetakesanynumberbetween0-lowestvolume-and100-highestvolume:setvolume30playsound24setvolume100playsound24Thesoundboxmeowssoftly,thenloudly.

InadditiontotheblocksabovecanaddyourownblockstotheSoundtabbycreatingmelodiesand/orrhythmsintheirrespectiveeditors.Themelodyorrhythmnamebecomesatextwordthatyoucanuse.

Page 42: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference�2

ActionBlock Word Example Usage

motoron

motoroff

motoronmotoroff

Turnsamotoronoroff.motoronwait10motoroffThemotorspinsfor1second.

motoronfor

motoronfornumberTurnsthemotoronforasetperiodoftime(intenthsofasecond).motoronfor10Themotorspinsfor1second.

reversereverse Changethedirectioninwhichthemotorspins.

repeat6[motoronfor3reverse]Themotorwigglesbackandforth.

thisway

thatway

thiswaythatway

Setthemotortospininaspecificdirection.thiswaymotoronfor10thatwaymotoronfor10Themotorspinsonewayfor1second,thentheotherwayfor1second.

setpower

setpowernumber Setpowertakesaninputfrom0to100.setpower100motoronfor10Themotorspinsquickly.setpower30motoronfor10Themotorspinsslowly.

textonly brake Causesthemotortostopimmediately.Thisisslightlydifferentfrommotoroff,whichdoesashortbrakefollowedbyacoast.motoronwait10brakeThemotorspinsfor1second,thenimmediatelycomestorest.

textonly coast Turnsoffthepowertothemotorbutdoesnotbrakeit,sothatthemotorslowlycomestorest.motoronwait10coastThemotorspinsfor1second,thenslowlycomestorest.

SensorsBlock Word Example Usage

touch?touch? Reportstrueifthetouchsensorispressed.

waituntil[touch?]chirpTheCricketwaitsuntilthetouchsensorispressedbeforechirping.

brightness brightness Reportsthevaluemeasuredbythelightsensorasanumberfrom0to100.forever[displaybrightnesswait1]Thedisplayshows,andcontinuallyupdates,thelightlevelmeasuredbythelightsensor.

Page 43: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference �3

SensorsBlock Word Example Usage

loud?loud? Reportstrue(thenumber1)ifthevaluemeasuredbythe

soundsensorisgreaterthan15.waituntil[loud?]chirpTheCricketwillchirpafterthesoundsensordetectsaloudsound.

loudness loudness Reportsthevaluemeasuredbythesoundsensorasanumberfrom0to100.forever[displayloudness]Thedisplayshows,andcontinuallyupdates,thesoundlevelmeasuredbythesoundsensor.

connected? connected?

Reportstrueifthevaluemeasuredbytheresistancesensorislessthan50.waituntil[connected?]chirpTheCricketwaitsuntilthealligatorclipsontheresistancesensorconnectbeforechirping.

resistance resistanceReportsanumberfrom0to100.Theslidersarenotavailableintextlanguage.forever[displayresistancewait1]Thedisplayshows,andcontinuallyupdates,theelectricalresistancemeasuredbytheresistancesensor.

textonly rawresistanceReportsthevaluemeasurebytheresistancesensorasanumberbetween0and1023;rawresistanceprovidesfinerresolutionthanresistance.forever[displayrawresistancewait1]Thedisplayshows,andcontinuallyupdates,theelectricalresistancemeasuredbytheresistancesensoronascaleof0to1023.(Numbersof1000orgreaterappearasdashes.)

textonly rawrange

Rawrangeisusedtoadjustthesensitivityoftheresistancesensor.Ittakesasaninputeitherthenumber0,1,or2.Aninputof0resultsinthehighestsensitivityandshouldbeusedwhenmeasuringresistancesof1000ohmsorless.Aninputof1ismediumsensitivityandisthedefaultsetting.Itworksbestforresistancesofabout10,000ohms.2isthelowestsensitivityandshouldbeusedtomeasureresistancesof100,000ohmsormore.rawrange0displayrawresistance

beamIRbeamirnumber BeamsanumberfromtheCricket’sinfraredtransmitter.

beamir4

newIR? newir?Reportstrue(thenumber1)iftheCricket’sinfraredreceiverhasreceivedanewvalue.waituntil[newir?]chirpTheCricketchirpswhenanewnumberisbeamedtoit.

Page 44: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference��

SensorsBlock Word Example Usage

IR ir

ReportsthevalueofthemostrecentnumberbeamedtotheCricket.totestwaituntil[newir?]ifir=10[chirp]endTheCricketchirpsifthenumberbeamedtoitisequalto10.

resettimer

resettimer ResetstozerothevalueoftheCricket’sinternaltimer.Seenextexample.

timer timer

ReportstheCricket’stimervalue.Timermeasurestimeinhundrethsofasecond.totestresettimerchirpwaituntil[touch?]displaytimerendThedisplayshowstheamountoftimethathaselapsedbetweenwhentheCricketchirpsandwhenthetouchsensorispressed.

FlowBlock Word Example Usage

wait waitnumberWaitsacertainamountoftime(intenthsofasecond).chirpwait10chirpTheCricketpausesforasecondbetweenthetwochirps.

textonly mwaitnumberWaitsacertainamountoftime(inmilliseconds).setlightcolor20mwait10lightoffThelightflashesverybriefly.

textonly no-opDoesnothingforabout40microseconds.repeat10[no-op]TheCricketwaitsfor400microseconds.

waituntil waituntil[condition]Waitsuntiltheconditionistrue.waituntil[touch?]chirpTheCricketwaitsuntilyoupressthetouchsensorbeforechirping.

foreverforever[list] Repeatsalistofinstructionsforever.

forever[chirpwait3]TheCricketchirpscontinuously.

Page 45: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference ��

FlowBlock Word Example Usage

repeat repeatnumber[list]

Repeatsalistofinstructionsasetnumberoftimes.repeat5[chirpwait2]TheCricketchirpsfivetimes.

if

thenifcondition[list]

Runsalistofinstructionsifacertainconditionismet.forever[iftouch?[chirpwait1]]TheCricketchirpsifyoupressthetouchsensorandisquietifyoudonotpressit.

if

then else

ifelsecondition[list1][list2]

Runsthefirstlistofinstructionsifacertainconditionismetandthesecondlistifitisnot.totestforever[ifelsetouch?[setlightcolorrandom099][lightoff]]endThelightflashesrandomcolorsifyoupressthetouchsensorandturnsoffifityoudonotpressit.

stopall stopall

Stopseverything:programs,motors,etc.StopallisequivalenttopressingthebuttonontheCricket.totestmotoronforever[iftouch?[stopall]setlightcolorrandom099]endThelightsandmotorsstopwhenyoupressthebutton.

stackstop stopstack

Terminatesexecutionofaprocedure,returningcontroltothecallingprocedure.totestforever[iftouch?[stopstack]setlightcolorrandom099]end

Thereisnoneedforspacersinthetextlanguage.

Thereisnoneedforspacersinthetextlanguage.

Page 46: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference��

NumbersBlock Word Example Usage

number numberReportsanumber.NumbersinPicoBlocksarelimitedtointegersbetween-32768and+32767.display7Thedisplayshowsthenumber7.

+ number+number Reportsthesumoftwonumbers.display7+4Thedisplayshowsthenumber11.

- number-number Reportsthedifferenceoftwonumbers.display7-4Thedisplayshowsthenumber3

x number*number Reportstheproductoftwonumbers.display7*4Thedisplayshowsthenumber28.

/ number/numberReportsthequotientoftwonumbers,roundeddowntothenearestinteger.display7/4Thedisplayshowsthenumber1.

textonly %Reportstheremainderwhentwonumbersaredivided.display7%4Thedisplayshowsthenumber3.

r a n d o m randomnumbernumber

Reportarandomnumber,thetwoinputsdeterminingthelowerandupperlimitsdisplayrandom010Thedisplayshowsarandomnumberfrom0to10.

> number>number

Reportstrue(thenumber1)ifthevalueofthefirstinputisgreaterthanthevalueofthesecondinput.totestforever[ifbrightness>30[chirp]]endTheCricketchirpsifthelightsensormeasuresavaluegreaterthan30.

< number<number

Reportstrue(thenumber1)ifthevalueofthefirstinputislessthanthevalueofthesecondinput.totestforever[ifbrightness<30[chirp]]endTheCricketchirpsifthelightsensormeasuresavaluelessthan30.

= number=number

Reportstrue(thenumber1)ifthevalueofthefirstinputisequalthevalueofthesecondinput.forever[ifbrightness=30[chirp]]TheCricketchirpsifthelightsensormeasuresavalueexactlyequalto30.

Page 47: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference ��

NumbersBlock Word Example Usage

and conditionandcondition

Reportstrue(thenumber1)ifthefirstandsecondconditionsarebothtrue.totestforever[if(brightness<30)andtouch?[chirp]]end

TheCricketchirpsifthelightsensormeasuresavaluelessthan30andthetouchsensorisalsopressed

or conditionorcondition

Reportstrue(thenumber1)ifthefirstorthesecondconditionsarebothtrue.totestforever[if(brightness<30)ortouch?[chirp]]endTheCricketchirpsifthelightsensormeasuresavaluelessthan30orthetouchsensorispressed

notnotcondition Reportstrue(thenumber1)iftheresultofthe

conditionisfalse(number0).totestforever[ifnottouch?[chirp]]endTheCricketchirpsifthetouchsensorisnotpressed.

My BlocksBlock Word Example Usage

blocknameblock-definitionend

Youcanusethetextlanguagetomakeyourownblocks.(SeesectionMakeYourOwnBlocksabove.)

store inbox1 storeinbox1number

Storesanumberintheglobalvariablecalledbox1.storeinbox157displaybox1Thedisplayshowsthenumber57.

box1 box1Reportsthenumberstoredintheglobalvariablecalledbox1.storeinbox157

textonly global: Youcanusethetextlanguagetocreatenewglobalvariables.(SeesectionGlobalVariablesabove.)

textonly make“namevalue Makeallowsyoutochangethevalueofalocalvariable.(SeesectionLocalVariablesabove.)

Page 48: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference��

Common Error Messages

Error Message Explanation

TheBeamercannotseetheCricket

TheBeamerissending,butnoCricketisresponding.

Solution:MakesuretheCricketisturnedon,andthattheCricketandtheBeamerarefacingeachother.Formoreinformation,seewww.picocricket.com/troubleshooting

Can’tfindtheBeamer PicoBlockswasn’tabletoopenthecommunicationport.

Solution:MakesuretheBeamerisproperlyconnectedtoyourcomputer.IfyouareusingWindows,makesureonlyonecopyofPicoBlocksisrunning.Formoreinformation,see:www.picocricket.com/support

Can’tsaveanemptyscore Youtriedtoexportamelodyorrhythmthatisempty.

Solution:Makesuretheblockcontainsnotes,thenclickExportagain.

Can’tuse____asaname PicoBlocksdoesnotallowthatwordasaname.Numbers,namesstartingwith%or[,andexistingwordsareconsideredinvalid.

Solution:Typeanothername.

Communicationproblem TherewasacommunicationproblemwhilePicoBlockswasdownloadingdatatoyourCricket.

Solution:MakesurethattheBeamerandtheCricketarefacingeachother,thentryagain.IftheCricket’syellowantennalightskeepflashingevenwhenyouarenotdownloading,theCricketisprobablyreceivinginfraredinterferencefromamonitororotherdevice.ShieldtheCricketfromthemonitor.Formoreinformation,seewww.picocricket.com/troubleshooting

Missinginputto_______ One(ormore)oftheblocksrequiresinput.

Solution:Checkthateveryblockhassomethingattachedonitsrightsidewhenrequired.(Youcantellbytheshapeofablockwhetherittakesaninput.)

Forexample,displayneedsanumber(orothervalue)attachedasaninput:

display 100

Repeatrequiresanumbervalueatthetopright.Italsorequiresplusoneormoreblocksunderits“arm”torepeat:

repeat

chirp

10

Tip:Tocheckifablockneedsinputs,clickontheblockwiththe

Helptool ??

Page 49: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference ��

Error Message Explanation

Idon’tknowhowto______ PicoBlockstriedtorunanamethatdoesn’texist.

Solution:Ifyounameastack,thenPicoBlockscreatesablockwiththatname.Toruntheblock,youneedtokeepthenamedstackintheWorkspace,soPicoBlocksknowswhattodo.

Thename____alreadyexists Thereisalreadyanexistingblockwiththesamename.

Solution:Typeanothername.

Numberblockdoesn’tlike_____

Youtypedaninvalidcharacterin

Solution:Typeonlynumbers.

Projectcontainstoomanyblocks

Yourprojectcontainstoomanyblocks.

Solution:Deleteallstacks,melodiesandrhythmsthatarenotbeingused.

Toomanyblocksinthestack Thestackcontainstoomanyblocks(andusesuptoomuchmemory).

Solution:Usearepeattodomorewithfewerblocks.Or,placea onthetopofthestack,andclickonittotypeinaname.

Toomanymusicblocks:Limitof24

Youhavemademorethanthemaximumnumberofmusicblocks.Themaximumnumberofmelodiesandrhythmsis24blocks.

Solution:Deletesomeofthemelodyorrhythmblockssothattheprojecthasnomorethan24total.

Toomanynotesforonemusicblock

Thecurrentmelodyorrhythmistoolong.

Solution:Dividethemelodyorrhythmintotwoblocks.Todothis,firstcopythecurrentmusicblock.Inthisblock,deletethesecondhalfofthenotes.Intheotherblock,deletethefirsthalfofthenotes.Nowyoucanusethesetwoblockstogethertoplaytheentiresequence.

waituntilneedsinput Thewaituntilblockneedsaninputblockthatfits.

Solution:Attachablockthatfitsontotherightsideofthewaituntilblock.

Examples:

waituntil loud?

or >waituntil 50 brightness

Page 50: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference�0

Error Message Explanation

Youcan’tcopyanemptymusicblock

Youtriedtocopyamelodyorrhythmthatisempty.

Solution:Addnotes,thencopytheblock.

Youcan’tnameastack______

Thenametypedonthe containsinvalidcharacters.Itcannotcontainthefollowingcharacters:.%“+-*/][oraspace.Numberscanonlybeusedincombinationwithletters.

Solution:Typelettersonthe

Youdon’tsaywhattodowith________

PicoBlockstriedtorunablockthatreturnsavalue,buttherewasnoblockattachedtoreceivethatvalue.

Solution:Attachablockthatwillfitthatshape(andreceivethevalue).Forexample:

touch?waituntil

Text-Only Error Messages ThefollowingerrormessagesonlyappearwhenusingthePicoBlocksTextLanguage.

Error Message Explanation

_______:ablockcan’thavemorethan3inputs

Youcan’tmakeablockwithmorethan3inputs.

Solution:Storetheothervaluesasglobalvariables,andusethenamesofthesevariablesinyourprogram.Formoreinformation,seeGlobalVariablesinthePicoBlocksTextLanguagesectionofthisreferenceguide.

______hasnovalue PicoBlockscouldnotfindavalueforthespecifiedname.

Solution:IntheTextArea,checkthatyouhavecorrectlytypedthenameoftheinput.Inputsshouldhaveacolonprecedingthem,butglobalvariablesshouldnot.

_______:outputblockcanonlyhave1input

Ablockthatoutputscanonlyhave1input.

Solution:Storetheothervaluesasglobalvariables,andusethenamesofthesevariablesinyourprogram.Formoreinformation,seeGlobalVariablesinthePicoBlocksTextLanguagesectionofthisreferenceguide.

()error

misplaced)

Aparenthesisismissingormisplaced.

Solution:Checkthatthereareanequalnumberofopenandclosedparenthesis(),andthattheyarecorrectlyplaced.

Page 51: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference �1

Error Message Explanation

Can’tnameaglobal_______ Youneedtotypeinadifferentnamefortheglobalvariable.

Solution:Useonlylettersandnumbersasnamesforglobalvariables.SeeGlobalVariablesinthePicoBlocksTextLanguagesectionofthisreferenceguideformoreinformation.

Can’tuse_____asnameofaninput

PicoBlocksdoesn’tlikenumbersasthenameofaninput.

Solution:Youneedtotypeinadifferentnamefortheinput.Avoidusingnumbersasinput.Also,makesuretoputacolonbeforethenameoftheinput.

Forexample:blockmydance:turnsrepeat:turns[motoronfor10reverse]end

Missing[Missing]

Thereisamissingbracket:]or[

Solution:Makesurethereareanequalnumberofopenandclosedbrackets.

MissingnameaftertoMissingnameafterblockMissingnameafterbblock

Solution:Thewordsto,block,andbblockneedtobefollowedbyavalidname.Forexample:blockmylightssetlightcolor60wait10lightoffend

Nooutputfrom_____ Thewordorblockindicateddoesnotprovideoutput.

Solution:Makesureeveryblockhassomethingattachedonitsrightsidewhenrequired.SeethePicoBlocksTextLanguagesectionformoreonhowtouseoutput.

Toomanyglobals Therearetoomanyglobalvariablesintheproject.Themaximumnumberofvariablesis7(includingbox1andbox2).

Solution:Deletesomeoftheglobalvariablessothattheprojecthasnomorethan7total.

waituntilneedsalistasinput. waituntilneedsalistasinput.

Solution:Addalistinbracketsafterwaituntil

Forexample: waituntil[touch?] chirp

Page 52: PicoCricket Reference Guidepicocricket.com/pdfs/Reference_V1.pdf · The PicoCricket family includes the following parts: ... , the indicator lights in the antennas will flash yellow

PicoBlocks - Reference�2

Error Message Explanation

make needsalocalvariable Makeneedstobefollowedbythenameforalocalvariable.

Solution:Checkthatthewordaftermakehasaquotationmarkbeforeit,andisalocalvariable.

Forexample:blockfastlight:nsetlightcolor:nmake“n:n/10wait:nlightoffend