# Running Arduino with RadioFaro and ZigDuino Boards.

## Overview

Arduino is a Microcontroller Development plattform that consists of a Java-IDE and different microcontroller boards. All of the supported boards are equipped mit AVR-8-bit-MCUs. Basically the Arduino IDE provides an integrated editor, a serial terminal and buttons to compile and upload the firmware to the MCU.

In order to keep things very simple for beginners and none technicians, the nitty gritty details of microcontroller programming (ports, registers, interrupts) are buried in the Arduino core library. Therefor the user is faced with a simplistic API that is described here.

The user writes its own applications in the Arduino IDE in form of sketches. A sketch basically implements two functions setup() and loop() that are called from the main() function of the core library.

µracoli provides a third party core file package for Arduino, that supports the boards RadioFaro and Zigduino. This core contains the standard Arduino functions and the µracoli radio functions.

RadioFaro board

Both boards are equipped with a ATMega128RFA1, which has an integrated 2.4 GHz transceiver.

## Getting Started

Currently (as of version 0021) the Arduino Toolchain is quite mature and does not support newer MCUs like the Atmega128RFA1. Therefore an upgrade of the Arduino Toolchain is needed.

In order to do this, install the modified Arduino package from http://download.savannah.gnu.org/releases/uracoli/Arduino/.

- MAC OSX: Arduino-0021-crosspack20100115.zip (80M)
- Windows w/o Java: Arduino-0021-uracoli-expert.zip (82M)
- Windows w/ Java: arduino-0021-uracoli.zip (121M)
- Linux: arduino-0021-uracoli.tgz (3.7M)

For more advanced users it is sufficient if you solely upgrade the toolchain of your current Arduino install

- MAC OSX: update crosspack
- Windows:
- Linux: arduino-0021-uracoli.tgz (3.7M)

In the next step you need to download the package uracoli-arduino-[version].zip and unpack it in your private sketchbook folder.

After unpacking the package you'll find the following directory structure:

                sketchbook/
                |-- examples
                |   |-- HelloRadio
                |   |-- IoRadio
                |   `-- RadioUart
                |-- hardware
                    `-- uracoli
                        |-- bootloaders
                        |   `-- radiofaro
                        `-- cores
                            `-- radiofaro
                                `-- boards

Now you are ready to go and launch the the Arduino IDE, connect one of the above boards and try the example sketches.

## Function Reference

Beside the normal core functions (see http://arduino.cc/en/Reference/HomePage) there are some radio specific functions, described here Arduino Radio Functions.

## Example Sketches

Sending Strings

      00001 /* $Id$ */
      00006 #define REG(name, reg) do{uint8_t _b_ = reg; Serial.print(name);Serial.print(" : "); Serial.println(_b_,HEX);}while(0)
      00007
      00008 unsigned long tx_time;
      00009 int cnt = 0;
      00010 void setup() {
      00011
      00012     /* operating on channel 17, not receiving when idle. */
      00013     Radio.begin(17, STATE_OFF);
      00014     Serial.begin(9600);
      00015     Serial.println("HelloRadio V$Release$");
      00016 }
      00017
      00018 void loop() {
      00019
      00020     if (millis() > tx_time){
      00021         tx_time = millis() + 500;
      00022         // write string
      00023         Radio.write("cnt: ");
      00024         // write integer
      00025         Radio.put(cnt);
      00026         // write byte
      00027         Radio.write('\n');
      00028         Radio.flush();
      00029         Serial.println(cnt);
      00030         cnt ++;
      00031     }
      00032
      00033 }
      00034
      00035