Raspbian is the Foundation’s official supported operating system. You can download it in the following link: https://www.raspberrypi.org/downloads/raspbian/
After downloading the image you need to download win32disk imager software to write the system image to a SD card. https://sourceforge.net/projects/win32diskimager/
The next step is to insert your SD Card in the Raspberry Pi slot.
*If you dont have a screen to configure your board, i recommend to enable UART in config.txt file located in your SD card. Insert this line at the bottom of the archive.
Let's enable I2C communication too:
#Enable UART
enable_uart=1
#I2C
dtparam=i2c1=on
dtparam=i2c_arm=on
Connect a FTDI module to UART pins and open Putty with baud rate of 115200bps.
To enable ssh create a ssh file in the SD card.
Raspberry will boot and now you are able to start!
Configure WifiTo configure wifi you need to edit wpa_supplicant.conf file. Once connected to Raspberry serial via Putty, type the following command:
pi@raspberrypi:~ $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Insert this at the bottom.
network={
ssid="testing"
psk="testingPassword"
}
Reboot your system and verifiy wi-fi connection.
pi@raspberrypi:~ $ sudo iwlist wlan0 scan
pi@raspberrypi:~ $ ifconfig wlan0
Using TCS34725- Install I2C tools:
pi@raspberrypi:~ $ sudo apt-get install -y i2c-tools
- Detect I2C sensor:
pi@raspberrypi:~ $ i2cdetect -y 1
I2C detect will show you all the devices connected to Raspberry I2C bus. In this case TCS34725 address is 0x29.
- Dumpy registers visible through the I2C bus.
First of all, create a folder and install wiringPi library.
pi@raspberrypi:~ $ mkdir code
pi@raspberrypi:~ $ cd code
pi@raspberrypi:~/code $ git clone
pi@raspberrypi:~/code $ cd wiringPi
pi@raspberrypi:~/code/wiringPi $ ./build
Download the code:
https://github.com/leoribg/codes_general , the code is located in i2c folder.
Copy it to code folder and compile.
pi@raspberrypi:~/code $ g++ i2c_code.cpp -lwiringPi -o i2ctest
pi@raspberrypi:~/code $ ./i2ctest
fd =3
data=1
R=277 G=279 B=282
R=277 G=279 B=282
R=278 G=279 B=283
R=278 G=279 B=283
.
.
.
R=277 G=279 B=282
R=277 G=279 B=282
R=278 G=279 B=283
R=278 G=279 B=283
The code will run indefinitely printing RGB values by 2 and 2 seconds.
Comments