Avatar for user71469

user71469

Member since Dec 2016 • Last active Dec 2016
  • 0 conversations
  • 1 comments

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user71469

    I'm pretty new to coding in general, so please excuse me if I have missed something obvious.

    I am able to turn each of the LEDs on and off using a webpage:

    Red:

    <button onclick="Puck.write('LED1.set();\n');">o­n</button>
    <button onclick="Puck.write('LED1.reset();\n');"­>off</button>
    

    Green:

    <button onclick="Puck.write('LED2.set();\n');">o­n</button>
    <button onclick="Puck.write('LED2.reset();\n');"­>off</button>
    

    Blue:

    <button onclick="Puck.write('LED3.set();\n');">o­n</button>
    <button onclick="Puck.write('LED3.reset();\n');"­>off</button>
    

    Nifty. I assume that using PWM or some other technique, I could pass RGB values to the Puck and get any color to display. I built the webpage and have sliders doing all kinds of fancy stuff... but I can't figure out how to send the RBG values to the Puck.

    In other words, instead of on/off, how do I send rgb(80, 128, 199) (which is #50DAC7) to the three LEDs?

    I think that this and this are moving me in the right direction, but I am not a coder and thus can't figure out how to apply it to my problem.

    For anyone curious, what I have so far is attached. Comments are welcome!

Actions