robot revolution - smith learning · scratch planning sheet what should the program do: variables:...
TRANSCRIPT
Summer Camp 2016Wichita State University
smithlearning.com/robotics
SCRATCH 2Robot Revolution
- 2 -
Output Ports (for motors)defaults are ____ and ____
USB Portconnect to computer
Input Ports (for sensors)defaults are
“The Sensor Line Up”
_________, _________, _________, ____________
ENTER
BACK
SCROLL
Touch Sensor
Sound Sensor
Light Sensor
Ultrasonic Sensor
Color Sensor
Motor
- 3 -
Configuring a Sensor http
://en
chan
ting.
robo
tclu
b.ab
.ca
Supp
ose
we
have
an
NXT
with
a li
ght
sens
or c
onne
cted
on
port
3.
How
do
we
tell
Ench
antin
g th
is?
0
(tell your NXT what is plugged into it, and where)
1. C
lick
on th
e “S
ensi
ng” p
alet
te.
2. C
lick
on th
e ÒC
onÞg
ure
Sens
orsÓ
bu
tton.
A d
ialo
g co
mes
up.
3. F
ind
the
light
sen
sor
conÞ
gura
tion
bloc
k on
th
e le
ft-ha
nd s
ide
of th
e di
alog
. D
rag
it to
“S
enso
r Por
t 3” a
nd
drop
it th
ere.
4. C
hoos
e w
hat s
ort o
f lig
ht s
enso
r you
hav
e.
5. O
ptio
nally
, giv
e it
a de
scrip
tive
nam
e.6. P
ress
“OK”
.
7. Y
ou n
ow h
ave
new
blo
cks
to u
se!
- 4 -
Morse Key
Sele
ct t
he
pal
ette
, and
clic
k on
the
b
utto
n [it
is a
bove
all
the
light
blu
e bl
ocks
].
ConÞ
gure
a t
ouch
sen
sor,
like
this:
Mak
e su
re t
hat
your
tou
ch s
enso
r is
on p
ort
1 on
the
act
ual r
obot
.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n on
the
robo
t. P
ress
and
rele
ase
the
touc
h se
nsor
. W
hat
happ
ens?
GET
READ
Y
TRY
THIS
COD
E
DO I
T!
Wha
t w
ould
hap
pen
if yo
u ch
ange
d th
e no
te o
r the
du
ratio
n?
Whe
re c
ould
you
use
o
r ?
GO F
ARTH
ERYO
U NE
EDAn
NXT
with
a to
uch
sens
or
conn
ecte
d to
por
t 1.
Pres
s a
butto
n to
mak
e a
soun
d.
Morse Key
http
://en
chan
ting.
robo
tclu
b.ab
.ca
1
Nam
e it.
Beep!
- 5 -
Morse Key
Sele
ct t
he
pal
ette
, and
clic
k on
the
b
utto
n [it
is a
bove
all
the
light
blu
e bl
ocks
].
ConÞ
gure
a t
ouch
sen
sor,
like
this:
Mak
e su
re t
hat
your
tou
ch s
enso
r is
on p
ort
1 on
the
act
ual r
obot
.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n on
the
robo
t. P
ress
and
rele
ase
the
touc
h se
nsor
. W
hat
happ
ens?
GET
READ
Y
TRY
THIS
COD
E
DO I
T!
Wha
t w
ould
hap
pen
if yo
u ch
ange
d th
e no
te o
r the
du
ratio
n?
Whe
re c
ould
you
use
o
r ?
GO F
ARTH
ERYO
U NE
EDAn
NXT
with
a to
uch
sens
or
conn
ecte
d to
por
t 1.
Pres
s a
butto
n to
mak
e a
soun
d.
Morse Key
http
://en
chan
ting.
robo
tclu
b.ab
.ca
1
Nam
e it.
Beep!
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 6 -
Range Finder
From
the
p
alet
te, c
hoos
e th
e b
utto
n.
ConÞ
gure
a u
ltras
onic
sen
sor.
Mak
e su
re t
he p
ort
you
conÞ
gure
it fo
r m
atch
es t
he p
ort
the
real
ultr
ason
ic s
enso
r is
plug
ged
into
!
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n.
Poin
t th
e ul
tras
onic
sen
sor a
t di
ffer
ent
obje
cts.
W
hat
do y
ou s
ee o
n th
e sc
reen
?
GET
READ
Y
TRY
THIS
COD
E
DO I
T!
Wha
t ar
e th
e la
rges
t an
d sm
alle
st v
alue
s yo
u se
e?Ar
e th
ere
any
gaps
whe
re y
ou g
et n
o nu
mbe
rs?
GO F
ARTH
ER
YOU
NEED
An N
XT w
ith a
n ul
traso
nic
sens
or
conn
ecte
d to
por
t 4.
See
how
far a
way
som
ethi
ng is
.
Range Finder
http
://en
chan
ting.
robo
tclu
b.ab
.ca
2
- 7 -
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 8 -
Sound Meter
From
the
p
alet
te, c
hoos
e th
e b
utto
n.
ConÞ
gure
a s
ound
sen
sor.
Pain
t a
new
cos
tum
e fo
r the
spr
ite --
mak
e it
a do
t!
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n.
Whi
sper
, tal
k, s
ing,
sho
ut, o
r blo
w o
n th
e so
und
sens
or.
GET
READ
Y
TRY
THIS
COD
E
DO I
T!
YOU
NEED
An N
XT w
ith a
sou
nd s
enso
r*
conn
ecte
d to
por
t 2.
* Not
incl
uded
in a
ll N
XT s
ets.
Cre
ate
a so
und-
leve
l met
er.
Sound Meter
http
://en
chan
ting.
robo
tclu
b.ab
.ca
3
Draw
a
gaug
e on
the
ba
ckgr
ound
.
Adju
st h
ow fa
r the
met
er
mov
es b
ack
and
fort
h.
GO F
ARTH
ER
quiet
LOUD!
- 9 -
Sound Meter
From
the
p
alet
te, c
hoos
e th
e b
utto
n.
ConÞ
gure
a s
ound
sen
sor.
Pain
t a
new
cos
tum
e fo
r the
spr
ite --
mak
e it
a do
t!
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n.
Whi
sper
, tal
k, s
ing,
sho
ut, o
r blo
w o
n th
e so
und
sens
or.
GET
READ
Y
TRY
THIS
COD
E
DO I
T!
YOU
NEED
An N
XT w
ith a
sou
nd s
enso
r*
conn
ecte
d to
por
t 2.
* Not
incl
uded
in a
ll N
XT s
ets.
Cre
ate
a so
und-
leve
l met
er.
Sound Meter
http
://en
chan
ting.
robo
tclu
b.ab
.ca
3
Draw
a
gaug
e on
the
ba
ckgr
ound
.
Adju
st h
ow fa
r the
met
er
mov
es b
ack
and
fort
h.
GO F
ARTH
ER
quiet
LOUD!
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 10 -
Differential Drive
http
://en
chan
ting.
robo
tclu
b.ab
.ca
From
the
p
alet
te, c
hoos
e th
e b
utto
n. C
onÞg
ure
a di
ffer
entia
l driv
e.
The
Þrst
num
ber e
mbo
ssed
on
a LE
GO
tire
is th
e tir
eÕs
diam
eter
in
milli
met
ers.
Thi
s tir
e is
56
mm
acr
oss.
The
track
wid
th is
how
far a
part
the
whe
els
are.
Mea
sure
from
a p
lace
on
the
left
whe
el to
that
sam
e pl
ace
on
the
right
whe
el.
Her
e, m
easu
ring
from
th
e le
ft-m
ost p
oint
of t
he le
ft w
heel
to
the
left-
mos
t poi
nt o
f the
righ
t whe
el,
the
track
wid
th is
abo
ut 9
.4 c
m.
Port A
Right motor
Port C
Left motor
9.4
cm 4
If yo
u te
ll th
e ro
bot t
o dr
ive
forw
ards
an
d it
goes
bac
kwar
ds, s
wap
the
dire
ctio
n th
at y
ouÕv
e co
nÞgu
red
the
mot
ors
to d
rive
in th
e dr
ive
type
.
The
robo
t nee
ds
to k
now
whi
ch
ports
the
left
and
right
mot
ors
are
on s
o it
can
stee
r!
If yo
ur ro
bot h
as tw
o w
heel
s, it
is u
sing
a
diffe
rent
ial d
rive!
(lets your two-wheel robot drive around)
- 11 -
Activ
ities
For e
ach
path
bel
ow, p
rogr
am y
our r
obot
to d
rive
as in
dica
ted:
Piaz
za D
iscus
sion
& So
lutio
n(s
ee “W
hat i
s Pi
azza
?” to
lear
n ab
out t
his
feat
ure)
Ques
tion
For p
art 2
, by
how
man
y de
gree
s sh
ould
eac
h m
otor
rota
te in
ord
er to
turn
the
robo
t 180
°? (a
ssum
ing
“sta
ndar
d ca
r” c
onÞg
urat
ion)
Piaz
za D
iscus
sion
& So
lutio
n
3Ri
ght t
urns
4Ri
ght t
urn,
le
ft tu
rn5
Cur
ve ri
ght
6C
ircle
14
Activ
ities
& Qu
estio
ns 2Fo
rwar
d,
turn
180
û, fo
rwar
d1
Forw
ard,
re
vers
e
Que
stio
n
- 12 -
Square Dance
From
the
p
alet
te, c
hoos
e th
e
butt
on.
ConÞ
gure
a d
iffer
entia
l driv
e, u
sing
the
inst
ruct
ions
on
Card
#4
. M
easu
re n
umbe
rs t
o m
atch
you
r rob
ot.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n. U
nplu
g th
e US
B ca
ble
and
plac
e th
e ro
bot
whe
re y
ou w
ant
it to
st
art.
Pre
ss t
he o
rang
e Òe
nter
Ó bu
tton
on
the
NXT.
Does
the
robo
t Òd
ance
Ó in
a s
quar
e? (
Is it
conÞ
gure
d pr
oper
ly?)
No
te t
hat
youÕ
ll ne
ver g
et 1
00%
acc
urat
e m
otio
n.
Pres
s th
e or
ange
Òen
terÓ
and
dar
k gr
ey Ò
exitÓ
but
tons
on
the
NXT
to
quit
the
prog
ram
bef
ore
plug
ging
it b
ack
into
the
com
pute
r.GET
READ
Y
TRY
THIS
COD
E
DO I
T!
Wha
t ot
her s
hape
s an
d pa
tter
ns c
ould
you
mak
e th
e ro
bot
Òdan
ceÓ?
Cou
ld y
ou h
ave
one
robo
t Òd
ance
Ó a
squa
re in
side
a sq
uare
bei
ng Ò
danc
edÓ
by a
noth
er ro
bot,
at d
iffer
ent
spee
ds?
GO F
ARTH
ER
YOU
NEED
An N
XT w
ith tw
o dr
ivin
g w
heel
s.
Driv
e in
a s
quar
e.
Square Dance
http
://en
chan
ting.
robo
tclu
b.ab
.ca
5
- 13 -
Square Dance
From
the
p
alet
te, c
hoos
e th
e
butt
on.
ConÞ
gure
a d
iffer
entia
l driv
e, u
sing
the
inst
ruct
ions
on
Card
#4
. M
easu
re n
umbe
rs t
o m
atch
you
r rob
ot.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n. U
nplu
g th
e US
B ca
ble
and
plac
e th
e ro
bot
whe
re y
ou w
ant
it to
st
art.
Pre
ss t
he o
rang
e Òe
nter
Ó bu
tton
on
the
NXT.
Does
the
robo
t Òd
ance
Ó in
a s
quar
e? (
Is it
conÞ
gure
d pr
oper
ly?)
No
te t
hat
youÕ
ll ne
ver g
et 1
00%
acc
urat
e m
otio
n.
Pres
s th
e or
ange
Òen
terÓ
and
dar
k gr
ey Ò
exitÓ
but
tons
on
the
NXT
to
quit
the
prog
ram
bef
ore
plug
ging
it b
ack
into
the
com
pute
r.GET
READ
Y
TRY
THIS
COD
E
DO I
T!
Wha
t ot
her s
hape
s an
d pa
tter
ns c
ould
you
mak
e th
e ro
bot
Òdan
ceÓ?
Cou
ld y
ou h
ave
one
robo
t Òd
ance
Ó a
squa
re in
side
a sq
uare
bei
ng Ò
danc
edÓ
by a
noth
er ro
bot,
at d
iffer
ent
spee
ds?
GO F
ARTH
ER
YOU
NEED
An N
XT w
ith tw
o dr
ivin
g w
heel
s.
Driv
e in
a s
quar
e.
Square Dance
http
://en
chan
ting.
robo
tclu
b.ab
.ca
5
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 14 -
Crash Test
➔
as
on C
ard
#4.
➔
. Co
nÞgu
re a
tou
ch s
enso
r for
use
as
a bu
mpe
r.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n. U
nplu
g th
e US
B ca
ble
and
plac
e th
e ro
bot
whe
re y
ou w
ant
it to
st
art.
Pre
ss t
he o
rang
e Òe
nter
Ó bu
tton
on
the
NXT.
The
robo
t dr
ives
unt
il it
hits
som
ethi
ng.
Pick
it u
p an
d pr
ess
the
Òent
erÓ
butt
on a
gain
. It
driv
es u
ntil
it hi
ts s
omet
hing
.
GET
READ
Y
TRY
THIS
COD
E
DO I
T!
Can
you
mak
e th
e ro
bot
say
som
ethi
ng w
hen
it hi
ts a
w
all,
such
as,
ÒOu
ch, m
y no
seÓ
or Ò
Ooof
Ó? C
ould
you
dr
aw e
yes
on it
and
mak
e it
win
ce?
Ho
w w
ould
you
mak
e th
e ro
bot
expl
ore
a ro
om?
Try
it o
ut!
GO F
ARTH
ER
YOU
NEED
An N
XT w
ith tw
o dr
ivin
g w
heel
s an
d a
bum
per (
touc
h se
nsor
) on
port
1.
Driv
e in
to a
wal
l and
then
sto
p.
Crash Test
http
://en
chan
ting.
robo
tclu
b.ab
.ca
6
- 15 -
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 16 -
Shy Puppy
➔
as
on C
ard
#4.
➔
. Co
nÞgu
re a
n ul
tras
onic
sen
sor.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n. U
nplu
g th
e US
B ca
ble
and
pres
s th
e or
ange
Òen
terÓ
but
ton
on t
he
NXT.
Try
wal
king
aw
ay fr
om t
he ro
bot.
Do
es it
follo
w?
Try
goi
ng t
owar
ds
it. D
oes
it sh
y aw
ay?
Doe
s it
ever
sta
nd s
till?
GET
READ
Y
TRY
THIS
COD
EDO
IT!
Wha
t w
ould
hap
pen
if yo
u m
ade
the
robo
t tu
rn?
Wha
t do
tw
o or
mor
e ro
bots
to
geth
er d
o?
Add
a fa
ce t
o th
e ro
bot,
mak
e it
Òspe
akÓ,
or d
ress
it u
p!GO F
ARTH
ER
YOU
NEED
An N
XT w
ith tw
o dr
ivin
g w
heel
s an
d an
ul
traso
nic
sens
or p
oint
ing
forw
ards
Rob
ot fo
llow
s yo
u ar
ound
and
w
ants
to b
e cl
ose,
but
not
too
clos
e!
Shy Puppy
http
://en
chan
ting.
robo
tclu
b.ab
.ca
8
Too far!
Too close!
Just righ
t!
- 17 -
Shy Puppy
➔
as
on C
ard
#4.
➔
. Co
nÞgu
re a
n ul
tras
onic
sen
sor.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n. U
nplu
g th
e US
B ca
ble
and
pres
s th
e or
ange
Òen
terÓ
but
ton
on t
he
NXT.
Try
wal
king
aw
ay fr
om t
he ro
bot.
Do
es it
follo
w?
Try
goi
ng t
owar
ds
it. D
oes
it sh
y aw
ay?
Doe
s it
ever
sta
nd s
till?
GET
READ
Y
TRY
THIS
COD
EDO
IT!
Wha
t w
ould
hap
pen
if yo
u m
ade
the
robo
t tu
rn?
Wha
t do
tw
o or
mor
e ro
bots
to
geth
er d
o?
Add
a fa
ce t
o th
e ro
bot,
mak
e it
Òspe
akÓ,
or d
ress
it u
p!GO F
ARTH
ER
YOU
NEED
An N
XT w
ith tw
o dr
ivin
g w
heel
s an
d an
ul
traso
nic
sens
or p
oint
ing
forw
ards
Rob
ot fo
llow
s yo
u ar
ound
and
w
ants
to b
e cl
ose,
but
not
too
clos
e!
Shy Puppy
http
://en
chan
ting.
robo
tclu
b.ab
.ca
8
Too far!
Too close!
Just righ
t!
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 18 -
Sparkline
In
, cho
ose
the
but
ton.
Con
Þgur
e a
light
or c
olou
r se
nsor
, cho
osin
g th
e on
e yo
u ha
ve.
GET
READ
Y
TRY
THIS
COD
E
YOU
NEED
An N
XT w
ith a
ligh
t or c
olou
r se
nsor
on
port
3.
Gra
ph a
cha
ngin
g va
lue.
Sparkline
http
://en
chan
ting.
robo
tclu
b.ab
.ca
9
Clic
k th
e t
o st
art.
M
ove
the
light
sen
sor
over
diff
eren
t co
lour
s an
d sh
ades
. M
ove
it cl
oser
and
fart
her f
rom
a
surf
ace.
Poi
nt it
at
a lig
ht.
Chan
ge
the
angl
e. W
hat
happ
ens?
DO I
T!W
hat
happ
ens
if yo
u ad
d in
the
aut
o-ca
libra
tion
bloc
ks?
Tr
y dr
awin
g a
whi
te li
ne o
n a
blac
k ba
ckgr
ound
. Ch
ange
the
lam
p co
lour
.
GO F
ARTH
ER
- 19 -
Sparkline
In
, cho
ose
the
but
ton.
Con
Þgur
e a
light
or c
olou
r se
nsor
, cho
osin
g th
e on
e yo
u ha
ve.
GET
READ
Y
TRY
THIS
COD
E
YOU
NEED
An N
XT w
ith a
ligh
t or c
olou
r se
nsor
on
port
3.
Gra
ph a
cha
ngin
g va
lue.
Sparkline
http
://en
chan
ting.
robo
tclu
b.ab
.ca
9
Clic
k th
e t
o st
art.
M
ove
the
light
sen
sor
over
diff
eren
t co
lour
s an
d sh
ades
. M
ove
it cl
oser
and
fart
her f
rom
a
surf
ace.
Poi
nt it
at
a lig
ht.
Chan
ge
the
angl
e. W
hat
happ
ens?
DO I
T!W
hat
happ
ens
if yo
u ad
d in
the
aut
o-ca
libra
tion
bloc
ks?
Tr
y dr
awin
g a
whi
te li
ne o
n a
blac
k ba
ckgr
ound
. Ch
ange
the
lam
p co
lour
.
GO F
ARTH
ER
Activ
ities
Atta
ch th
e lig
ht s
enso
r to
your
robo
t for
the
follo
win
g ac
tiviti
es.
The
light
sen
sor s
houl
d be
app
roxi
mat
ely
1 cm
from
the
surfa
ce
your
robo
t is
sitti
ng o
n.
Rem
embe
r tha
t you
will
need
to a
uto-
calib
rate
the
light
sen
sor a
s pa
rt of
you
r pro
gram
(see
Aut
o-C
alib
ratio
n).
So lo
ng a
s yo
u ru
n th
e au
to-c
alib
ratio
n ev
ery
time
the
prog
ram
st
arts
, you
r pro
gram
can
be
reus
ed in
diff
eren
t lig
htin
g co
nditi
ons
with
out m
odiÞ
catio
n!
1.Dr
ive
forw
ard
until
a b
lack
line
is d
etec
ted,
then
sto
p.2.
Driv
e fo
rwar
d un
til a
bla
ck li
ne is
det
ecte
d, th
en tu
rn a
roun
d an
d co
ntin
ue d
rivin
g (re
peat
beh
avio
ur c
ontin
uous
ly).
3.Dr
ive
quic
kly
whe
n ov
er a
brig
ht s
urfa
ce, s
low
ly w
hen
over
a
dark
sur
face
.4.
Driv
e fo
rwar
d, p
rint t
he b
right
ness
leve
l to
the
scre
en e
very
se
cond
(rep
eat b
ehav
iour
con
tinuo
usly
).Pi
azza
Disc
ussio
n &
Solu
tion
Ques
tion
For p
art 2
, wha
t sta
tem
ent w
ould
you
use
to d
ecid
e w
hen
the
robo
t sho
uld
turn
aro
und?
Piaz
za D
iscus
sion
& So
lutio
n
22
Activ
ities
& Qu
estio
nsAu
to-C
alibr
ation
Her
e’s
an e
xam
ple
of a
n au
to-c
alib
ratio
n te
chni
que
that
can
be
used
at t
he
star
t of a
pro
gram
:
The
“raw
” brig
htne
ss le
vel f
rom
the
LEG
O® L
ight
Sen
sor v
arie
s de
pend
ing
on
the
light
ing
cond
ition
s yo
u ar
e w
orki
ng w
ith. T
his
can
mak
e it
diffi
cult
to u
se
your
pro
gram
s in
diff
eren
t lig
htin
g co
nditi
ons,
for e
xam
ple
mov
ing
from
insi
de
to o
utsi
de.
Auto
-cal
ibra
tion
allo
ws
you
to s
how
the
robo
t the
diff
eren
t brig
htne
ss le
vels
it
can
expe
ct to
see
in it
s cu
rrent
con
ditio
ns. I
t will
then
tran
slat
e th
e ra
w
brig
htne
ss v
alue
s su
ch th
at th
e da
rkes
t are
a it
was
sho
wn
prod
uces
0, a
nd th
e br
ight
est p
rodu
ces
100.
All
the
shad
es in
bet
wee
n w
ill fa
ll so
mew
here
be
twee
n 0
and
100.
Figu
re 2
.1 A
uto-
Cal
ibra
tion
Exam
ple
Que
stio
n
Line
follo
win
g is
an
impo
rtant
par
t of y
our p
rogr
amm
ing
tool
box
whe
n us
ing
the
LEG
O® N
XT. I
t allo
ws
you
to c
reat
e pa
ths
thro
ugh
the
envi
ronm
ent f
or y
our r
obot
to fo
llow,
mea
ning
that
you
r rob
ot
can
perfo
rm ta
sks
that
requ
ire b
asic
nav
igat
ion.
The
re a
re m
any
diffe
rent
way
s of
cre
atin
g a
line
follo
wer
dep
endi
ng o
n ho
w m
any
light
sen
sors
you
hav
e av
aila
ble,
how
ever
in th
is a
ctiv
ity it
’s as
sum
ed th
at y
ou o
nly
have
one
.
Let’s
say
we
wan
t to
follo
w a
bla
ck li
ne, l
ike
the
one
pict
ured
ab
ove.
You
mig
ht th
ink
that
the
way
to a
chie
ve th
is w
ould
be
to
ensu
re th
at th
e ro
bot’s
ligh
t sen
sor i
s al
way
s di
rect
ly o
ver a
bla
ck
surfa
ce.
How
ever
, the
re’s
a pr
oble
m w
ith th
is s
trate
gy:
Piaz
za D
iscus
sion
The
solu
tion
is to
inst
ead
follo
w th
e ed
ge o
f the
bla
ck li
ne, r
athe
r th
an th
e lin
e its
elf.
Eith
er e
dge
is Þ
ne, w
eÕll
use
the
low
er e
dge
in
this
exa
mpl
e.
24
Activ
ities
& Qu
estio
ns
Figu
re 2
.2 F
ollo
win
g a
Blac
k Li
ne
Figu
re 2
.3 F
ollo
win
g th
e Ed
ge o
f a L
ine
Ques
tion
AW
hat h
appe
ns w
hen
we
dete
ct th
e w
hite
sur
face
?H
ow d
o w
e kn
ow if
we’
ve v
eere
d off
to th
e le
ft or
the
right
?
Reve
al so
lutio
n on
Piaz
za
Activ
ities
Atta
ch th
e lig
ht s
enso
r to
your
robo
t for
the
follo
win
g ac
tiviti
es.
The
light
sen
sor s
houl
d be
app
roxi
mat
ely
1 cm
from
the
surfa
ce
your
robo
t is
sitti
ng o
n.
Rem
embe
r tha
t you
will
need
to a
uto-
calib
rate
the
light
sen
sor a
s pa
rt of
you
r pro
gram
(see
Aut
o-C
alib
ratio
n).
So lo
ng a
s yo
u ru
n th
e au
to-c
alib
ratio
n ev
ery
time
the
prog
ram
st
arts
, you
r pro
gram
can
be
reus
ed in
diff
eren
t lig
htin
g co
nditi
ons
with
out m
odiÞ
catio
n!
1.Dr
ive
forw
ard
until
a b
lack
line
is d
etec
ted,
then
sto
p.2.
Driv
e fo
rwar
d un
til a
bla
ck li
ne is
det
ecte
d, th
en tu
rn a
roun
d an
d co
ntin
ue d
rivin
g (re
peat
beh
avio
ur c
ontin
uous
ly).
3.Dr
ive
quic
kly
whe
n ov
er a
brig
ht s
urfa
ce, s
low
ly w
hen
over
a
dark
sur
face
.4.
Driv
e fo
rwar
d, p
rint t
he b
right
ness
leve
l to
the
scre
en e
very
se
cond
(rep
eat b
ehav
iour
con
tinuo
usly
).Pi
azza
Disc
ussio
n &
Solu
tion
Ques
tion
For p
art 2
, wha
t sta
tem
ent w
ould
you
use
to d
ecid
e w
hen
the
robo
t sho
uld
turn
aro
und?
Piaz
za D
iscus
sion
& So
lutio
n
22
Activ
ities
& Qu
estio
nsAu
to-C
alibr
ation
Her
e’s
an e
xam
ple
of a
n au
to-c
alib
ratio
n te
chni
que
that
can
be
used
at t
he
star
t of a
pro
gram
:
The
“raw
” brig
htne
ss le
vel f
rom
the
LEG
O® L
ight
Sen
sor v
arie
s de
pend
ing
on
the
light
ing
cond
ition
s yo
u ar
e w
orki
ng w
ith. T
his
can
mak
e it
diffi
cult
to u
se
your
pro
gram
s in
diff
eren
t lig
htin
g co
nditi
ons,
for e
xam
ple
mov
ing
from
insi
de
to o
utsi
de.
Auto
-cal
ibra
tion
allo
ws
you
to s
how
the
robo
t the
diff
eren
t brig
htne
ss le
vels
it
can
expe
ct to
see
in it
s cu
rrent
con
ditio
ns. I
t will
then
tran
slat
e th
e ra
w
brig
htne
ss v
alue
s su
ch th
at th
e da
rkes
t are
a it
was
sho
wn
prod
uces
0, a
nd th
e br
ight
est p
rodu
ces
100.
All
the
shad
es in
bet
wee
n w
ill fa
ll so
mew
here
be
twee
n 0
and
100.
Figu
re 2
.1 A
uto-
Cal
ibra
tion
Exam
ple
Que
stio
n
Line
follo
win
g is
an
impo
rtant
par
t of y
our p
rogr
amm
ing
tool
box
whe
n us
ing
the
LEG
O® N
XT. I
t allo
ws
you
to c
reat
e pa
ths
thro
ugh
the
envi
ronm
ent f
or y
our r
obot
to fo
llow,
mea
ning
that
you
r rob
ot
can
perfo
rm ta
sks
that
requ
ire b
asic
nav
igat
ion.
The
re a
re m
any
diffe
rent
way
s of
cre
atin
g a
line
follo
wer
dep
endi
ng o
n ho
w m
any
light
sen
sors
you
hav
e av
aila
ble,
how
ever
in th
is a
ctiv
ity it
’s as
sum
ed th
at y
ou o
nly
have
one
.
Let’s
say
we
wan
t to
follo
w a
bla
ck li
ne, l
ike
the
one
pict
ured
ab
ove.
You
mig
ht th
ink
that
the
way
to a
chie
ve th
is w
ould
be
to
ensu
re th
at th
e ro
bot’s
ligh
t sen
sor i
s al
way
s di
rect
ly o
ver a
bla
ck
surfa
ce.
How
ever
, the
re’s
a pr
oble
m w
ith th
is s
trate
gy:
Piaz
za D
iscus
sion
The
solu
tion
is to
inst
ead
follo
w th
e ed
ge o
f the
bla
ck li
ne, r
athe
r th
an th
e lin
e its
elf.
Eith
er e
dge
is Þ
ne, w
eÕll
use
the
low
er e
dge
in
this
exa
mpl
e.
24
Activ
ities
& Qu
estio
ns
Figu
re 2
.2 F
ollo
win
g a
Blac
k Li
ne
Figu
re 2
.3 F
ollo
win
g th
e Ed
ge o
f a L
ine
Ques
tion
AW
hat h
appe
ns w
hen
we
dete
ct th
e w
hite
sur
face
?H
ow d
o w
e kn
ow if
we’
ve v
eere
d off
to th
e le
ft or
the
right
?
Reve
al so
lutio
n on
Piaz
za
Line
follo
win
g is
an
impo
rtant
par
t of y
our p
rogr
amm
ing
tool
box
whe
n us
ing
the
LEG
O® N
XT. I
t allo
ws
you
to c
reat
e pa
ths
thro
ugh
the
envi
ronm
ent f
or y
our r
obot
to fo
llow,
mea
ning
that
you
r rob
ot
can
perfo
rm ta
sks
that
requ
ire b
asic
nav
igat
ion.
The
re a
re m
any
diffe
rent
way
s of
cre
atin
g a
line
follo
wer
dep
endi
ng o
n ho
w m
any
light
sen
sors
you
hav
e av
aila
ble,
how
ever
in th
is a
ctiv
ity it
’s as
sum
ed th
at y
ou o
nly
have
one
.
Let’s
say
we
wan
t to
follo
w a
bla
ck li
ne, l
ike
the
one
pict
ured
ab
ove.
You
mig
ht th
ink
that
the
way
to a
chie
ve th
is w
ould
be
to
ensu
re th
at th
e ro
bot’s
ligh
t sen
sor i
s al
way
s di
rect
ly o
ver a
bla
ck
surfa
ce.
How
ever
, the
re’s
a pr
oble
m w
ith th
is s
trate
gy:
Piaz
za D
iscus
sion
The
solu
tion
is to
inst
ead
follo
w th
e ed
ge o
f the
bla
ck li
ne, r
athe
r th
an th
e lin
e its
elf.
Eith
er e
dge
is Þ
ne, w
eÕll
use
the
low
er e
dge
in
this
exa
mpl
e.
24
Activ
ities
& Qu
estio
ns
Figu
re 2
.2 F
ollo
win
g a
Blac
k Li
ne
Figu
re 2
.3 F
ollo
win
g th
e Ed
ge o
f a L
ine
Ques
tion
AW
hat h
appe
ns w
hen
we
dete
ct th
e w
hite
sur
face
?H
ow d
o w
e kn
ow if
we’
ve v
eere
d off
to th
e le
ft or
the
right
?
Reve
al so
lutio
n on
Piaz
za
- 20 -
Follow That Line!
➔
as
on C
ard
#4.
➔
. Co
nÞgu
re a
nd n
ame
a lig
ht o
r col
our s
enso
r, ch
oosin
g th
e ty
pe t
hat
mat
ches
you
r sen
sor.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n.
Unpl
ug t
he U
SB c
able
, pla
ce
the
robo
t on
or b
esid
e a
line,
an
d pr
ess
the
oran
ge Ò
ente
rÓ
butt
on o
n th
e NX
T.
Pres
s th
e da
rk g
rey
Òexi
tÓ
butt
on t
o st
op t
he ro
bot.
GET
READ
Y
TRY
THIS
COD
EDO
IT!
Wha
t ha
ppen
s if
you
adju
st t
he n
umbe
rs?
Do
es t
he li
ne-f
ollo
win
g co
urse
m
ake
a di
ffer
ence
? C
an y
ou
follo
w t
he e
dge
of a
tab
le?
W
here
is t
he b
est
plac
e to
put
yo
ur li
ght
sens
or?
Wha
t w
ould
you
do
with
a s
econ
d or
th
ird s
enso
r? D
raw
eye
s an
d m
ake
them
look
left
and
righ
t!
GO F
ARTH
ER
YOU
NEED
An N
XT w
ith tw
o dr
ivin
g w
heel
s an
d a
light
/col
our s
enso
r poi
ntin
g do
wnw
ards
.
Follo
w a
line
aro
und.
Follow That Line!
http
://en
chan
ting.
robo
tclu
b.ab
.ca
10
- 21 -
Follow That Line!
➔
as
on C
ard
#4.
➔
. Co
nÞgu
re a
nd n
ame
a lig
ht o
r col
our s
enso
r, ch
oosin
g th
e ty
pe t
hat
mat
ches
you
r sen
sor.
Clic
k th
e a
nd w
ait
for t
he p
rogr
am t
o ru
n.
Unpl
ug t
he U
SB c
able
, pla
ce
the
robo
t on
or b
esid
e a
line,
an
d pr
ess
the
oran
ge Ò
ente
rÓ
butt
on o
n th
e NX
T.
Pres
s th
e da
rk g
rey
Òexi
tÓ
butt
on t
o st
op t
he ro
bot.
GET
READ
Y
TRY
THIS
COD
EDO
IT!
Wha
t ha
ppen
s if
you
adju
st t
he n
umbe
rs?
Do
es t
he li
ne-f
ollo
win
g co
urse
m
ake
a di
ffer
ence
? C
an y
ou
follo
w t
he e
dge
of a
tab
le?
W
here
is t
he b
est
plac
e to
put
yo
ur li
ght
sens
or?
Wha
t w
ould
you
do
with
a s
econ
d or
th
ird s
enso
r? D
raw
eye
s an
d m
ake
them
look
left
and
righ
t!
GO F
ARTH
ER
YOU
NEED
An N
XT w
ith tw
o dr
ivin
g w
heel
s an
d a
light
/col
our s
enso
r poi
ntin
g do
wnw
ards
.
Follo
w a
line
aro
und.
Follow That Line!
http
://en
chan
ting.
robo
tclu
b.ab
.ca
10
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 22 -
Sumo
➔
as
on
Card
#5.
➔
. Co
nÞgu
re
an u
ltras
onic
sen
sor a
nd a
ligh
t/co
lour
se
nsor
.
Crea
te a
bun
ch o
f cos
tum
es fo
r you
r spr
ite,
usin
g th
e te
xt t
ool t
o di
spla
y th
e fo
llow
ing
wor
ds in
larg
e le
tter
s, Ò
Coun
tdow
nÓ,
ÒWan
derÓ
, ÒAt
tack
Ó, Ò
Retr
eatÓ
and
ÒPr
ess
Butt
on t
o St
artÓ
.
➔
. Cr
eate
va
riabl
es n
amed
Òne
xt a
ctio
nÓ, Ò
foe
ahea
dÓ,
and
Òsee
s ed
geÓ.
YOU
NEED
Each
com
petit
or n
eeds
an
NXT
with
two
driv
ing
whe
els,
an
ultra
soni
c se
nsor
, and
a
light
or c
olou
r sen
sor.
Push
you
r opp
onen
t out
of a
ring
.
Sumo
http
://en
chan
ting.
robo
tclu
b.ab
.ca
12A
Trig
ger
Beha
viou
r
Sees
edg
eR
etre
at
Foe
ahea
dAt
tack
Wan
der
ArbiterGE
T RE
ADY
THE
PLAN
If it
has
noth
ing
bett
er t
o do
, th
e ro
bot
wan
ders
aro
und.
If
it se
es a
foe
ahea
d of
it, t
he
robo
t at
tack
s, t
ryin
g to
pus
h th
e en
emy
out
of t
he ri
ng.
Mos
t im
port
antly
, if i
t se
es
the
edge
, the
robo
t re
trea
ts
from
it, i
n an
eff
ort
to s
tay
in
the
ring.
(card 1 of 2)
- 23 -
Sumo
➔
as
on
Card
#5.
➔
. Co
nÞgu
re
an u
ltras
onic
sen
sor a
nd a
ligh
t/co
lour
se
nsor
.
Crea
te a
bun
ch o
f cos
tum
es fo
r you
r spr
ite,
usin
g th
e te
xt t
ool t
o di
spla
y th
e fo
llow
ing
wor
ds in
larg
e le
tter
s, Ò
Coun
tdow
nÓ,
ÒWan
derÓ
, ÒAt
tack
Ó, Ò
Retr
eatÓ
and
ÒPr
ess
Butt
on t
o St
artÓ
.
➔
. Cr
eate
va
riabl
es n
amed
Òne
xt a
ctio
nÓ, Ò
foe
ahea
dÓ,
and
Òsee
s ed
geÓ.
YOU
NEED
Each
com
petit
or n
eeds
an
NXT
with
two
driv
ing
whe
els,
an
ultra
soni
c se
nsor
, and
a
light
or c
olou
r sen
sor.
Push
you
r opp
onen
t out
of a
ring
.
Sumo
http
://en
chan
ting.
robo
tclu
b.ab
.ca
12A
Trig
ger
Beha
viou
r
Sees
edg
eR
etre
at
Foe
ahea
dAt
tack
Wan
der
Arbiter
GET
READ
Y
THE
PLAN
If it
has
noth
ing
bett
er t
o do
, th
e ro
bot
wan
ders
aro
und.
If
it se
es a
foe
ahea
d of
it, t
he
robo
t at
tack
s, t
ryin
g to
pus
h th
e en
emy
out
of t
he ri
ng.
Mos
t im
port
antly
, if i
t se
es
the
edge
, the
robo
t re
trea
ts
from
it, i
n an
eff
ort
to s
tay
in
the
ring.
(card 1 of 2)
Sumo
Clic
k th
e a
nd w
ait
for t
he p
rogr
am
to ru
n.
Unpl
ug t
he U
SB c
able
and
pl
ace
the
robo
t on
the
sum
o bo
ard.
Whe
n yo
u ar
e to
ld t
o st
art
your
robo
t, pr
ess
the
oran
ge “
ente
r” b
utto
n on
the
NX
T.
DO I
T!
Can
you
add
othe
r beh
avio
urs
to t
he ro
bot,
or c
hang
e so
me
of t
he e
xist
ing
ones
? W
hat
coul
d yo
u do
to
mak
e yo
ur
sum
o ro
bot
bett
er?
Wou
ld t
his
met
hod
of
prog
ram
min
g w
ork
for o
ther
ro
bots
?
GO F
ARTH
ER
➔
. Y
ou’ll
mak
e bl
ocks
cal
led
“Att
ack”
, “Re
trea
t”,
“Wan
der”
, and
“St
artu
p”.
TRY
THIS
COD
E
http
://en
chan
ting.
robo
tclu
b.ab
.ca
12B
DO I
T!
(card 2 of 2)
- 24 -
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 25 -
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 26 -
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 27 -
SCRATCH Planning SheetWhat should the program do:
Variables: Sketch:
Inputs:
Outputs:
How the program should work:
- 28 -
My favorite “Discovery” (can be an “ah-ha”, or something that went right or wrong):
Something I learned today:
Tomorrow I would like to try:
- 29 -
My favorite “Discovery” (can be an “ah-ha”, or something that went right or wrong):
Something I learned today:
Tomorrow I would like to try:
- 30 -
My favorite “Discovery” (can be an “ah-ha”, or something that went right or wrong):
Something I learned today:
Tomorrow I would like to try:
- 31 -
My favorite “Discovery” (can be an “ah-ha”, or something that went right or wrong):
Something I learned today:
Tomorrow I would like to try:
- 32 -
My favorite “Discovery” (can be an “ah-ha”, or something that went right or wrong):
Something I learned today:
Tomorrow I would like to try: