How to get RGB LED working on Puck.js #1806
Replies: 19 comments
-
Posted at 2016-12-17 by scottjenson OK, figured it out. After poking around your other Espruino boards, I noticed instead of C7 you sometimes used LED1 so I tried this instead: var led = require("RGBLed").connect([LED1, LED2, LED3], false); This works. I would still make a polite request that you figure out a way to have your Espruino docs work better for your new puck.js users. One suggestion would be to have, in your getting started section a simple doc that covers this point with a list of Pinout constants (such as BTN1 and LED1) so we have a chance of figuring this out on our own a bit quicker. Thanks for a great little board! Really enjoying playing with it. My first project is a 'Conference beacon': I press puck once and it broadcasts my Physical Web URL for 1 hour and then auto turns off. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-17 by @MaBecker @scottjenson - please check http://www.espruino.com/Puck.js too |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-17 by scottjenson First place I checked! Didn't help me in the least I'm afraid:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-17 by @allObjects Espruino runs on manyboards and samples have to be adjusted to the board usen. Reference has for every board the pins and their cpabilities avsilabe. The choice of pins (and buttons - which are pins too) depend on the application. Doc for some example list choices of pins for the original board and the PICO. That could be places to add also a column for Puck. A lot is community based and @gfwilliams is very happy and gladly accepting pull requests from community individuals. The repository can be cloned, the files modified, committed, and pull requests against original can be made. Definitively things can be enhanced... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-17 by scottjenson I totally appreciate that point. I hope my suggestion to add something to the puck.js examples page would be easy and impactful:
An additional point: as pin constants are such an obvious point of difference across all of the Espiruino boards, placing an introductory file at the top of the general reference section with links to all the pinouts would also be very helpful to noobs like me. Scott |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-17 by Frida
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-17 by scottjenson Thank you Frida! That's different from all of the other examples I found. Looking forward to try it out. Scott |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-19 by @gfwilliams Thanks - yes, it's a good point. I added code to the Puck.js page to cover the more exciting on-board peripherals but a totally forgot about the LEDs and button. It's been a bit of a rush to get the hardware out on time and I haven't had as much time on the documentation as I'd hoped, but I will add a proper pin reference soon (like is there for the other boards) as well as those examples. The original Quick start guide (and hopefully the tutorial built into the Web IDE) might be a good place to start for LED control for the moment. Espruino has grown steadily from just one board to two, and now quite suddenly to 4 (plus the community-supported ones like ESP8266). When things calm down a bit here I'll have a good think about how I can re-organise everything to less confusing. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-19 by scottjenson Thanks Gordon. However, just adding the pinout diagrams likely isn't enough. Just point out in big letters (before you link to the pinouts) that now that there are 4+ boards, the chances of any of the reference code working generically is low. People should be warned that any code they find in the reference section needs to be checked against the pinouts for their particular board. At least, that was my experience. The first few examples I found in the reference section all failed. It's understandable of course, just saying that a little extra care in your docs up front will likely go along way. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-19 by @gfwilliams Thanks - where did you initially start looking? Here? http://www.espruino.com/Puck.js+Quick+Start I could definitely stick something at the bottom there... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-19 by scottjenson Yes, I assume my path was like others:
There are a lot of pages and, if I can be honest, it's a bit confusing. I popped back and forth quick a bit, not clear where I was. As I UX designer, I'd suggest a stronger home page that you don't leave. Just have a strong puck.js landing page with clear nav sections on the left:
I appreciate that you can't do the last one easily but if that puck.js 'reference' section listed the top 10 likely commands I'd use and then point to the full reference section (with my previous caveat about warning me about pins before heading over) That would be fine. Sorry, I'm a UX designer and I can't leave well enough alone. I'm loving playing with the puck, my comments are just meant to help improve your on-boarding process. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-19 by @gfwilliams Thanks - they're good ideas - yes, there's a lot there and it's not that well organised. The USB devices have a Quick Start page that immediately gets you turning lights on and off, and it would probably be good here too - there's just too much info on that first page already (I best most people don't ever get right to the end). I'm going to go through and make the whole site a bit more mobile-friendly soon, and I might try and make that Getting Started page walk you through step by step, hiding the stuff you're not interested in. Hopefully it'll tidy it up a bit and make a proper 'getting started' at the bottom seem a bit more sensible. Sadly it's unlikely before Christmas though - I'm stretched a bit too thin to do anything major on the documentation front at the moment. Glad you're enjoying it though - and if you see any quick fixes there's usually a link at the bottom to GitHub where you could submit a PR ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-19 by @MaBecker
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-19 by @MaBecker
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-20 by @allObjects @scottjenson, I'm sure you have noticed the updated Puck.js page - being a single page if feels like doc on steroids: all you need to know Puck specific... and it also shows that with newest firmware the BTN1 / BTN and LED and LED1 things are well resolved... and the pin things too! On a different note to @scottjenson: check this about running lights out: it may be instrumental what you try to do... ;-) ..of course, just 'one' discrete RGB 'light'. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-20 by @allObjects @MaBecker: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-21 by @MaBecker @allObjects: Why ? The sample from post #15 runs without errors and works like designed on 1v90.5 line 8. switches a single led at index=i%count |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-21 by scottjenson Thank you! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-12-21 by @MaBecker
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-12-17 by scottjenson
I'm a bit confused by the Espruino documentation. Much of the code in the reference section doesn't work on the puck.js. The simple Button code didn't work due to a simple BTN vs BTN1 difference. Now I'm trying to get the RGB led to work. The code was easy enough to find on the reference site:
var led = require("RGBLed").connect([C7, C8, C9], false);
However this fails as C7..C9 are not defined. I assume this is a similar problem to my button issue (incorrect pin names). So I really have two questions:
Beta Was this translation helpful? Give feedback.
All reactions