Learn to Deploy and Debug an Arduino Wiring sketch on Raspberry Pi 2 and 3 or Minnowboard Max to control text on an LCD screen!
Follow the Arduino Wiring Project Guide to create a new wiring project!
In this sample, we are using a common 16-pin LCD screen like this one from Adafruit. The exact model we used is LCM1602C, but what’s important is that you use a 16-pin LCD which is compatable with the Arduino LiquidCrystal library. This device is commonly included in Arduino starter kits and is a great LCD screen with two lines of display and controlled entirely with GPIO.
You’ll also need several wires, a potentiometer, and a 220 ohm resistor.
There is a fritzing diagram below, as well as a table of the exact pinouts we used in our code. For reference, we’ve also included a pinout diagram of the RPi2 or RPi3 GPIO header and the LCD screen. If you need additional help with your LCD screen, there is a really great guide over at Adafruit’s website on hooking up a 16-pin LCD screen.
|LCD Pin||Raspberry Pi2 Pin|
|GND||Any ground pin|
|VCC||5v DC (02 or 04)|
|VEE||5v DC or POT output *|
|R/W||Ground or any other GPIO pin *|
|BL+||5v DC with 220 ohm resistor|
|LCD Pinouts||Raspberry Pi 2 and 3 Pinouts|
You’ll need the LiquidCrystal library, which is included in the Arduino SDK! You can copy the two files
LiquidCrystal.cpp from the Arduino libraries folder (typically C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src) and paste them into your solution directory! Then, drag the two files from your solution directory into your project (via Solution Explorer) in Visual Studio.
Replace the existing code in your main .ino file with the following code:
Press F5 to build and deploy your project.
Refer to the Arduino Wiring Project Guide for more instructions on how to deploy your app!
You should see the LCD screen print “hello, world!” across the top line, with the current number of seconds the app has been running constantly being printed on the 2nd row!
Refer to the Arduino Wiring Porting Guide for common issues and concerns when working with Arduino Wiring sketches.