Arduino & Flash AS3 (part 2)

(continued from Arduino & Flash AS3 (part 1)).

It’s time to test your Arduino board.

Install the Arduino IDE. Unzip and place the Arduino IDE into your Applications folder.

Install the FTDI serial driver for your platform.

Connect your Arduino board via USB to your computer and open up the Arduino IDE.
Go to Tools->Serial Port. On the Mac, choose the entry that reads /dev/tty.usbserial-XXXXXXXX.

If you don’t see an entry that reads /dev/tty.usbserial-XXXXXXXX, it most likely means that you did not install the FTDI serial driver, or it did not install correctly, re-install it.

Go to Tools->Board and select your board.

We have set up the IDE to communicate with the board. Next let’s upload a sketch to the board, Go to File->Examples->Digital and select Blink.

You should now be looking at a sketch by David Cuartielles. The sketch turns on an LED for one second, then off for one second, repeatedly.

Grab one of your newly purchased LED(s) and firmly connect it to your board. The long leg of the LED (positive) goes into the digital connection pin 13 on the Arduino. The short leg of the LED (negative) goes into the digital ground pin of the Arduino.

Upload the sketch to the Arduino board by selecting the upload button.

If all went well the IDE would have reported the following:

and the LED that you connected to your Arduino board will be blinking.

You have successfully uploaded a sketch to your Arduino board. This validates that the board is working correctly and that you are ready to move onto (part 3).

If you received an error from the Arduino IDE, make sure that your USB is connected properly to your Arduino board. Double check and make sure that the correct serial port is selected Tools->Serial Port in the serial port menu.

On a Mac you can open Terminal and run command ‘ls /dev/cu.usb*’ to discover the serial port on which Arduino is running.

Make sure that you have selected the correct board Go to Tools->Board and re-select your board.

Try to upload again, if it still fails with the following error:

You are going to need to change some variables for the Arduino IDE.
The likely cause for the error is that older Arduino Duemilanove Atmega328 boards were shipped with a slower baud speed.

*Note older Adafruit boards have a baud speed of 19200

To resolve this issue you will have to change the baud speed in the boards.txt file to upload sketches to your Arduino board.
Lets start by closing the Arduino IDE.

Navigate to the Applications folder, select the Arduino Application icon and CTRL->Click and select Show Package Contents.

Navigate to Contents->Resources->Java->hardware->arduino and select boards.txt and open with a text editor.
Navigate to ‘atmega328.upload.speed=57600’ and update the baud speed to 19200.

##############################################################

atmega328.name=Arduino Duemilanove or Nano w/ ATmega328

atmega328.upload.protocol=stk500
atmega328.upload.maximum_size=30720
atmega328.upload.speed=57600 // this is the line you need to update //atmega328.upload.speed=19200

atmega328.bootloader.low_fuses=0xFF
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0x05
atmega328.bootloader.path=atmega
atmega328.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0x0F

atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=16000000L
atmega328.build.core=arduino

##############################################################

Save the file and Close.
Open up the Arduino IDE and make sure you have the correct Serial Port and Board selected. Navigate to the Blink sketch as described above and try to re upload the sketch to the board. The end result should be a blinking LED.

If you had to travel down this road, TAKE NOTE that your board is running on a different baud speed. This is important because you will have to update a few files to get Flash and Arduino talking, we will cover that in the next few steps.

On to part 3.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: