-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheeprom-test2.c
50 lines (40 loc) · 1.21 KB
/
eeprom-test2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma config(Sensor, S1, EEPROM, sensorI2CCustom)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*
* $Id: eeprom-test2.c 133 2013-03-10 15:15:38Z xander $
*/
/**
* eeprom.h provides an API for the AT24C512, 24AA512 and 24AA1025 EEPROMs. This program
* demonstrates how to use that API.
*
* Changelog:
* - 0.1: Initial release
* - 0.2: Removed common.h include\n
* Removed array structs, replaced with typedefs
*
* License: You may use this code as you wish, provided you give credit where it's due.
*
* THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.
* Xander Soldaat (xander_at_botbench.com)
* 20 February 2011
* version 0.2
*/
#include "drivers/eeprom.h"
//tByteArray data;
task main () {
tByteArray data;
memset(data, 0, sizeof(tByteArray));
data[0] = 22;
EEPROMwriteBytes(EEPROM, 0, data, 1);
// After a write, you *must* wait 5 msec
wait1Msec(5);
eraseDisplay();
memset(data, 0, sizeof(tByteArray));
EEPROMreadBytes(EEPROM, 0, data, 1);
// Make sure the string is 0 terminated.
nxtDisplayTextLine(1, "%d", data[0]);
wait1Msec(2000);
}
/*
* $Id: eeprom-test2.c 133 2013-03-10 15:15:38Z xander $
*/