Pages: [1]   Go Down
Author Topic: serial output of a char array  (Read 521 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi I am trying to output the values in a char array via serial but all  I get are numbers instead of the letters stored in the array.

Code:
for(int i=0; i < cantletras; i++){
  Serial.print(array[i]);}


am i missing something?

thank you
Logged

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 12
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What numbers do you get? Do you expect certain letters?

Seeing numbers is not actually that strange. The arduino sees letters and all other datatypes as 1s and 0s, as you know smiley

It would've been helpful to see a bit more of your code.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you sure it's a char array? If its an int array holding chars then the code you posted will print the ascii value (i.e. numbers).

As AlphaBeta says, it would be easier to help you if you posted a bit more code.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6652
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
for(int i=0; i < cantletras; i++){
  Serial.print(array[i], BYTE);}
Logged

Pages: [1]   Go Up
Jump to: