Interestingly, . . . we aren't seeing any! ;-)
Would you mind posting the current output?
'the LED which pules every 0.001 kWh of energy thats used'
Assumptions: So, if 1kW is used per hour, we should be seeing roughly three pulses a second? Based on my actual usage then, roughly one pulse per second perhaps? Have you tried just monitoring the pin with digitalRead() inside a loop to see if actual pulses are being detected by the Pico in order to separate whether this is a hardware or software issue?
var intervalID = {};
function ci() { clearInterval( intervalID ); }
var delay = 500;
var nTimes = 40;
// Start Timer
function st() {
intervalID = setInterval(function () {
console.log( "D0: " + digitalRead(D0) );
// Flash onboard Red LED
digitalWrite(LED1, digitalRead(D0));
}, delay);
}
Would you please post the output so we may verify hardware vs software. Although the version shouldn't be an issue here, would you post process.env also, thanks.
Should the output appear reasonable based on the assumptions above, then it would make sense to then move on to the setWatch() function.
It is still possible that ~5% (2K / 40K) of the supply voltage is still not close enough to be detected as a logic zero. Would changing to 'pulldown' and reversing the code logic allow a logic high to be detected instead?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Sat 2019.04.06
Hello @sammachin sounds like a fun project.
Interestingly, . . . we aren't seeing any! ;-)
Would you mind posting the current output?
Assumptions: So, if 1kW is used per hour, we should be seeing roughly three pulses a second? Based on my actual usage then, roughly one pulse per second perhaps? Have you tried just monitoring the pin with
digitalRead()
inside a loop to see if actual pulses are being detected by the Pico in order to separate whether this is a hardware or software issue?or something like: (code untested)
Would you please post the output so we may verify hardware vs software. Although the version shouldn't be an issue here, would you post
process.env
also, thanks.Should the output appear reasonable based on the assumptions above, then it would make sense to then move on to the
setWatch()
function.Shouldn't line 30 and 32
as I don't see the element indexer 'dt' changing.
Another thought: (from the passive section in link #1)
With the pin mode that is currently selected
It is still possible that ~5% (2K / 40K) of the supply voltage is still not close enough to be detected as a logic zero. Would changing to 'pulldown' and reversing the code logic allow a logic high to be detected instead?
See: Table 46 doc page 86
Don't forget to adjust for 3.3V vs 5V