6. To finish this stack of blocks, drag a “set servo [P0] angle to [0]” block
under the variable block inside the “forever” block. Replace the zero
with an oval-shaped variable block that says “angle”
(Figure
L
).
You’re
ready to test it out!
To see sample code using MakeCode tilt commands, go to Easy
Tilt DrawBot: makecode.microbit.org/_TwE7ts3cD65A.
To see sample MakeCode that uses a range of accelerometer
readings to decide how far to move a pen, go to Advanced Tilt
Control DrawBot: makecode.microbit.org/_g7q64A10aUD3.
TROUBLESHOOTING TIPS
Here are some suggestions if the robots body gives you problems:
If the marker doesn’t stay put in the holder, use masking tape or add
extra cardboard to make the hole for the marker tighter.
If the motor stops working, check that all the wires are still connected
to the servo cable and the micro:bit in the correct order.
L
Chapter 5: Making Robots Playful 175
Make_Simple_Robots_interior_FIN.indd 175Make_Simple_Robots_interior_FIN.indd 175 4/26/22 1:56 PM4/26/22 1:56 PM
GO BEYOND
To add more markers, make a bigger marker holder.
Poke holes for each marker in the holder, trying to keep
the whole thing balanced so it doesn’t tip over.
To make arms that you can lengthen or shorten, cut strips of
cardboard and connect them using brads (bendable metal paper
holders that let you make movable joints). Attach two or more strips
to make “scissor joints” that let the arms collapse and expand.
With an extra micro:bit (or a different board, like the
Adafruit Circuit Playground Express), you can use
two servo motors to control scissor arms.
176
Making Simple Robots, 2nd Edition
Make_Simple_Robots_interior_FIN.indd 176Make_Simple_Robots_interior_FIN.indd 176 4/26/22 1:57 PM4/26/22 1:57 PM
Make a String Straw HexaWalker
BUILD A JAUNTY LITTLE BUG-SHAPED ROBOT THAT USES ONLY
ONE SERVO TO MOVE ALL SIX LEGS!
As humans, most of the creatures we hang out with have two (or four!) legs.
But get down to ground level, or take a look at what’s buzzing around your
head, and six legs seems to be the way to go, as far as Nature is concerned.
That extra pair of legs makes a body more stable, without requiring a lot
more brain power. It explains why hexapods — robotic walkers with six
legs — are enormously popular as toys, research designs, and homemade
robots. Many robots with whegs, like those in Chapter 2, have six (or more!)
wheel legs.
Hexapod robots use different gaits, or patterns of walking, depending on
how they are designed and how many servos they use. The gait determines
which legs move forward or backward (or up and down) at which times.
Chapter 5: Making Robots Playful 177
Make_Simple_Robots_interior_FIN.indd 177Make_Simple_Robots_interior_FIN.indd 177 4/26/22 1:57 PM4/26/22 1:57 PM
The hexapod design you will build here has front and back legs that move
together, and middle legs that move in the opposite direction.
Best of all, the design only needs one servo to make all the legs move! It
works like this:
The servo sits in the middle of the body, upside down.
The middle legs are attached directly to the servo, and pivot forward and
back.
The front legs are attached to the middle legs with strings that cross.
When one side of the middle legs moves back, the string pulls the
opposite side of the front legs back at the same time.
The front legs are attached to the back legs by strings on the
same side. So when one side of the front legs pivots forward, it pulls the
same side of the back legs forward at the same time.
The illustration below shows you how the strings are connected to the legs.
If it seems complicated, it will make more sense when you build it!
Underside of the robot
178
Making Simple Robots, 2nd Edition
Make_Simple_Robots_interior_FIN.indd 178Make_Simple_Robots_interior_FIN.indd 178 4/26/22 1:57 PM4/26/22 1:57 PM
WHAT TO EXPECT
Time Needed: 1 hour
Cost: $25–$30 (including re-usable electronics)
Difficulty: Moderate
Safety Issues: Use care with electronics and batteries, especially
with younger children.
SKILLS YOU WILL USE
Learning different ways to connect a micro:bit to a robot
Using strings as actuators (components that move parts of a robot)
Testing and improving the design of a robot
ELECTRONIC SUPPLIES
micro:bit V2 microcontroller (v1 will also work, but won’t include sound)
USB data cable with a USB micro-B plug and an end that fits
your computer
Micro servo (positional, not continuous) — often labeled as 9g
a cable with a plug that takes male jumper wires
a servo horn with 4 arms — at least two of them long
3 alligator clip-to-male jumper wires in different colors (preferably
red, black or brown, and yellow or orange to match the servo wires)
Optional:
extra-long USB data cable (3 feet or more), so your bot can move
around while connected to the computer for power and updating
the program
additional male-to-female jumper wires for longer distance
remote control
battery pack for the micro:bit
the punch-out cardboard battery pack holder that comes with
some micro:bits is handy for holding the board and batteries
together; print and cut out your own from the micro:bit site
(microbit.org/get-started/user-guide/battery-pack-holder).
you can also get a larger pack that holds two AA batteries and
has an on/off switch
Chapter 5: Making Robots Playful 179
Make_Simple_Robots_interior_FIN.indd 179Make_Simple_Robots_interior_FIN.indd 179 4/26/22 1:57 PM4/26/22 1:57 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.100.34