Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <EEPROM.h>
- float f = 123.456f; //Valor pra guardar na EEPROM.
- int eeAddress = 0; //Inicial Endereco da EEPROM
- unsigned long UmaHora = 3600000;
- unsigned long Controle = 0;
- int ContaHora = 0;
- byte JaLi = 0;
- //----------------------
- void setup()
- {
- Serial.begin(9600);
- Controle = millis();
- }
- //----------------------
- void loop()
- {
- if ( millis() - UmaHora >= 0)
- {
- Salva();
- ContaHora++;
- }
- if (ContaHora >= 24)
- {
- if (JaLi == 1)
- {
- ContaHora = 0;
- eeAddress = 0;
- JaLi = 0;
- }
- }
- }
- //----------------------
- void Salva()
- {
- EEPROM.put(eeAddress, f);
- eeAddress += sizeof(float);
- }
- //----------------------
- void Le()
- {
- for (int i = 0; i < 25 ; i++)
- {
- EEPROM.get( eeAddress, f );
- eeAddress += sizeof(float);
- delay(1500);
- }
- JaLi = 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement