Go Down

Topic: (SOLUCION)Recibir datos Serial(NewSoftSerial),parsearlos separando por puntocoma (Read 6426 times) previous topic - next topic

Igor R

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

Code: [Select]

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;
}





;)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy