lab eeprom

Dependencies:   eeprom mbed

Fork of Nucleo_eeprom by FRA221_2016

main.cpp

Committer:
soulx
Date:
2015-08-25
Revision:
2:27acee628363
Parent:
1:8b005d040c91
Child:
3:8d9d440c1a2c

File content as of revision 2:27acee628363:

#include "mbed.h"
#include "eeprom.h"


EEPROM memory(I2C_SDA,I2C_SCL,EEPROM_Address);

int main()
{
    char value='A';
    char data[2];
    memory.write(1,value);
    memory.write(2,'a');
    memory.read(1,data,2);
    printf("read[1] = %c\n",data[0]);
    printf("read[2] = %c\n",data[1]);
    
    float x=0.0f;
    memory.write(10,1.23f);
    memory.read(10,x);
    printf("float = %f\n",x);
    
    int16_t y=16200,z;
    memory.write(1,y);
    memory.read(1,z);
    printf("int16 =%d\n",z);
    
}