Fade _01

Intro :

Generating outputs with varied control such as brightness, speed or position requires an analogWrite value and a PWM signal

An efficient way of programming incrementing changes to this value is by using a for loop

In this example there is a Functional Error in the code which successfully compiles but results in an unexpected behaviour from the LED. Try decifer where the issue arises.

---------------------------------------------------------------------------->

Fading LED :

Pins

    LED = D11
---------------------------------------------------------------------------->

Reflect :

Press the 'Start Simulation' button and observe the output in this example. What is the LED doing?

In this example ...

  • Why is the simulation showing a static on LED?
  • Why is the LED not fading?
  • How would you adapt the code blocks to get a 'fading' output?
  • ---------------------------------------------------------------------------->

    Edit it :

    Tinker this example

    Edit the code blocks to turn the static LED into a fading one

    Select this link to open the dashboard in a seperate tab. Then press the code button to edit the blockly or text-based code. Press start simulation to see the changes in action.

    ---------------------------------------------------------------------------->
    ---------------------------------------------------------------------------->
    ---------------------------------------------------------------------------->

    J3n Sykes

    GitHub | Back to examples