A command to create a new LED object that can be programmed in the same way as the blocks in the Circuit drawer. The
var myLed = createLed() command creates a new LED object named
myLed that behaves just like the
led blocks you've been using. Remember to pass in a pin parameter so the board knows where the LED is connected.
// Create a new LED object attached to pin 2 var myLed = createLed(2); // turn myLed on myLed.on();
var leftLED = createLed(3); leftLED.blink(200); var rightLED = createLed(10); rightLED.blink(200);
var myLed = createLed(pin);
|Pin||number||The number of the pin your LED is connected to. This is usually printed on your board, but can also be found in your board's documentation.|
New LED object
led.pulse()will not work with new LEDs.
Found a bug in the documentation? Let us know at email@example.com