Robotics with the Boe-Bot text v2.2

Chapter 2: Your Boe-Bot’s Servo Motors · Page 45
' Robotics with the Boe-Bot - HelloOnceEverySecond.bs2
' Display a message once every second.
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
DEBUG "Hello!", CR
PAUSE 1000
LOOP
Your Turn – A Different Message
You can modify your program so that part of it executes once, and another part executes
over an over again.
Modify the program so that the commands look like this:
DEBUG "Hello!"
DO
DEBUG "!"
PAUSE 1000
LOOP
Run it and see what happens! Did you anticipate the result?
ACTIVITY #2: TRACKING TIME AND REPEATING ACTIONS WITH A
CIRCUIT
In this activity, you will build circuits that emit light that will allow you to “see” the kind
of signals that are used to control the Boe-Bot’s servo motors.
What’s a Microcontroller? Excerpts – This activity contains selected excerpts from the
What’s a Microcontroller? Student Guide v2.0.
Even if you are familiar with this material from What’s a Microcontroller?, don’t skip
this activity.
In the second half of this activity, you will examine the signals that control your servos and
timing diagrams in a different light than they were presented in What’s a Microcontroller?
Introducing the LED and Resistor
A resistor is a component that ‘resists’ the flow of electricity. This flow of electricity is
called current. Each resistor has a value that tells how strongly it resists current flow.