Guest User

Untitled

a guest
Jun 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Serial_Flush(SERIAL_0);
  2.  
  3. Serial_SetChar(SERIAL_0,114); // 'r' reset
  4. Serial_Write(SERIAL_0,buf,strlen(buf) ,40);
  5. Serial_SetChar(SERIAL_0,13); // CR
  6.  
  7. Sleep(800);
  8.  
  9.  
  10. int timeout = 10;
  11. while(!Serial_GetReadable(1) && timeout--)
  12. Sleep(100);
  13.  
  14. int gotten = Serial_Read(SERIAL_0, readbuf, strlen(buf), 40);
  15.  
  16. //snprintf(readbuf, BUF_SIZE,"\nReturn chars: %u \n", gotten); // <-- remmed out this
  17.  
  18. //Serial_Write(SERIAL_1, readbuf, BUF_SIZE, 30); // <-- remmed out this
  19. Serial_Write(SERIAL_1, readbuf, strlen(buf), 30); // <--added this
  20. Serial_SetChar(SERIAL_1,13); // CR
  21. Serial_SetChar(SERIAL_1,10); // CR
  22. Serial_SetChar(SERIAL_0,114); // 'r' reset
  23.  
  24. Sleep(5000);
  25. //return(gotten);
  26.  
  27.  
  28. }
Add Comment
Please, Sign In to add comment