First I want to say hello and thank the developers for a very cool little board. Post man delivered a Pico to me the day before yesterday. One of the first things I do is figure out the fastest ways to toggle an IO pin.
Most methods produced something between 2.7 and 5.1 Khz.
This is the fastest I could come up with that produces 37.31 Khz. The only other method that I have not tried would be to duplicate the code below with inline assembly.
var start = new Date();
function toggle(){
"compiled";
var A = digitalWrite;
var B = B2;
for (var i=0;i<10000;i++){
A(B,1);
A(B,0);
}
}
toggle();
var end = new Date();
var time = end-start;
time = (10000/time);
console.log(time.toFixed(2)+" Khz");
This may be of no use to anyone else but it satisfies my personal curiosity.
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.
First I want to say hello and thank the developers for a very cool little board. Post man delivered a Pico to me the day before yesterday. One of the first things I do is figure out the fastest ways to toggle an IO pin.
Most methods produced something between 2.7 and 5.1 Khz.
This is the fastest I could come up with that produces 37.31 Khz. The only other method that I have not tried would be to duplicate the code below with inline assembly.
This may be of no use to anyone else but it satisfies my personal curiosity.