This page has no translation to Español yet. The original English version is below. If you’d like to help, great! See how to translate a documentation page in the contribution guide.
Note This is a web-version of a tutorial chapter embedded right into the XOD IDE. To get a better learning experience we recommend to install the desktop IDE or start the browser-based IDE, and you’ll see the same tutorial there.

LED Node

Screenshot of 103-led

You already made a blinking LED and controlled it in the interactive session. But you have only feed it with the values of true and false. The false value auto-converts to 0 and represents no glow at all, whereas the true value converts to 1 and denotes the full brightness.

You can also set an intermediate brightness level by setting values between 0 and 1.

Circuit #

Assembling LED to Uno

↓ Download as a Fritzing project

Exercise #

Let’s fine-tune LED brightness.

  1. Assemble a circuit according to the scheme, and connect the board to your computer.

  2. Set the value of the PORT pin to D11. Leading “D” means that it’s a digital port.

  3. Replace the tweak-boolean node with tweak-number.

  4. Upload the program with the interactive session enabled.

  5. Change the value of tweak-number in the range from 0 to 1 and see how the brightness of the LED changes.

👆 PWM feature #

An LED can change the brightness only if connected to a board pin which supports PWM. If you have an Arduino board, find out the port number with the leading “~” symbol.

Many board models have no PWM on D13, so we wire the LED to another pin.

Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.