remember user-input boolean values after power off?

Status
Not open for further replies.

monkeybiscuits

Active member
Hi, I'm making a teensy midi controller with a few small buttons. Sometimes I need button to be momentary and sometimes I need a latch. It's easy enough to make the button behaviors switchable by using boolean values and a 'shift' button. But is there anyway to save those boolean values after the teensy has been powered down? I'm sure the SD shield could store whatever I need but that seems like overkill if all I need are a few boolean values.
 
You can use the EEPROM area on the chip to store a few bytes. Teensy 2.0's have 1,024 bytes. Teensy 2.0++'s have 4,096 bytes. Teensy 3.0/3.1's have 2,048 bytes. See the library page for more details: http://www.pjrc.com/teensy/td_libs_EEPROM.html.

Be sure to use a recent version of the teensyduino software. Some of the older revisions cleared out EEPROM values in the 3.0/3.1 when you load a new program. That has been fixed for a long time, but just in case you have an older release, you might want to consider moving up. With the latest releases, you can load a program to set up the defaults, and then load a different program to use them. Note, EEPROM memory has limited write cycles (100,000), so you might want to update the EEPROM only when the switch value changes.
 
Status
Not open for further replies.
Back
Top