0. Make sure ATMega wires are propertly setup.
1. Install Arduino IDE
sudo apt-get install arduino
2. Instal AVRdude, a small tool to transfer sketches over to the board.
cd /tmp wget http://project-downloads.drogon.net/gertboard/avrdude_5.10-4_armhf.deb sudo dpkg -i avrdude_5.10-4_armhf.deb sudo chmod 4755 /usr/bin/avrdude
3. Automate some process of avoiding potential serial port conflicts
cd /tmp wget http://project-downloads.drogon.net/gertboard/setup.sh chmod +x setup.sh sudo ./setup.sh
5. By default Gertboard will use GPIO to communicate through serial port AMA0. However Arduino evnrironment does not detect /dev/ttyAMA0 as serial port and it likes /dev/ttyS1 instead. So link them together.
sudo ln /dev/ttyAMA0 /dev/ttyS1
or to make it permanent
sudo nano /etc/init.d/link_serial
#!/bin/bash ln -s /dev/ttyAMA0 /dev/ttyS1
sudo chmod 755 /etc/init.d/link_serial
update-rc.d link_serial defaults
5. Run Arduino IDE
6. Select Tools -> Board and then select Gertboard with ATmega328
7. Select Tools -> Programmer and then select Raspberry Pi GPIO
8. Load a sketch such as Blink and modify it to suit the pin number connected to a LED on your Gertboard.
9. Upload using File -> Upload using programmer
10. Wait until it compiles and fully uploaded. Blinking!
To see how we can see messages created by Serial.println on Serial Monitor, please see this article.