Code
C Code 8.1.1 Softlight
First observe the project result, and then analyze the code.
1. Use cd command to enter 08.2.1_Softlight directory of C code.
cd ~/Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi/Code/C_Code/08.1.1_Softlight
2. Use following command to compile “Softlight.c” and generate executable file “Softlight”.
gcc Softlight.c -o Softlight -lwiringPi -lpthread
3. Then run the generated file “Softlight”.
sudo ./Softlight
After the program is executed, shift the potentiometer, then the terminal window will print out the voltage
value of the potentiometer and the converted digital quantity. And brightness of LED will be changed
consequently.
The following is the code: