difficulties printing characters to lcd

( N00b alert.. )

Hi everybody, i have a problem which is probably a piece of cake to solve, but i can't get my head around this..

  1. I have 2 arduinos connected to each other using xbee modules ( no problem here )

  2. I am sending characters H and L from arduino A to arduino B using code on arduino.cc/en/Guide/ArduinoXbeeShield

  3. I am receiving the data with the physical pixel sketch and led on pin 13 lights as set in the sketch.

  4. When i try to print the received data to an HD44780 lcd, i get numbers like 79 and 76 ( not the real numbers here ). What is happening here??

I've tried to seek information about dealing with this but with no luck :(

One more thing. How do i send ( human readable ) messages from arduino to another? Let's say i want to make some sort of a messaging thing.

I really appreciate if someone explains this to me or points to some good info!!

  • Timo

I did some some research and this is what i think i need to get going:

Arduino receives what the other arduino sends, and stores the data in a string of some sort. When a correct character is received ( enter key etc ), it prints what is received to the screen.

I did a test with this:

if (val == 97) { Serial.print('a'); if (val == 98) { Serial.print('b');

It sorta works, but that really doesn't make this useful. This really isn't the "right" way of doing this anyway i guess :)

Without seeing code I am guessing that you are receiving the value as an integer and, when that value is 'printed' to the LCD, the actual number is printed instead of the ASCII character.

From Serial.print's documentation:

Serial.print(b) with no format specified, prints b as a decimal number in an ASCII string. For example,

int b = 79; Serial.print(b);

prints the ASCII string "79".

Which is what I think you are seeing...

Serial.print(b, BYTE) prints b as a single byte. For example,

int b = 79; Serial.print(b, BYTE);

returns the string "O", which is the ASCII character represented by the value 79. For more information see the ASCII table.

Which is what I think you want. Try using Serial.print(x, BYTE).

You might want to look at http://arduino.cc/en/Tutorial/ASCIITable and see if that helps your understanding of what is happening.

If that doesn't work, I think some code snippets are in order.