105
Chapter 7 AD/DA Converter
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.
Summary of Contents for Ultimate Starter Kit
Page 1: ...Free your innovation Freenove is an open source electronics platform www freenove com ...
Page 117: ...117 Chapter 9 Potentiometer RGBLED www freenove com support freenove com Hardware connection ...
Page 155: ...155 Chapter 14 Relay Motor www freenove com support freenove com Hardware connection OFF 3 3V ...
Page 173: ...173 Chapter 16 Stepping Motor www freenove com support freenove com Hardware connection ...
Page 239: ...239 Chapter 22 Matrix Keypad www freenove com support freenove com Circuit Schematic diagram ...
Page 240: ...Chapter 22 Matrix Keypad 240 www freenove com support freenove com Hardware connection ...