This guide will demonstrate:
- How to Program the Arduberry using Arduino IDE
- How to Access the serial port using minicom
- How to Access the Serial data from python
- How to Adding a new library
Before starting, make sure that your Raspberry Pi is configured and you have gone through the Getting Started Guide.
To program the Arduberry using the Arduino IDE, do the following:
Step1: Open the Arduino IDE
Step 2: Open the Example Arduino Sketch
Open an example or an Arduino sketch that you want to upload.
Step 3: Set the Programmer
Make sure that the programmer is set to Raspberry Pi GPIO and the board is set as Arduino Uno.
Step 4: Upload
Click Upload. If Upload does not work use Upload using Programmer (Ctrl+Shift+U) to upload the sketch to the Arduberry
The default Serial port monitor that is installed with the configuration script is minicom. To use minicom follow the steps:
Step 1: (Default config)
Minicom is configured to a default baud rate of 9600. To open minicom at 9600 baud, enter the following in terminal:
sudo minicom -b 9600 -D /dev/ttyAMA0
Step 2: (Other baud rates)
If you want to use minicom in any other baud rate than 9600, open minicom in terminal with the following command:
sudo minicom -s
Select the “Serial Port Setup“:
Press “A” to change the device to “ttyAMA0“, “E” to change the baud rate, “F” and “G” to change the flow control. Press Enter to go back to the main menu.
Select Exit to start minicom in the new configuration.
Minicom running at 115200 baud
To access the Serial data coming from Arduberry in Python, install pyserial. Note: if you used our setup script to get started here, you have already installed pyserial.
sudo pip install pyserial
Write a small program in python to access the Serial data
import serial ser = serial.Serial('/dev/ttyAMA0', 115200) while True: print ser.readline()
Save it and run it.
Download the new library in Raspberry Pi using the Netsurf browser.
Save the library to /usr/share/arduino/libraries/
Open /usr/share/arduino/libraries/ in the File Manager.
Extract the library in the same directory.
Now the new library can be used in the Arduino IDE
Have a question? Post it on the forums!