Printing variables to serial LCD

Grove is a modulated, ready-to-use tool set.
Much like Lego, it takes a building block approach to assembling electronics.

Moderators: lily.li, violet, jeremy882, crail.lyu969

Post Reply
phlounda
Pre-kindergarten
Pre-kindergarten
Posts: 1
Joined: Sun Jan 13, 2013 3:24 pm

Printing variables to serial LCD

Post by phlounda » Sun Jan 13, 2013 3:29 pm

I try to print the value of a variable using
slcd.print (c);
but it only displays the character associated with whatever the value of "c" is.
What am I missing?
any help will be appreciated.
Thanks

User avatar
Jacket Chen
Staff
Staff
Posts: 659
Joined: Thu Jun 21, 2012 4:25 pm
Are you a staff member of seeedstudio?: yes
Which products/projects are your favorite?: Seeeduino Shields
Location: China

Re: Printing variables to serial LCD

Post by Jacket Chen » Mon Jan 14, 2013 3:45 pm

Hi,you might try this code:

Code: Select all

#include <SerialLCD.h>
#include <SoftwareSerial.h> //this is a must

// initialize the library
SerialLCD slcd(11,12);//this is a must, assign soft serial pins
float c=0;

void setup() 
{
  slcd.begin();
}

void loop() {
  unsigned long c;
  for(c=0;c<6;c++)
  {
    slcd.setCursor(0, 0);
  slcd.print(c,DEC);
  delay(500);
  }  
}
Love little, love long.

Post Reply