We wrote a sketch for the ArduinoMega to test the AlaMode because at the time SeeedStudio didn’t have a RaspberryPi to test it with. Since we expect you already have a Raspberry Pi, and to get a better feel for the RPi/AlaMode interaction, we ported the code over.
This is a good test to start with. to make sure you have everything up and running.
After unpacking the zip file, open the alamode/examples/AlaModeTester/ directory. for me it looks like this:
pi@raspberrypi ~$ cd alamode/examples/AlaModeTester pi@raspberrypi ~/alamode/examples/AlaModeTester$ ls AlaModeTest AlaModeTester.ino AlaModeTester.py
The AlaMode should come with AlaModeTest.ino pre-installed. If not, or you have already loaded a different program, you should set up Arduino for RPi first.
Right from the command line, you can run the test script.
pi@raspberrypi ~/GIT/alamode/examples/AlaModeTester $ python AlaModeTester.py Traceback (most recent call last): File "AlaModeTester.py", line 9, in from Lib.DS3231 import DS3231 File "../Lib/DS3231.py", line 1, in from Adafruit_I2C import * File "../Lib/Adafruit_I2C.py", line 9, in class Adafruit_I2C : File "../Lib/Adafruit_I2C.py", line 11, in Adafruit_I2C def __init__(self, address, bus=smbus.SMBus(0), debug=False): IOError: [Errno 13] Permission denied
Except for the root permissions required for I2C access. Let’s try that again with root access.
pi@raspberrypi ~/GIT/alamode/examples/AlaModeTester $ sudo python AlaModeTester.py checkSD(): True checkSerial() data: 0123456789ABCD checkRCT() date: 2012-10-27 01:14:15 checkI2C(): True
If you are executing this locally, you will see a display pop up with four buttons. I’m executing over ssh, so my window looks like this.
Since root is required, if you want to display the GUI, you need to grant root the privilege of borrowing your X tunnel.
pi@raspberrypi $ sudo su root@raspberrypi $ xauth merge /home/pi/.Xauthority root@raspberrypi $ exit pi@raspberrypi $ sudo python AlaModeTester.py
It looks like this on the Adafruit WebIDE: