HomePage RecentChanges Teensy EEPROM Config

Storing config in EEPROM is easy and works in most environments. No need to be Teensy, or even Arduino, but here is my Teensy specific data.

#!C
#include <EEPROMex.h>
struct CONFIG {
	byte mode;
	int displayBright;		// -255 .. 255 (negative = inverse)
	unsigned long test;
	unsigned int displayInterval;	// How often to update display params?
	unsigned int environmentReadInterval;	// Read Temperature / Humidity
	unsigned int environmentLogInterval;	// Log / Display temperature / humidity
};
CONFIG config = { 0, 0, 0, 0, 0 };	// You can set defaults...

void setup() {
	EEPROM.setMemPool(0, 2048);  // EEPROMex did not know Teensy 3.1 default EEPROM size
	readConfig();

	// Display current
	Serial.print("Config test = ");
	Serial.println(config.test);

	// Increment each time starts up
	config.test++;
	writeConfig();
}

void loop() {
}

void readConfig() {
	EEPROM.readBlock( 0, config );
}

void writeConfig() {
	EEPROM.writeBlock( 0, config );
}

Software error:

Can't locate object method "endform" via package "CGI" at /data/scott.dd.com.au/wiki/modules/search.pl line 15.

For help, please send mail to the webmaster (webmaster@dd.com.au), giving this error message and the time and date of the error.