Question 14.14: Using an Arduino Shield with an aLaMode Board and a Raspberr......

Using an Arduino Shield with an aLaMode Board and a Raspberry Pi

You want to use an Arduino shield with a Raspberry Pi.

Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

Use an aLaMode interface board. You may find that the board requires the Arduinostyle header sockets for shields to be soldered into place.

As an example, you’ll connect an Arduino LCD shield to the aLaMode (Figure 14-21).

To make this recipe, you need:

• aLaMode Board (see “Modules” on page 381)

• Arduino LCD shield (see “Modules” on page 381)

As with all the program examples in this book, you can also download this sketch from the Code section of http://www.raspberrypicookbook.com, where it is called AlaMode‐Shield.

#include <LiquidCrystal.h>
// pins for Freetronics LCD Shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup()
{
lcd.begin(16, 2);
lcd.print(“Counting!”);
}
void loop()
{
lcd.setCursor(0, 1);
lcd.print(millis() / s1000);
}

Simply upload the sketch onto the aLaMode and you should see the message “Counting” appear on the top row of the display, while the bottom row should show a number that counts the seconds.

Discussion

This example used the Freetronics LCD shield. There are a number of other LCD display shields, and some have different pin allocations. If you use a different module, you’ll need to change the line:

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

The parameters are the Arduino pins to be used for the following LCD connections: rs, enable, d4, d5, d6, and d7, in that order.

See Also

The reference material for the Arduino LiquidCrystal library can be found at http://arduino.cc/en/Reference/LiquidCrystal.

Table A-8. Modules
Raspberry Pi camera module Adafruit: 1367, MCM: 28-17733, CPC: SC13023
Arduino Uno SparkFun: DEV-11021, Adafruit: 50, CPC: A000066
Level converter, four-way SparkFun: BOB-11978, Adafruit: 757
Level converter eight-way Adafruit: 395
LiPo boost converter/charger SparkFun: PRT-11231
PowerSwitch tail Adafruit: 268
16-channel servo controller Adafruit: 815
Motor driver 1A dual SparkFun: ROB-09457
RaspiRobot board Sparkfun: KIT-11561, raspirobot.com
PiFace digital interface board MCM: 83-14472, CPC: SC12827
Humble Pi MCM: 83-14637, CPC: SC12871
Pi Plate Adafruit: 801
Gertboard MCM: 83-14460, CPC: SC12828
Breakout board with paddle terminals MCM: 83-14876, CPC: SC12885
PIR motion detector Adafruit: 189
Venus GPS module SparkFun: GPS-11058
Methane sensor SparkFun: SEN-09404
Gas sensor breakout board SparkFun: BOB-08891
ADXL335 triple-axis accelerometer Adafruit: 163
4×7-segment LED with I2C backpack Adafruit: 878
Bicolor LED square-pixel matrix with I2C backpack Adafruit: 902
PiLite interface board Ciseco, CPC: SC13018
aLaMode interface board Makershed: MKWY1, Seeedstudio: ARD10251P
Freetronics Arduino LCD shield www.freetronics.com
RTC module Adafruit: 264
16 x 2 HD44780 compatible LCD module SparkFun: LCD-00255, Adafruit: 181
14.21

Related Answered Questions

Question: 14.11

Verified Answer:

The I2C bus has the concept of master and slave de...
Question: 14.10

Verified Answer:

Use a level converter or pair of resistors to conn...
Question: 14.9

Verified Answer:

Use PyFirmata to send commands to an Arduino to ge...
Question: 14.8

Verified Answer:

Use PyFirmata to send commands to an Arduino to ge...
Question: 14.7

Verified Answer:

Use PyFirmata to read an analog input on the Ardui...
Question: 14.6

Verified Answer:

Use PyFirmata to read a digital input on the Ardui...
Question: 14.5

Verified Answer:

Use a level converter to connect the RXD pin of th...
Question: 14.15

Verified Answer:

Follow this detailed tutorial to set up the Arduin...