Go Down

Topic: LCD4884 and serial communication. (Read 3 times) previous topic - next topic

nend

Apr 21, 2012, 09:44 am Last Edit: Apr 21, 2012, 09:52 am by nend Reason: 1
I'm newbie in arduino and my first project I'm alredy stuck, so my question is:

How can I display the letters on my display when I use serial com.
I want to display the letters that I type in the serial monitor to show on my display.
I already managed to display the numeric code (100 = d (ascii)) but i want to display the "d" and not the corresponding number.

see the code I've inserted with this post.

Thanks
Code: [Select]
#include "LCD4884.h"

int val = 0;
char string[10];

void setup() {
 lcd.LCD_init();
 lcd.LCD_clear();
 lcd.backlight(OFF);
 Serial.begin(9600);
}

void loop () {
   while (Serial.available() == 0);
   val = Serial.read();
   Serial.println(val);
   itoa(val, string, 10);
   
   lcd.LCD_write_string(0, 0, string, MENU_NORMAL);

 delay(100);
}

olikraus


nend

@olikraus,

I've looked at it but it wasn't made for my lcd (LCD4884).
And it's way to difficult to adjust it for me (newbie).
The only thing I need a answer to how to convert it to a asccii character (so if the arduino received 65 that it display a "a")
I can make a large switch case loop but I think that there is already a function for that. 

olikraus

oh, i understand. I am not an expert on println, but maybe "println((char)val)" helps.

Oliver

nend

#4
Apr 21, 2012, 03:32 pm Last Edit: Apr 24, 2012, 10:15 am by nend Reason: 1
@Oliver,

Thanks for the reply.
just one step closer to the sollution.
serial monitor mirrors now the good charater but how do I get this to get it works with the lcd?
See the code
Code: [Select]
#include "LCD4884.h"

int val = 0;
char string[10];
char teststring;

void setup() {
 lcd.LCD_init();
 lcd.LCD_clear();
 lcd.backlight(OFF);
 Serial.begin(9600);
}

void loop () {
   while (Serial.available() == 0);
   val = Serial.read();
   Serial.println((char)val);
   itoa(val, string, 10);
   
   lcd.LCD_write_string(0, 0, string, MENU_NORMAL);
 delay(100);
}

Go Up