Control _01

Intro :

Now you have an understanding of analogInput and the Serial monitor, let's transfer it to text-based code and the physical realm via the Arduino IDE

We will explore how we observe and reflect upon the relationship between code (software) and components (hardware).

Observe the behaviour of the dial that controls the LED brightness.

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

Controlling an LED :

We will take the control task into physical components and Arduino IDE. Wire your components to the following pins

    LED = D11
    Long leg = positive
    Short leg = negative
    Potentiometer = A0
---------------------------------------------------------------------------->

Feedback Shield:

If you have a feedback shield place it on top of your Arduino board and view what visual feedback you get when you make changes to your code.

Remember the Feedback Shield provides colour coded feedback via its corresponding LEDs

    The PWM analogWrite value out of pin 11 is represented in blue
    The analogInput value on pin A0 is visually represented in blue as well.
    You may see all the Analog Input (A0-4) pins light up. This is due to noise on unconnected analog signals. Concentrate on the one that fades.
    The values are represented by the brightness of the LED.
    Observe the relationship between the brightness levels of each LED

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

Reflect :

Observe the output in the physical space. What is the physical LED doing?

When using the shield ...

    What colour is the corresponding LED for pin 11?
    How is the output LED behaving, is it getting brighter in relation to turning the dial?
    How does the A0 LED and pin 11 LED behave in relation to each other?
    Does the shield LED behave in relation to your physical LED on the breadboard?

In addition ...

    What values are printed to the Serial Monitor
    How is the output LED behaving, is it getting brighter in relation to turning the dial?
    How would you adapt the code to make the relationship between input to output correlate
---------------------------------------------------------------------------->

Edit it :

Try edit the code to make the relationship between the potentiometer and the brightness of the LED correlate. Consider what line of code might need to be added to create the visual difference.

Copy the Function Error code below into your Arduino IDE and begin editing it. Once you think you have solved the Functional Error upload to your board to see the visual difference. Remember to check the board and port match your Arduino board and USB port in use.

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

J3n Sykes

GitHub | Back to examples