/* ----------- [Ag_xtr_05] - Using Agriculture EEPROM Example ----------- Explanation:This example shows how to use the EEPROM memory of Smart Agriculture Xtreme board. Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L. http://www.libelium.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Version: 3.1 Design: David Gascón Implementation: J.Siscart, V.Boria */ #include // address in the Smart Agriculture Xtreme EEPROM int address = 0x51; // value to write int value = 10; // Aux variable int data = 0; void setup() { // Init USB USB.ON(); } void loop() { // WARNING: Reserved EEMPROM addresses below @0x50 // SensorXtr.writeEEPROM do not let the user to write // below this address. // Do not try to write below this address as // you could over-write important configuration // --> Available addresses: from 0x51 to 0x7F // Writing in the Smart Agriculture Xtreme EEPROM SensorXtr.writeEEPROM(address, value); // Reading the Smart Agriculture Xtreme EEPROM data = SensorXtr.readEEPROM(address); USB.print(F("Address EEPROM: ")); USB.print(address,DEC); USB.print(F(" -- Value: ")); USB.println(data, DEC); address++; value++; if(address >= 0x7F) { address = 0x51; USB.println("END"); delay(10000); } delay(1); } Sw xtr 05: read write eeprom | Libelium

Development

» Sw xtr 05: read write eeprom

This example shows how to use the EEPROM memory of Smart Agriculture Xtreme board.

Required Materials

- 1 Waspmote Plug & Sense! Smart Water Xtreme

Notes

- This example is only valid for Waspmote v15

Code

/*
    ----------- [Ag_xtr_05] - Using Agriculture EEPROM Example -----------

    Explanation:This example shows how to use the EEPROM memory of 
    Smart Agriculture Xtreme board.

    Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
    http://www.libelium.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    Version:           3.1
    Design:            David Gascón
    Implementation:    J.Siscart, V.Boria
*/

#include <WaspSensorXtr.h>

// address in the Smart Agriculture Xtreme EEPROM
int address = 0x51; 
// value to write
int value = 10;  
// Aux variable
int data = 0;
 
 
void setup()
{
  // Init USB
  USB.ON();
}

void loop()
{
  // WARNING: Reserved EEMPROM addresses below @0x50
  // SensorXtr.writeEEPROM do not let the user to write 
  // below this address.
  // Do not try to write below this address as 
  // you could over-write important configuration
  // --> Available addresses: from 0x51 to 0x7F
  
  // Writing in the Smart Agriculture Xtreme EEPROM  
  SensorXtr.writeEEPROM(address, value);
  
  // Reading the Smart Agriculture Xtreme EEPROM
  data = SensorXtr.readEEPROM(address);
  USB.print(F("Address EEPROM:  "));
  USB.print(address,DEC);
  USB.print(F(" -- Value: "));
  USB.println(data, DEC);
  
  address++;
  value++;
  
  if(address >= 0x7F) 
  {
    address = 0x51;
    USB.println("END");
    delay(10000);    
  }
  delay(1);
}

Output

J#
Address EEPROM: 81 -- Value: 10
Address EEPROM: 82 -- Value: 11
Address EEPROM: 83 -- Value: 12
Address EEPROM: 84 -- Value: 13
Address EEPROM: 85 -- Value: 14
Address EEPROM: 86 -- Value: 15
Address EEPROM: 87 -- Value: 16
Address EEPROM: 88 -- Value: 17
Address EEPROM: 89 -- Value: 18
Address EEPROM: 90 -- Value: 19
Address EEPROM: 91 -- Value: 20
Address EEPROM: 92 -- Value: 21
Address EEPROM: 93 -- Value: 22
Address EEPROM: 94 -- Value: 23
Address EEPROM: 95 -- Value: 24
Address EEPROM: 96 -- Value: 25
Address EEPROM: 97 -- Value: 26
Address EEPROM: 98 -- Value: 27
Address EEPROM: 99 -- Value: 28
Address EEPROM: 100 -- Value: 29
Address EEPROM: 101 -- Value: 30
Address EEPROM: 102 -- Value: 31
Address EEPROM: 103 -- Value: 32
Address EEPROM: 104 -- Value: 33
Address EEPROM: 105 -- Value: 34
Address EEPROM: 106 -- Value: 35
Address EEPROM: 107 -- Value: 36
Address EEPROM: 108 -- Value: 37
Address EEPROM: 109 -- Value: 38
Address EEPROM: 110 -- Value: 39
Address EEPROM: 111 -- Value: 40
Address EEPROM: 112 -- Value: 41
Address EEPROM: 113 -- Value: 42
Address EEPROM: 114 -- Value: 43
Address EEPROM: 115 -- Value: 44
Address EEPROM: 116 -- Value: 45
Address EEPROM: 117 -- Value: 46
Address EEPROM: 118 -- Value: 47
Address EEPROM: 119 -- Value: 48
Address EEPROM: 120 -- Value: 49
Address EEPROM: 121 -- Value: 50
Address EEPROM: 122 -- Value: 51
Address EEPROM: 123 -- Value: 52
Address EEPROM: 124 -- Value: 53
Address EEPROM: 125 -- Value: 54
Address EEPROM: 126 -- Value: 55
END

Quick Publish: