Difference between revisions of "EEPROM.read"

From Gamebuino Wiki
Jump to: navigation, search
(Fix some bug)
m (Returns: byte)
 
(3 intermediate revisions by one other user not shown)
Line 10: Line 10:
  
 
== Returns ==
 
== Returns ==
The value stored in that location
+
The value stored in that location (Byte)
  
 
== Example ==
 
== Example ==
 
<code>
 
<code>
#include <EEPROM.h>
+
  #include <EEPROM.h>
#include <SPI.h>
+
  #include <SPI.h>
#include <Gamebuino.h>
+
  #include <Gamebuino.h>
 
+
 
Gamebuino gb;
+
  Gamebuino gb;
 
+
 
byte levels_unlocked = 0;
+
  byte levels_unlocked = 0;
 
+
 
void setup()
+
  void setup()
{
+
  {
  gb.begin();
+
    gb.begin();
  gb.titleScreen(F("Read EEPROM"));
+
    gb.titleScreen(F("Read EEPROM"));
  levels_unlocked = EEPROM.read(0);
+
    levels_unlocked = EEPROM.read(0);
}
+
  }
 +
</code>
  
 
== See also ==
 
== See also ==
Line 34: Line 35:
 
* [[EEPROM.put]]
 
* [[EEPROM.put]]
 
* [[EEPROM.get]]
 
* [[EEPROM.get]]
</code>
 

Latest revision as of 2017-04-11T10:44:29

Description

Read the value corresponding to the adress

Syntax

EEPROM.read(address);

Parameters

  • address: the location to read from, starting from 0 (int)

Returns

The value stored in that location (Byte)

Example

 #include <EEPROM.h>
 #include <SPI.h>
 #include <Gamebuino.h>
 
 Gamebuino gb;
 
 byte levels_unlocked = 0;
 
 void setup()
 {
   gb.begin();
   gb.titleScreen(F("Read EEPROM"));
   levels_unlocked = EEPROM.read(0);
 }

See also