You are reading a single comment by @cwilt and its replies. Click here to read the full conversation.
  • 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.

About

Avatar for cwilt @cwilt started