Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h>
- #include <EEPROM.h>
- int addr = 0;
- int RECV_PIN = 11;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- unsigned long IRCcode = 0;
- unsigned long xpto = 0;
- void setup()
- {
- Serial.begin(9600);
- irrecv.enableIRIn(); // Inicializa o receptor
- }
- //---------------------------------------------------
- void loop() {
- if (irrecv.decode(&results))
- {
- if (results.value != 0xFFFFFFFF)
- {
- IRCcode = results.value;
- Serial.println(IRCcode, HEX);
- EEPROM.put(addr, IRCcode);
- Serial.print("Endereco da memoria: ");
- Serial.print(addr);
- Serial.print("Valor gavado: ");
- EEPROM.get(addr, xpto);
- Serial.println(xpto, HEX);
- /*
- if (addr >= 0 && addr < EEPROM.length())
- {
- EEPROM.write(addr, IRCcode);
- delay(100);
- Serial.print("Endereco da memoria: ");
- Serial.print(addr);
- Serial.print("Valor gavado: ");
- Serial.println(EEPROM.read(addr), HEX);
- }
- if (addr == EEPROM.length()) {
- addr = 0;
- }
- addr++;
- } */
- irrecv.resume(); // Receba o próximo valor
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement