You are on page 1of 4

InthepicturebelowisourbasicmotorblockwithinportsBandC.

Thisblockcontrolsthe
motorsthatpowerthewheels.TheBandCreferencetheportstowhichthemotorsare
connected.Themotorblocktellsyouthe
directioninwhichtheaxisturns,itsduration,
poweraswellasthemotorsitsconnectedto.

Thefirstofthethreepicturesbelowisthatof
themotorattributebar.Thisallowsyouto
controlthedifferentpartsofyourmotor
includingdirection,steering,duration,power,
aswellastheactionthatcomesafter.

Thesecondpicturebelowistheattributebar
ofasensor,morespecificallytheultrasonic
sensor.Thisparticularsensorsendsout
soundandreceivesitasafteritbouncesoff
ofanearobject.Itthenusestheinformation
giventoitbythatreactiontocalculate
distance.Theultrasonicattributebarallows
foryoutocontrolthedistanceinwhichit
wantstherobottorespondaswellasthe
porttowhichitisconnected.

Theattributebarrightaboveistheoneusedforthesoundsensor.Thissensorusessoundto
triggeranaction.Thesensorreceivessoundanddeterminedonthedecimalatwhichitreads
itmayreact.Theattributebarallowsyourtodecideuponatwhichdecimaltherobotwillreact.

Forourfirstprogrammingchallengewehadtomoveourrobotsexactlytenfeet.FirstI
neededtofigureouthowfartherobotwentinonefullrotationofthewheel.SoIfoundthat
thewheelsdiameterequals2.25inches.Ithenmultipliedthatnumberbypitofigureoutits
circumferencewhichwasroughly7.06858inches.Ithenfiguredoutthethereare120inches
intenfeet,soIdivided120bythecircumferenceofthewheel,7.06858,andcameupwith
16.97,whichIroundedto17.Thisnumbergavemethenumberofrotationsneedtogoten
feet.SoIsetthenumberofrotationsinmyprogramto17andwassuccessfulinmytaskof
movingmyrobottenfeet.

Thesecondchallengewastomovetherobotwithinafewcmofawallwithouttouchingit.
FirstIhadtofigureoutthedistancebetweenthefrontoftherobotandtheultrasoundsensor,
whichequalledroughly15cm.Then,Ifiguredouttheaspacingbetweenthebackofthewall
andthefrontofapvcpipethatwasattached,whichIthoughttobeabout4cm.Ithenadded
thosetwofigurestogetherandcameupwiththedistancebetweenthesensorandthewall.I
addedtwomorecmtoatotalof19forcushion,thenplugged21intomyprogram.Isetitso
thatoncethesensorbecamewithin21cmofthewallitwouldstop.

ProgrammingchallengeNotes
MeasureofWheeldiameter2.25inches
2.25(pi)=7.06858inches(circumference)
10feet=120inches
120/7.06858=16.97apIprox.17(rotations)
distanceofsensorfromfrontofbot=15cm
distanceofpvcfrombackboardapprox.4cm
stoppingdistance21cm

LightSensor:
Thelightsensorreadslightbysendlightoutthenmeasuringhowmuchlightisreflected
Onwhitetapethelightsensorrecords72%reflection
Onagraymatthelightsensormeasured43%reflection
TheBlocktotheleftisthatoftheLightSensor.Theattributebarbelow
allowsyoutocontrolwhetherornotthesensorgenerateslightaswell
asatwhich%ofreflectionitreacts.

Theprogramtothe
leftallowedmyrobot
tomoveforwarduntil
ithitsthewhitetape.
Onceitmeasureda
reflectionabove69it
stoppedandthen
shouted.Thesecondprogramtothe
leftismeanttoallowarobottofollowa
whiteline.Theproblemwiththis
programisthatoncetherobotwentoff
thewhitelinetheBmotorwouldbegin
togoandtheCmotorwouldcontinue
aswellmakingtherobotgoina
straightline.Theprogrambelow
correctedthatmistake.Thisprogram
madeitsowhenevertherobotwason
thewhitelinemotorCwouldstopand
go,thenonceitwentoffthelinemotor
Bstoppedandwent.Oncetherobot
wasbackonthewhitelinemotorC
wouldgoagain.
Thisrepeating
patternallowed
therobotto
followawhite
lineinany
direction.

Parallel
Processing:
Theactof
processingtwo
actionsatone
time(Parallel
processingis
the
simultaneous
useofmorethanoneCPUorprocessorcoretoexecutea
programormultiplecomputationalthreads.)

Thesensorblocktotheleftisthatofthetouchsensor.

Thetouchsensorallowstotorobottoprocesswhenitisbeingpressuredinagivendirection.
Whenthesensoriseitherpressed,releasedorbumpedtherobotwillreact.Theattributebar
belowallowsyoutodecidewhetherornottherobotwillreactwhenthetouchsensoris
pressed,releasedorbumped.

Theseprograms
totheleftrun
simultaneously,
thisallowsfor
therobotto
havetwotwo
sensorsrunning
atthesame
time.

You might also like