LCD4Bit_mod int to char help

I am tryin to display Data from my EDB to my LCD Input Shield.

Whenever i try to print out data i get funny characters.

So I tried just displaying the Value of a button press!! Instead of displaying 304,719,476,129,0 i’m just getting junk!

#include <LCD4Bit_mod.h>
//create object to control an LCD.
//number of lines in display=1
LCD4Bit_mod lcd = LCD4Bit_mod(2);

void setup()
{
Serial.begin(9600);
lcd.init();
//optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init()
lcd.commandWrite(0x0F);//cursor on, display on, blink on. (nasty!)
lcd.clear();
}

void loop()
{
lcd.clear();
int msg;
lcd.cursorTo(1, 0);
lcd.printIn(“Brain Sytem”);
msg = analogRead(0);
char myChar = msg;
Serial.println(msg);
lcd.cursorTo(2, 0);
lcd.print(myChar);
delay(1000);
}

can anyone help?

Thanks in advance

As I recall, lcd4bit does not print integer values which is I think what you want. I suggest you use the LiquieCrystal library which has the same print capability as serial.

Here is some code for LiquidCrystal that should be close to what you want:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  Serial.begin(9600);
  lcd.begin(2, 16);
  lcd.blink(); // if you really want this mode!
}

void loop()
{
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Brain Sytem");
  int msg = analogRead(0);
  Serial.println(msg);
  lcd.setCursor(1, 0);
  lcd.print(msg);
  delay(1000);
}

see the LiquidCrystal reference for more on its capabilities

cheers,

got it working with my dfrobot shield.

how can i use the button with a menu system.

basically scrolling through the records on the EEPROM?

got any ideas?

thanks in advance

You should be able to gather some ideas doing a search for arduino lcd menu discussions in the forum and in the playground.

have fun!