Serial communications end char


hi all,

i trying implement reprap g-code interpreter in decimila board. code compiles , uploaded board, , test board send g-code commands g00 x100 y100 arduino itself. however, following code seem not detect end chars '\n' or '\r' arduino software, getting chars typed  in send box.

void get_and_do_command()
{
     //read in characters if got them.
     if (serial.available())
     {
           c = serial.read();
               if(c == '\r')
                 c = '\n';
               // throw away control chars except \n
               if(c >= ' ' || c == '\n')
               {

             //newlines ends of commands.
             if (c != '\n')
             {

question arduino send end char @ all?

thanks in advance.
kannan

in monitor window, doesn't send terminating characters.  otherwise, if had multi-part text enter (or wanted character 'a' send itself) send "a\r\n" bad.

what in serial mode append terminating character myself, such '@'.  when encounter in serial.read, act if end of line workaround.

i believe tried \r\n in line, doesn't send either.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Serial communications end char


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums