Yes, I think var led = require("RGBLed").connect([LED1, LED2, LED3], false) would work - however as that's using an external module you'd have to connect to the Puck with the Web IDE and upload the code that way (rather than using Web Bluetooth like you are), as then the Web IDE can upload the module for you.
However if you wanted to access stuff directly (rather than using that module) then the second link you posted would work great. I just posted an update on that thread - the problem reported there was fixed in the 1v90 firmware.
So, if you're using an up to date firmware, you can modify your code to do:
You just need to make sure that you tweak the 3 numbers in that string to be what you want - they range between 0 and 1.
Just to add: When you're using PWM and lighting LEDs it'll be running the battery down quite a bit (probably 100x faster than it does when it's idle). It's probably worth adding a button that does Puck.write('LED1.reset();LED2.reset();LED3.reset();\n'); so you can stick the Puck back into a state where it's not using much power when you're finished.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, I think
var led = require("RGBLed").connect([LED1, LED2, LED3], false)
would work - however as that's using an external module you'd have to connect to the Puck with the Web IDE and upload the code that way (rather than using Web Bluetooth like you are), as then the Web IDE can upload the module for you.However if you wanted to access stuff directly (rather than using that module) then the second link you posted would work great. I just posted an update on that thread - the problem reported there was fixed in the 1v90 firmware.
So, if you're using an up to date firmware, you can modify your code to do:
You just need to make sure that you tweak the 3 numbers in that string to be what you want - they range between 0 and 1.
Just to add: When you're using PWM and lighting LEDs it'll be running the battery down quite a bit (probably 100x faster than it does when it's idle). It's probably worth adding a button that does
Puck.write('LED1.reset();LED2.reset();LED3.reset();\n');
so you can stick the Puck back into a state where it's not using much power when you're finished.Hope that helps!