You are reading a single comment by @cwilt and its replies. Click here to read the full conversation.
  • You should move var start below the definition of toggle. Now you'll be closer to the real number. Final step is to actually measure the toggle with an oscilloscope :)

  • You are correct. I should move start. It will be put on the work bench and tested when time permits. So far I have only been able to pay with the pico on my phone using OTG cable and briefly from my laptop last night.

    I will update here if there is a significant change from moving the start.

    Update:
    Moving var start brought it up to 38.7 Khz.

    function toggle(){
      "compiled";
      var A = digitalWrite;
      var B = B2;
      for (var i=0;i<10000;i++){
        A(B,1);
        A(B,0);
      }
    }
    var start = new Date();
    toggle();
    var end = new Date();
    var time = end-start;
    time = (10000/time);
    console.log(time.toFixed(2)+" Khz");
    

    Update:
    33.28Khz

About

Avatar for cwilt @cwilt started