Hi,
This is my first electric imp project. I am trying to log different values generated using the env tail into the nv table and periodically uploading it through the agent into my storage (to conserve battery life). I put my imp in deepsleep to disconnect it from wifi. I am trying to log the values in different arrays and finally moving the arrays to the nv table with different keys.
nv.t <- array();
append values in temp()
nv.t = temp();
However, every time I upload the data after an hour i get an error. I was wondering if there is a better more efficient way of logging multiple values on a nv table.
What error are you getting?
Without seeing your code it’s hard to be specific, but I suspect you’re overwriting the nv table every time you restart. Your second line certainly overwrites the array set in the first with the result returned by the function temp() - a float presumably. What you want is something like:
`// Start of Program
if (!("nv" in getroottable()) {
// Create 'nv 'and add empty array, 't', for temperature values
nv.t <- [];
}
. . .
// Add latest temperature reading to 't' array in 'nv'
nv.t.append(temp());
. . .
// Send periodic batch of readings to agent
agent.send("upload.data", nv.t);
// Clear array 't' of sent values
// nv.t = [];`
Hey Smitty,
Thanks for the quick response. I was overwriting the nv table! Thanks for the help my code is working now.