-
• #2
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.
-
• #3
@scottjenson - please check http://www.espruino.com/Puck.js too
-
• #4
First place I checked! Didn't help me in the least I'm afraid:
- no pinouts
- No LED examples
- no button examples
It's a great start but I'd argue things like like buttons and LEDs should also be there.
- no pinouts
-
• #5
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 @Gordon 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...
-
• #6
I totally appreciate that point. I hope my suggestion to add something to the puck.js examples page would be easy and impactful:
- have a list of puck.js pin constants
- add a simple LED example
- add a simple button example
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
- have a list of puck.js pin constants
-
• #7
setWatch(function() { digitalPulse(LED2, 1, 200); },BTN1,{ repeat: true, edge:'rising', debounce:10});
-
• #8
Thank you Frida! That's different from all of the other examples I found. Looking forward to try it out.
Scott
-
• #9
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.
-
• #10
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.
-
• #11
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...
-
• #12
Yes, I assume my path was like others:
- Quick start
- Puck.js examples/tutorials
- Puck Reference section
- Full Reference section
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:
- Setting up the puck
- Setting up the WebIDE (with a simple 'blink' style example)
- Tutorials/Examples
- Puck.js function reference (with pins all functions)
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.
- Quick start
-
• #13
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 ;)
-
• #14
// led sample for Puck.js var LED = [LED1,LED2,LED3]; // array of leds var BTN = BTN1; // name of button var i = 0; var count = LED.length; setWatch(function (e) { if (e.state) { LED[i%count].set(); } else { LED[i%count].reset(); i++; }}, BTN, { repeat:true, edge:'both',debounce : 20 } );
-
• #15
// led sample for Puck.js var LED = [LED1,LED2,LED3]; // array of leds var BTN = BTN1; // name of button var i = 0; var count = LED.length; setWatch(function (e) { LED[i%count].write(e.state); if (! e.state) i++; }, BTN, { repeat:true, edge:'both',debounce : 20 } );
-
• #16
@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'.
-
• #18
@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
on
oroff
depending one.state
-
• #19
Thank you!
-
• #20
var LEDS = [LED1,LED2,LED3]; // array of leds var BUTTON = BTN1; // button var count = LEDS.length; var i = 0; setWatch(function (e) { LEDS[i%count].write(e.state); if (! e.state) i++; }, BUTTON, { repeat:true, edge:'both',debounce : 20 } );
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:
1) How do I get the RBG LED defined and working and more generally
2) How can I get puck specific docs when the Espruino docs don't work?