LED1 not working in Bangle.js emulator #1270
Replies: 14 comments
-
Posted at 2019-11-29 by Robin Fri 2019.11.29
Hi Tony @user106108 While we are all excited about the new Bangle.js product launch and the availability to test some sample code snippets now, we may be too excited on what functionality we may expect. The emulator is a brand new (past week) playground on which to test sample snippets. Most emulated functionality will be up to the community to provide as that would be up to the imagination of each individual. > For others that are reading along: I presume these are the links that were started with:
I followed the instructions as stated in #53 verbatim:
To confirm, did that snippet sample run without error for you also? Even though there aren't defined LED labels, simulated output might be done as follows: Now on to your specific situation; > 'but when I try to run any code that references LED1, I get the error: > Uncaught ReferenceError: "LED1" is not defined'
Create a definition to replace the missing LED1? What exactly is trying to be accomplished? Trying to add LED simulation on the dial perhaps? As the sample using buttons does execute, as we are able to observe from L1 that there is an array of defined button constants, BTN1 thru BTN5
So, what does the label definition for LED1 appear like in the code referenced in #1 above? Posting could help others assist here. Gordon also mentions in #56 how to go about making individualized edits and improvements. Links there. Looking at the GitHub source (link in #56) also reveals that currently there aren't labels for the LEDs. That it where the individual edit functionality is added. One really simple idea - add to end of sample snippet in #53
I'll edit and update with new detail as I learn it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-11-30 by @allObjects @user106108 Bangle.js has no |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-11-30 by @allObjects (Intentionally emptied.) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-11-30 by @MaBecker Hi @user106108 the emulator start just with some sample lines of code, so don't get confused with that. Just replace it with your own code and press "Send to Espruino" and have fun ;-) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-11-30 by @gfwilliams Yeah, a good 95% of Espruino boards have an LED so the code is generally a good starting point - but Bangle.js doesn't have an LED so that code won't work (on the Emulator and also on Bangle.js itself). At some point I'll change it so that it looks at which board you're using and changes the code accordingly |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-11-30 by @allObjects ...LED with changing as mentioned in Post #3: Some Fun... bangle.js 'project' - click clip (link) at the bottom. Since with the constructed Software LED - as outlined in the conversation about Bangle.js (and emulator), where did you leave my LED, LED1, LEDX? - you can set any color, you can make it even a neopixel like thing that changes color over time... see Reusing some RGB LED interior lighting modules. I changed the code only slightly: instead of using pins and writing pwm (analog), I store the rgb values in pr, pg, pb variables. Then, in intervals, I set the color of the led and set the led itself... which updates the color of the led... ;-) Caution: 20 times per second I change the color and fill a circle of 80 pixels in diameter. I do not know if bangle can keep up with the redraw... after all, it does all the graphics and talks byte by byte to the display... Therefore: all your banglejs-ers out there, give the code a shot and report back... Interesting detail: seven (7) independent intervals are going on... try this with Arduino: would become quite a time_and_if_mess... Espruino's event drivenness is the right solution here. (I did though not adjust / update the pwm and delta pwm factors.... in other words: colors changes and speed of changes happen way more often that the LED is updated... To save some cpu cycles, the code could be inverted and new color(s) only calculated once per LED update - just before LED update...).
Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-01 by user106108 Thanks, the code from #53 does indeed run. I guess my mistake was to try and follow the tutorial in the IDE - I didn't realise that it didn't apply to the watch. Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-01 by user106108 Cool, thanks for that. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-01 by Robin Sun 2019.12.01
'tutorial in the IDE'? @user106108 would you mind posting the link to the tutorial you have discovered so that we may determine how to steer others away from the same frustration. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-01 by user106108 Please see in the attached screenshot, towards the top-right. Cheers, Tony.Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-01 by Robin Thank you Tony. Now that I re-read your post #1, the reference to BTN along with LED1 now makes all the sense in the world! (wondered what code snippet was being used) Have been so immersed in the website tutorials, totally zoned (two years since I touched it) on the fact there remains the tutorial there. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-04 by @gfwilliams Thanks - I think the IDE even points you to it when it first starts. I guess I should add the 'fake' LED - it would make this sort of thing a lot easier. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-04 by @allObjects Fake LED, fake news, fake... only Bangle.JS is not fake - that I know for sure! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-12-04 by @gfwilliams Fake LEDs just added - will go live in the emulator in the next few hours |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-11-29 by user106108
Hi. Looking forward to my Bangle.js next year. I was trying out the emulator, but when I try to run any code that references LED1, I get the error:
Uncaught ReferenceError: "LED1" is not defined
Is there anything I can do about that? There also was something similar when BTN was referenced in any code.
Thanks very much in advance for any help, Yours, Tony.
Beta Was this translation helpful? Give feedback.
All reactions