Go Down

Topic: String value to ASCii via serial interface (Read 1 time) previous topic - next topic


Hi all,

I know this is going to be easy, but my searching hasn't found the answer. I need to convert a string such as
CSp2134Sp7128Sp0SpCR (where Sp = space and CR = carriage return) to ascii and send it out the serial monitor (and later a second serial port) which would in this case be 673250495152325549505632483213

Can someone please point me in the right direction.

Many thanks


The idea here is to consider each character of the string, and send its decimal value to the Serial.  Something like...

Code: [Select]

char* current_char = my_string;
while( *current_char )
  Serial.print( *current_char++, DEC );


Fantastic, works a treat, many thanks.  :)


Go Up