-
• #2
I don't have a Smartibot, but setting
edge:'both'
should trigger button press on press and release:setWatch(function(e) { if (e.state) print("Button pressed"); else print("Button released"); }, BTN, {repeat:true; edge:'both'});
-
• #4
I just tried BTN1 and BTN2 , that has sorted that problem. I will see if I can change the documentation here
http://www.espruino.com/SmartibotThat just leaves the "block code" issue.
Thanks for replies, I will have to look at java script so I can better understand the documentation you pointed me at.
-
• #5
Glad you got this sorted - I'll change the Smartibot docs now.
If you need to modify them yourself in the future, the file is here: https://github.com/espruino/EspruinoDocs/blob/master/boards/Smartibot.md
I have updated my Smartibot to version 2.04 and last night started to work through some of the examples in the documentation.
First one I tried was button presses
When I download this "Button pressed" is printed only when Button A on the smartibot is pressed, nothing when released and nothing for Button B.
So looking at some examples I added
to the top and this made no difference.
I then tried the "block" coding and used the set watch construct.
First block was BTN1 rising and inside I change the colours of the leds. This was then duplicated for BTN1 falling, then I duplicated both for BTN2.
Downloaded and it worked.
Tried to change the code but somehow deleted everything, when I started again BTN2 was not available.
This morning I started to create the post, initially the same problem , no BTN2.
Tried refreshing the browser still did not work.
So I downloaded the raw javascript to prove that did not detect BTNB , it did not.
Then went back to "block" mode and BTN2 is available.
I am using Chrome on a mac and I am new to java script.
My questions are:
PS should I have tagged this post or posted elsewhere so it is obvious it is a smartibot issue I am having.
1 Attachment