EDIT: upon solving.
99% my own error of having a really noisy signal on pin 1 - just plain messed things up
also needed this line:
in the current release as a workaround for some timer issue - according to Hugo.
I have a function that sets a new wakeup each 20 seconds. I ran the imp overnight and checked it in the morning - the planner log shows the wakeups occurring each 13 or 14 seconds for an average of 13.35 seconds.
What is the reason for the difference?
//each 20 seconds, change the interrupt so that //when a pin is read, the power is calculated at that moment //Then the function is set back to the normal counter count = CalculatePower; imp.wakeup(20.0,setforReading);
and this code might be pertinent. The function ‘count’ is normally just indexing a counter when the pin is high but each 20 seconds I change the function count to be one that gives me a power reading upon the interrupt before setting it back to a normal counter.
I am making a watt meter using a chip that puts out pulses at a frequency corresponding to instantaneous power. I have just realized it may not be trivial to get a time base against which to calculate the power.
will hardware.micros() be more accurate and will that be repeatable?
Will I need to perform periodic calibrations of hardware.micros by checking against the time function?
Naturally, i will be trying to figure this out but any help to speed up my tests will be most appreciated.