Arduino XMAS hitcounter

Step 4Programming the Arduino

Programming the Arduino
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
More information can be found at the official Arduino website. Be sure, to check out John's Arduino instructable for further details on how to get started with Arduino.

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.
Testing

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.
Phew. That was the hardest part. For now you can send a byte to the Arduino and the servo waves at you. Next is to find something that you want to trigger the bell.

We are almost done.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
41
Followers
4
Author:alex_weber