Avatar for Trogdor1967

Trogdor1967

Member since Apr 2016 • Last active Apr 2016
  • 1 conversations
  • 2 comments

Most recent activity

  • in General
    Avatar for Trogdor1967

    That did it!

    Thanks for the help, and I really am enjoying the Espruino!

    Note: I get a 7MHz square wave, not 8MHz. Nice and fast, and proves the point about compilation and direct STM register access!

    Screenshot attached.

  • in General
    Avatar for Trogdor1967

    I tried to use the example code provided on the JS Compilation page: http://www.espruino.com/Compilation .

    The code is as follows:

    function toggler() {
      "compiled";
      var pB2 = 0|B2.getInfo().out_addr;
      var cnt = 1000000;
      for (var i=0;i<cnt;i++) {
        poke32(pB2, 1); // on
        poke32(pB2, 0); // off
      }
    }
    

    However, when I call toggler(), the pin does not change. If I substitute ...

    digitalWrite(B1,1);
    

    ... for the first poke32(), it does work, generating a square wave with a large negative duty cycle. That makes sense, since much more code is executed before the digitalWrite() is complete.

    Likewise, I can use digitalWrite to reset the pin, and poke32 to set the pin, and I get a square wave with a large positive duty cycle.

    But, using poke32 for both set and reset generates no change on the pin.

    Has anyone tried this example on the Pico? Can anyone confirm this problem?

Actions