Hardware Reference
In-Depth Information
When you upload the code, your robot should move forward slightly, then turn, move for-
ward again, then turn, and so on. You can adjust the amount of movement and turn by
changing the delay (500); statement in the code. Now, your robot can move around.
If you put a battery into the holder on the TinyDuino, your robot can even move when dis-
connected from the computer. I like to keep my USB connection board in this configura-
tion; it makes it easier to hook up and modify the code.
Now, you can move around, but you'll certainly still bump into barriers. So, let's add the
sonar sensor. To add the sensor, make the following connections:
Arduino pin
Sensor pin
5 V
VCC
GND
GND
12
Trig
11
Echo
You can mount your sonar sensor on the front of your Hexbug using velcro. The following
is an image of the Hexbug with the sensor mounted:
Search WWH ::




Custom Search