EasyManua.ls Logo

Freenove Ultimate Starter Kit - Page 105

Freenove Ultimate Starter Kit
286 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
105
Chapter 7 AD/DA Converter
www.freenove.com
support@freenove.com
Install I2C-Tools
Type the command to install I2C-Tools.
sudo apt-get install i2c-tools
I2C device address detection:
i2cdetect -y 1
Here 48 (HEX) is the I2C address of PCF8591.
Code
C Code 7.1.1 ADC
First observe the project result, and then analyze the code.
1. Use cd command to enter 07.1.1_ADC directory of C code.
cd ~/Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi/Code/C_Code/07.1.1_ADC
2. Use following command to compile “ADC.c” and generate executable file ADC”.
gcc ADC.c -o ADC -lwiringPi
3. Then run the generated file ADC”.
sudo ./ADC
After the program is executed, shift the potentiometer, then the terminal will print out the potentiometer
voltage value and the converted digital content. When the voltage is greater than 1.6V (voltage need to turn
on red LED), LED starts emitting light. If you continue to increase the output voltage, the LED will become
more bright gradually.

Table of Contents