Pages: [1]   Go Down
Author Topic: extra chars displayed at end  (Read 465 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
I am using an analog value to index through and array and display messages
on the sparkfun serial LCD

Everything works except I get extra || ||| every time

Got any ideas?


I attached some of the code, it's big.

[ftp]http://s847.photobucket.com/albums/ab37/mstadtler/
[/ftp]

/code]
prog_char string_16[] PROGMEM = "16 Dulcimer";

PROGMEM const char *string_table[] =    // change "string_table" name to suit
{
string_0,string_1,string_2,string_3,string_4,string_5,string_6,string_7,string_8,string_9,
string_10,string_11,string_12,string_13,string_14,string_15,string_16,string_17,

strcpy_P(buffer, (char*)pgm_read_word(&(string_table[instrument]))); // Necessary casts and dereferencing, just copy.
   Serial.println( buffer );
    delay( 500 );

Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 167
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

that's probably the newline character at the end of the string.  Strip off the "\n" at the end and the |||s will go away.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4255
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Strip off the "\n" at the end and the |||s will go away.
You do this by using Serial.print() instead of Serial.println().  You will have to reposition the cursor to advance to the next line unless your particular serial device uses some other technique.

Please use the code button only for the code portions of your post.  You have used it for your entire post.


Don
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I guess they are end of line character as well. Splarfun Serial LCD doesn't know how to handle it. You have to handle it yourself or maybe should have bought my version of serial LCD that does handle everything smiley-wink
Logged


0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the help, Serial.print worked. I will work on my posting skills for next time.
Logged

Pages: [1]   Go Up
Jump to: