Go Down

Topic: Display and scroll through text using SparkFun Serial Enabled LCD (Read 257 times) previous topic - next topic

Steve_P71

I am trying to display text on a SparkFun Serial Enabled LCD kit connected to an Arduino Uno-R3 from a remote Uno using communication between two XBee Pro-S1's.

I was able to send the message and it displayed on the screen but because it is longer than the amount of spaces I have available on the 2x16 lcd display, only some of the message was displayed.

My question is how can I have the message scroll across the screen as it comes in so that the entire message can be read?

Also, I am currently using lcd.print, however, I have seen many things saying Serial.print. What is the difference? And would Serial.print be better to use in my case?

My "transmitter" code and "receiver" code are shown below for reference as how the message is being sent.

"Transmitter" code:

Code: [Select]
#include <SoftwareSerial.h>
#include <TinyGPS.h>

#define RXPIN 2
#define TXPIN 3

// Set this value equal to the baud rate of your terminal program
#define TERMBAUD  9600

// Set this value equal to the baud rate of your GPS
#define GPSBAUD  4800

// Create an instance of the TinyGPS object
TinyGPS gps;
// Initialize the SoftSerial library to the pins you defined above
SoftwareSerial uart_gps(RXPIN, TXPIN);

// This is where you declare prototypes for the functions that will be
// using the TinyGPS library.
void getgps(TinyGPS &gps);

void setup()
{
 
  // Sets baud rate of your terminal program
  Serial.begin(TERMBAUD);
  // Sets baud rate of your GPS
  uart_gps.begin(GPSBAUD);
 
  Serial.println("");
  Serial.println("GPS Shield QuickStart Example Sketch v12");
  Serial.println("       ...waiting for lock...           ");
  Serial.println("");
}

// This is the main loop of the code. All it does is check for data on
// the RX pin of the arduino, makes sure the data is valid NMEA sentences,
// then jumps to the getgps() function.
void loop()
{
  while(uart_gps.available())     // While there is data on the RX pin...
  {
      int c = uart_gps.read();    // load the data into a variable...
      if(gps.encode(c))      // if there is a new valid sentence...
      {
        getgps(gps);        // then grab the data.
      }
  }
}

// The getgps function will get and print the values we want.
void getgps(TinyGPS &gps)
{
  // Define the variables that will be used
  float latitude, longitude;
  // Then call this function
  gps.f_get_position(&latitude, &longitude);
 
  if (latitude >= 41.479133 && latitude <= 41.493510 && longitude >= -71.541359 && longitude <= -71.522058)
  {
  Serial.println("Warning, within Airport Flight Safety Zone. Contact local airport of drone flight intentions.");
  }
}


"Receiver" code:

Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial lcd(2,3);

void setup()
{
  Serial.begin(9600);
  lcd.begin(9600);
}

void loop()
{
  while (Serial.available())
  {
     //lcd.write(254); // move cursor to beginning of first line
     //lcd.write(128);

    //Serial.write("                "); // clear display
   //Serial.write("                ");

   //lcd.write(254); // move cursor to beginning of first line
   //lcd.write(128);

    lcd.print((char) Serial.read());
   
//delay(500);
  }
}


Thank you for your guidance and insight.

floresta

Quote
My question is how can I have the message scroll across the screen as it comes in so that the entire message can be read?
That would depend on the specific serial interface being used with your LCD.  There are no standards so the capabilities and the means for implementing those capabilities vary.

Don

Go Up