Advertisement
baldengineer

using a while and not a for

Apr 6th, 2017
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. // untested
  2. // set variables to known values
  3. int findFirst = 0;
  4. int j = 0;
  5.    while(j < EEPROM.length()) {
  6.       // check if your value is there
  7.       switch (EEPROM.read(j)) {
  8.         case acitivity1:
  9.         case acitivity2:
  10.         case acitivity3:
  11.         case acitivity4:
  12.         case acitivity5:
  13.         case acitivity6:
  14.         case acitivity7:
  15.         case acitivity8:
  16.         case acitivity9:
  17.             found = j;
  18.             findFirst++;
  19.         break;
  20.  
  21.         default:
  22.             // nothing matched
  23.       } // switch closing
  24.     if (findFirst != 0)
  25.        break; // found it
  26.     j++ //increment EEPROM counter
  27. } // close while loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement