Let’s take a moment and look at the program that we used before to center the servos:
DO speedLeft = 0 speedRight = 0 time = 30000 GOSUB Wheel_Speeds LOOP
First we have the command “DO”…
…and then five lines below that we see another command …”LOOP”.
This tells us that the program is going to “DO” something (whatever that is), and then it’s going to “LOOP” back up and DO “it” again. In short, it looks that this program will continue to loop forever unless something interrupts it.
In between the DO and LOOP commands we have:
speedLeft = 0 speedRight = 0
This appears as though the speed of the Left and Right servos are set to a speed of “0” …fully stopped? So what happened when we first ran this program and the servos were perhaps moving? That’s why we adjusted the screw — we calibrated the mechanical device (the servo) to the program that is going to be controlling it. Now when any program wants to turn the servos off, all it needs to do give the servo motor a control value of “0” and it’s stopped.
So what do you suppose happens if you change “speedleft = 0” to “speedleft = 100”?
So what did you discover? Can you control the speed of both motors independently and simultaneously?
There’s a critical safety issue when baby chickens escape from the protection of the hen house. But, as luck would have it, you are part of the Chicken Protection Engineering Team (C-PET). Other team members are addressing such challenges as how to detect when a baby chick has “escaped”, and how to get Little Chicken safely back home. Your mission, should you decide to accept it, is to give your Boe-Bot the ability to temporarily “corral” the baby chick within an 18” diameter “safety zone”. Once your Boe-Bot has established this zone, a suction hose (developed by another engineering team) will deploy, and whisk the baby chick away to safety. For some inexplicable reason, your Project Manager informs you that part of your design specification requires your Boe-Bot to run in reverse. Please be advised that no baby chicks shall be injured during this Design Challenge.
(Hint: Chapter 4 in Robotics with the Boe-Bot)
Discuss (with your Counselor) and define a Challenge that you’ll need to accomplish. At a minimum, it should include making the Boe-Bot navigate some pre-determined path.
Servo motors are controlled devices. They are “told” (electronically) what to do. We call that type of connection “Output”. That is to say that the servo is controlled by an output coming from the microcontroller.
In almost every microcontroller system however, it’s a two-way street. There’s both Output (making something happen), and Input (being notified that something happened).
In the same way that we connected I/O lines (like P12 and P13) to the servos, we can also connect sensing circuitry to an I/O line as well. That’s why they’re called “I/O lines” – each one (of the 16 available on the BASIC Stamp2), can be used either as an Input or an Output.