Advertisement
RuiViana

Lista_TAG_Saldo.ino

Nov 4th, 2018
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. //#define APENAS_LER
  2. //#define GRAVAR_TAG
  3. //#define LIMPAR_EEPROM
  4. #define APENAS_TAG_SALDO
  5.  
  6. #include<EEPROM.h>
  7.  
  8. void setup()
  9. {
  10.   Serial.begin(115200);
  11.   long xpto = 52835;
  12.   long tag = 0xFE5F211F;
  13.   long linguica = 0xFFFFFFFF;
  14.  
  15. #ifdef LIMPAR_EEPROM
  16.   for (int i = 0; i < 1024; i++)
  17.     EEPROM.put(i, linguica);
  18. #endif
  19.  
  20. #ifdef GRAVAR_TAG
  21.   EEPROM.put(4, xpto);
  22.   EEPROM.put(8, tag);
  23.   EEPROM.put(12, xpto);
  24.   Serial.println("GRAVAÇÃO OK");
  25. #endif
  26.  
  27. #ifdef APENAS_LER
  28.   for (int i = 0; i < 50; i++) {
  29.     Serial.print(i);
  30.     Serial.print(": ");
  31.     Serial.println(EEPROM.read(i), HEX);
  32.   }
  33. #endif
  34. #ifdef APENAS_TAG_SALDO
  35.   long saldo;
  36.   for (int i = 0; i < 64; ) {
  37.     EEPROM.get(i, tag);
  38.     i += 4;
  39.     EEPROM.get(i, saldo);
  40.     Serial.print(i);
  41.     Serial.print(": ");
  42.     Serial.print(tag, HEX);
  43.     Serial.print(": ");
  44.     Serial.println(saldo, HEX);
  45.     i += 4;
  46.   }
  47. #endif
  48. }
  49.  
  50. void loop()
  51. {
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement