Step 10Upload Sketches & Testing
I suggest that you upload them directly over USB cable to the Arduino. Although I believe it is possible to upload wirelessly, I haven't yet been able to establish this with the XbeePro modules.
Arduino Wiring configuration:
0 / RX (leave)
1 / TX (leave)
2 - LCD D7
3 - LCD D6
4 - LCD D5
5 - LCD D4
11 - LCD Enable Pin
12 - LCD RS Pin
14/ A0 used as NewSoftSerial RX - connects to Xbee TX
15/ A1 - used as NewSoftSerial TX - connects to Xbee RX
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
We will be using the LiquidCrystal library to communicate with the display.
As well as the NewSoftSerial library for the Xbee.
You can download it here: NewSoftSerial
It allows you to connect the Xbees TX/RX to other digital pins on the Arduino.
This means that the Arduino's serial pins are kept free for use by the USB when uploading.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(You can download the pde. files below)
Sketch One (InstructablesDisplay.pde)
This example will test the display without using wireless communication.
The code will print ' Instructables! ' on the top line of the display!
// include the library code:
#include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of rows and columns: lcd.begin(16, 2); // Print a message to the LCD. lcd.print(" Instructables! "); } void loop() {}Sketch Two (mySerialDisplay.pde)
This sketch displays text on the Altoids LCD via Xbee wireless from the PC serial monitor.
The initial startup screen shows
1. 'Instructables, altoids display'
2. (delay of 5 seconds)
3. 'Waiting for serial input...'
/* ------------------------------------------------------------ This sketch displays text sent over soft-serial (digital pins) using the NewSoftSerial library. (RX - 14/A0, TX - 15/A1) Modified SerialDisplay example to include soft-serial for Xbee A.dlp 28th July 2010 for Wireless Altoids Display Instructable www.instructables.com ------------------------------------------------------------ */ // include the library code: #include <LiquidCrystal.h> #include <NewSoftSerial.h> // initialize the LiquidCrystal library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the NewSoftSerial library RX-14/A0 TX-15/A1 NewSoftSerial mySerial(14, 15); void setup(){ // set up the LCD's number of rows and columns: lcd.begin(16, 2); // initialize the serial communications: mySerial.begin(9600); // print text 1st line lcd.print("Instructables"); // set cursor to 2nd line lcd.setCursor(0, 1); // print text on 2nd line lcd.print("Altoids Display"); // wait 5 seconds till next message delay(5000); // clear the screen lcd.clear(); lcd.print("Waiting for"); lcd.setCursor(0, 1); lcd.print("serial input ..."); } void loop() { // when characters arrive over the serial port... if (mySerial.available()) { // wait a bit for the entire message to arrive delay(100); // clear the screen lcd.clear(); // read all the available characters while (mySerial.available() > 0) { // display each character to the LCD lcd.write(mySerial.read()); } } }
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|



















































