For the build time: students will finish building 1st draft of arm frame and do redesigns to fix issues that arise. Once students figure out the servos, they can start attaching some to their robot to see if they can get it to move.
For the code time: students are introduced to servos, how they move, and how they want to use them to get their arm to move. Students are introduced to the code to get their servos to work and test it out. |
Before we can do fancy things with the servos, we first have to learn how they work. Wire up your servo like the picture to the right and try out the code below.
Once you get it to work, play with some of the numbers on the code and reupload it to the board to see how it changes what it does. You can plug your servo's orange cord to any pin, just make sure to type that pin as myservo.attach(#) |
The servo sweeping back and forwarth does not help much if we want to control exactly where a robot will go.
We need to add something that is called an "input", something we can control to tell it where to go. In comes the potentiometer. Turning it changes the value it gives and we can tell the computer how to use its data. We will be using more than one servo at once soon, so we will have to change what we call the servo. We will also be wiring many more things up soon, so we should make an easy to change variable to set what where servos are plugged into the board. |