The RGB LED

Volume 2, Page 5 - Control the brightness with JavaScript code

var five = require('johnny-five');
var board = new five.Board();

board.on('ready', function() {

  // make sure to connect the RGB leads to the
  // correct pin numbers on your Arduino board
  var green = new five.Led(9);
  var red   = new five.Led(10);
  var blue  = new five.Led(11);
  
  // In order to use the pulse method, you can
  // only use PWM pins. More information in
  // PodPi volume 9 on the PWM feature

  red.pulse(1000);
  green.pulse(1600);
  blue.blink(2300);
  // change the pulse timings and see what happens
});