Skip to content

Instantly share code, notes, and snippets.

@rkrishnasanka
Created October 14, 2013 07:09
Show Gist options
  • Save rkrishnasanka/6971895 to your computer and use it in GitHub Desktop.
Save rkrishnasanka/6971895 to your computer and use it in GitHub Desktop.
void explode(String message)
{
int count = 0;
do
{
commaPosition = message.indexOf(':');
if(commaPosition != -1)
{
Serial.println( message.substring(0,commaPosition));
// clipping off the message string
message = message.substring(commaPosition+1, message.length());
}
else
{ // here after the last comma is found
if(message.length() > 0)
Serial.println(message); // if there is text after the last comma,
// print it
}
}
while(commaPosition >=0);
}
int stringToNumber(String thisString) {
int i, value, length;
length = thisString.length();
char blah[(length+1)];
for(i=0; i<length; i++) {
blah[i] = thisString.charAt(i);
}
blah[i]=0;
value = atoi(blah);
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment