Pico JS compilation issue with peek32/poke32 #5238
Unanswered
espruino-discuss3
asked this question in
General
Replies: 1 comment
-
Posted at 2016-04-06 by @gfwilliams Ahh, this is because the pin mode hasn't been set to an output first. Try:
I imagine that will work fine - I'll update the documentation to mention it. Posted at 2016-04-06 by 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. Attachments: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-04-06 by Trogdor1967
I tried to use the example code provided on the JS Compilation page: http://www.espruino.com/Compilation .
The code is as follows:
However, when I call toggler(), the pin does not change. If I substitute ...
... 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?
Beta Was this translation helpful? Give feedback.
All reactions