Fix for issue #2 previously created

obvious bug in original example code
This commit is contained in:
trackdork 2016-11-23 07:43:49 -05:00 committed by GitHub
parent a1de1ea973
commit 017911c68e

View file

@ -114,8 +114,9 @@ void readStoredEvents(){
for(int eventIndex = 0; eventIndex < numberOfEvents; eventIndex++){ for(int eventIndex = 0; eventIndex < numberOfEvents; eventIndex++){
Serial.printf("Event at location %i: ",eventIndex); Serial.printf("Event at location %i: ",eventIndex);
for(int i = startIndex; i < startIndex+36; i+=4){ for(int i = startIndex; i < startIndex+36; i+=4){
EEPROM.get(i, eventArray[eventIndex][(i-1)/4]); int arrayIndex = ((i-1)/4) % 9;
Serial.printf("%i, ", eventArray[eventIndex][(i-1)/4]); EEPROM.get(i, eventArray[eventIndex][arrayIndex);
Serial.printf("%i, ", eventArray[eventIndex][arrayIndex);
} }
Serial.printf("Event at location %i: ",eventIndex); Serial.printf("Event at location %i: ",eventIndex);
Serial.println(); Serial.println();