Storing and recalling the value of a variable
TonyA
Posts: 226
Hi,
I am using a pot (with RCTIME) to change the value of a variable. Is there a way I can store the current value of that variable with a switch and then "recall" that variable with another switch?
If anyone can point me in the right direction it would be greatly appreciated. Thanks again (and Happy new year).
Tony
I am using a pot (with RCTIME) to change the value of a variable. Is there a way I can store the current value of that variable with a switch and then "recall" that variable with another switch?
If anyone can point me in the right direction it would be greatly appreciated. Thanks again (and Happy new year).
Tony
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Yes, I would like to be able to record the value of the variable at any given time with the push of a button and then to retrieve it at any given time with another button.
This is for my midi appilcations. I want to be able to preset sound bank changes. Like if using the sound patch "water bells", I can press a button and store it's value (127) and return to "water bells" at any given time by pressing a button rather than scrolling with my pot.
Thanks again,
Tony
· IF (StorePatch = Pressed) THEN
··· WRITE PatchAddr, patchVal
· ENDIF
· IF (RecallPatch = Pressed) THEN
··· READ PatchAddr, patchVal
····' do something with patchVal
· ENDIF
StorePatch and RecallPatch are button inputs, Pressed is a constant (0 or 1)·that defines the state of the input when a button is pressed, PatchAddr is the location in EEPROM you want to use to store the value, and patchVal is , of course, the sound patch (0 - 127).· By using WRITE for storage you can reset/restart the program and still have the stored value available for recall.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I see, yeah. That's all I need. Thanks again for your help, I really appreciate it.
Tony
Post Edited (TonyA) : 1/7/2006 8:21:04 PM GMT