Setting up the Arduino IDE

You will be developing software for the RFu-328 using the Arduino Integrated Development Environment. You can load this onto your PC, Mac, Linux or Raspberry Pi. 

For PC, Mac or Linux install the software directly from the Arduino website at the following link:

Install Arduino IDE on Raspberry Pi

The Arduino IDE runs in the X environment on the Raspberry Pi and requires a keyboard, mouse and screen. If you connect to your Raspberry Pi using SSH then it won't work because SSH does not support X.

To install the Arduino IDE on your Raspberry Pi start LXTerminal and type:

sudo apt-get update

This will update the package lists and make sure that the Arduino package can be found when you run the next command:

sudo apt-get install arduino

You need to answer yes to the questions you get. The process may take a while, so be patient. Once done, you should see "a new category called "Electronics" in your start menu. You should see "Ardiono IDE" in this category, as well as in the "Programming" category in your start menu.

The serial port on the GPIO that we want to use to communicate with the Arduino on the Pi is /dev/ttyAMA0. Unfortunately, the Arduino IDE does not recognise this port. It prefers to use /dev/ttyS0. To get round this we link /dev/ttyS0 to /dev/ttyAMA0 and make sure this link is permanent. To do this, we need to create a file called /etc/udev/rules.d/99-tty.rules using a text editor.

In LXTerminal type

sudo leafpad

In the text editor type:

KERNEL==”ttyAMA0″,SYMLINK+=”ttyS0″ GROUP=”dialout”
KERNEL==”ttyACM0″,SYMLINK+=”ttyS1″ GROUP=”dialout”

Then select File > Save As and type /etc/udev/rules.d/99-tty.rules

Close leafpad and don't worry about the Gtk Warnings that will appear in the LXTerminal window (they are due do with the fact that Leafpad cannot store temporary and backup files in /etc).

Then reboot using:

sudo reboot