Step 4Programming the Arduino
If you are new to the Arduino, it is a small board, fully assembled with a AVR microcontroller. It is well suited for hacking and interacting with your environment. Many things that are hard with microcontrollers are rather easy with Arduino. Some of the advantages:
- no need for a separate programming device (programmer)
- comes with an integrated development environment (IDE)
- runs on any platform, Windows, Mac, Linux.
- easy connection to your PC with USB
- hardware is open source (but the name Arduino is not)
- has a great community
What does the software do?
The small piece of software that gets uploaded to the Arduino, controls the servo. It receives single bytes via the serial connection over the USB cable. If it receives a value of 5, it moves the servo arm five times forth and back. So the max value to send is 255.
Program the Ardiuno
So I assume you have downloaded and installed the latest Arduino IDE from Arduino.cc. For now it is version 0010 Alpha.
To drive the servo more comfortably you have to download a library. You can find it on the Arduino Playground. Unzip it and put the folder in .../arduino-0010/hardware/libraries/.
- Attach the Arduino to your PC with the USB cable.
- Open the IDE and start a new sketch. Sketch is Arduino speak for program. Select File -> New.
- Select the appropriate serial device (Tools -> Serial Port). This depends on your environment, for me it is /dev/tty.usbserial-A4001JAh.
- Download the attached source file and paste it into the new sketch. Hit the save button.
- Hit the verify button. This compiles your sketch into a hex file that can be transferred to your Arduino.
- Hit the upload button to transfer your sketch to the Arduino.
Now your hitcounter is ready for some action. Let's see if it works.
- Hit the serial monitor button.
- Select the text box next to the send button.
- Hit the tab key and send it.
- By now the servo arm should move forward and back.
We are almost done.
bells.pde1 KB| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|








































