jacdac.stop()
let st = false
while (true) {
// let end =control.millis() + 20
// while (control.millis() <end);
let pre = control.millis()
pause(20)
let len = control.millis() - pre
control.dmesg("" + len)
pins.D1.digitalWrite(true)
pins.D1.digitalWrite(false)
st = !st
pins.D2.digitalWrite(st)
}
produces something like the following:
It's quite irregular. More importantly, control.millis() returns bogus data - many periods are reported to be way over 20ms even though it's clearly not the case on the scope.
The following makecode program
produces something like the following:
It's quite irregular. More importantly,
control.millis()
returns bogus data - many periods are reported to be way over 20ms even though it's clearly not the case on the scope.If instead of
pause()
we do the delay loop, and disable jacdac (as in the program), we get nice 25Hz wave. With jacdac it's a complete mess.It should be easy to replicate in C++.