I have started with this example as a base to modify for my needs:
I am measuring time between pulses to calculate current power use. But I also want to keep track of pulses per hour and per day. I am lost at math that is used in the example to modify. I dont need an array to store, as data will be picked up but another device and stored elsewhere.
Some pseudo-code =)
For every pulse
if hour > previous hour then hourPulses =0
if day > previous day then dayPulses =0
send NRF data
Something like that. I just dont know how it will work when moving into a next day.
The example in the link above somehow magically sets it into an array. But I just want one value to be sent for the current hour and day.
Interactive live playground:
I have another reading that shows current watts based on time between the pulses.
But I wanted to keep track of the total pulses for the day and actual kW use per hour. But for this I need to know when the current hour or day is over
Does the time sync happen during the code upload? Guess it would break then when doing battery replacement
ok, got it sorted
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem