Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void reJigFromMemory(){
- Serial.print("Eeprom read 1 :");
- Serial.println(eepromReadOne);
- Serial.print("EEprom read 2 :");
- Serial.println(eepromReadTwo);
- int tempArray[10];
- int charLength=eepromReadOne.length()+1;
- char charBuff[charLength];
- eepromReadOne.toCharArray(charBuff, charLength);
- // new int version
- int firstCharToInt,secondCharToInt;
- for (int i = 0; i <10 ; i++){
- firstCharToInt=charBuff[i*2];
- secondCharToInt=charBuff[(i*2)+1];
- tempArray[i]=((firstCharToInt-'0')*10)+(secondCharToInt-'0');
- Serial.print("I just translated :");
- Serial.println(tempArray[i]);
- }
- String tempArray2[10];
- int fromLocation = 0;
- int toLocation=0;
- // updated to reflect Duncan C's suggestions
- for (int i = 0; i <10 ; i++)
- {
- toLocation += tempArray[i];
- tempArray2[i]=eepromReadTwo.substring(fromLocation,toLocation);
- Serial.print("From Number = :");
- Serial.println(fromLocation);
- Serial.print("To number : ");
- Serial.println(toLocation);
- Serial.print("I just translated :");
- Serial.println(tempArray2[i]);
- fromLocation += tempArray[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement