Pages: 1 [2]   Go Down
Author Topic: (SOLUCION)Recibir datos Serial(NewSoftSerial),parsearlos separando por puntocoma  (Read 4472 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 16
Posts: 1579
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Mira, al final, todo es lo mismo... Por curiosidad he mirado a ver cómo hacen parseInt

Code:
long Stream::parseInt(char skipChar)
{
  boolean isNegative = false;
  long value = 0;
  int c;

  c = peekNextDigit();
  // ignore non numeric leading characters
  if(c < 0)
    return 0; // zero returned if timeout

  do{
    if(c == skipChar)
      ; // ignore this charactor
    else if(c == '-')
      isNegative = true;
    else if(c >= '0' && c <= '9')        // is c a digit?
      value = value * 10 + c - '0';
    read();  // consume the character we got with peek
    c = timedPeek();
  }
  while( (c >= '0' && c <= '9') || c == skipChar );

  if(isNegative)
    value = -value;
  return value;
}




smiley-wink
« Last Edit: January 22, 2012, 09:53:16 am by Igor R » Logged


Pages: 1 [2]   Go Up
Jump to: