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
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.
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
Post a Comment