Ask Question
26 August, 09:10

Put four red LED as a straight line and connect each of them to a corresponding analog output. Connect a potentiometer to a 5 Volt power source. Divide the 0 to 5 Volt output of the potentiometer into four parts (0 ~ 1.25 Volt, 1.25 to 2.5 Volt, 2.5 to 3.75 volt, and 3.75 to 5 Volt). Write a program to change the brightness of a LED with respect to the voltage. For each 1.25 V interval, the brightness of one LED will be proportional to the output voltage of the connected potentiometer.

+1
Answers (1)
  1. 26 August, 10:17
    0
    There has been no information about related to which programming language is to be used, writing code algorithm.

    Defining I/O's;

    Analogue output

    A01, A02, A03, AO4

    Analogue Input;

    AI_1 / / potentiometer input

    / / Based on controller used, assign channels to I/O's

    / / code

    int voltage

    Voltage = AI_1;

    If (Voltage > 0 && Voltage < 1.25)

    {

    A01 = voltage

    A02 = 0;

    A03 = 0

    AO4 = 0

    }

    If (Voltage > 1.25 && Voltage < 2.5)

    {

    A01 = 1.25

    A02 = (Voltage - 1.25);

    A03 = 0

    AO4 = 0

    }

    If (Voltage > 2.5 && Voltage < 3.75)

    {

    A01 = 1.25

    A02 = 1.25

    A03 = (Voltage - 2.5);

    AO4 = 0

    }

    else

    {

    A01 = 1.25

    A02 = 1.25

    A03 = 1.25

    AO4 = (Voltage - 3.75);

    }

    return
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Put four red LED as a straight line and connect each of them to a corresponding analog output. Connect a potentiometer to a 5 Volt power ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers