read through a text and store ascii bytes


hi all,

i´ve searched here find lets me "pull-out" individual ascii-bytes out of text.

like: serial.print ("hello world");

does it.

but need manually. have old printer need hadshakening every letter.
therefore need convert every letter single byte , store temporarily in variable print out add handshake , go on next letter.

i´m not familiar these char, ascii , string things, looked here:

https://www.arduino.cc/en/reference/stringobject

especially string.getbytes(buf, len) - that´s not need , may complex rather little problem....   

like this:

code: [select]


pseudo code:

pointer = 0;
byte = 0;

array string = "hello word.";

run until "." detected

{
pointer @ string , read letter;

convert hex ascii , store in byte;

handshake; // know how this;)

myprintroutine (byte); // done hardcoded "t" sending 0x74 works fine, that´s boring;)

handshake; // wait until printer ready again testing pin..

pionter++;
}

/pseudo code



any on how these ascii bytes out of given "text" 1 one nice.

thanx,
tubical

encapsulate handshake "write character handshake" function.

then (untested):
code: [select]
char teststring = "hello world";
printwithhandshake(teststring);

printwithhandshake(char* charstring)
{
  char *ptr = charstring;

  while (*ptr != '\0')
  {
    writewithhandshake(*ptr);
  }
}

writewithhandshake(char c)
{
  // thing c
}


Arduino Forum > Using Arduino > Programming Questions > read through a text and store ascii bytes


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'