I have a Yun which reads sensor values from the 32U4, puts those values in the bridge, and hosts a web page on the AR9331 sd card which pulls the values from the bridge using javascript. This all works great.
I also want to store those values in the bridge to a local data file on the sd card. The values are not stored on the 32U4 to save memory, only in the bridge. So after a certain # of minutes, I want to store the values in the bridge to a data file, then clear the bridge to accept new values for each key. I know how to clear the bridge, just not how to write to a local file before I clear the values.
Does anyone know of an example or can provide a brief explanation that I can look into further? I'd like to use the AR9331 side to write to the file.
It shouldn't be too hard to do it using a Python script. See this link for ideas about how to read the bridge variables using Python: Python for Bridge Library
Once you get data from the bridge into Python variables, you can then write them out to a file: 7. Input and Output - Python
You can write the script to have an infinite loop that waits a certain time, then reads/writes the data, and then loops back to do it again. This script can be launched by calling it from /etc/rc.local, or the sketch can launch it using a Process object from the Bridge Library.
Or, you can write the script to perform a single pass, and then periodically launch it using cron.
This is great info! Thank you very much.
Let me give this a try and see how it works out. I want to tell the script when to run using Process from the Bridge Library.