Advertisement
otakus

Untitled

Jul 3rd, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. int getInput(int passthrough){
  2.   counterA=0;
  3.    if(Serial.available()){
  4.      do{
  5.        while(!Serial.available());
  6.          inputByte=Serial.read();
  7.          inputBytes[counterA++]=inputByte;
  8.          if(checkDelim(inputByte)||counterA==INPUT_DIGIT_LIMIT+1)
  9.            break;
  10.      }while(true);
  11.      inputBytes[counterA]='\n';
  12.      return atoi(inputBytes);
  13.    }
  14.    return passthrough;
  15. }
  16.  
  17. boolean checkDelim(int code){
  18.   if(code==10||code==13)
  19.     return true;
  20.   return false;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement