From the course: Raspberry Pi: GPIO
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Control the BME280 and PCA9685
From the course: Raspberry Pi: GPIO
Control the BME280 and PCA9685
- [Instructor] When you've checked all the parts, we're going to run code that connects the BME280 to the servos. Open up exercise files chapter seven 07_05_servos_bme_280_pca9685. If you double-click on that, it will open up in Thonny. There are three parts to this program, i2c initialization, device initialization, and data gathering and interpretation. Lines nine through 33 confirm the presence of i2c and the address of the BME280. In an earlier video, you did this by hand with i2cdetect. This code demonstrates how to find it with Python. Lines 41 through 44 then set up the PCA9685 with the servo library. This assumes the servos are connected to the first pin set and the last pin set. Notice that the first pin set is referred to as zero rather than one. In line 41, you can see that the first pin set is referred to as zero, and in line 43, you can see that the last pin set is referred to as 15. It's also…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Introduction to I2C devices1m 10s
-
(Locked)
Connect the servo controller via I2C3m 54s
-
(Locked)
Connect the BME280 via I2C1m 27s
-
(Locked)
Install software and test5m 52s
-
(Locked)
Control the BME280 and PCA96852m 56s
-
(Locked)
What you learned about I2C1m 33s
-
(Locked)
I2C in depth5m 17s
-
(Locked)
-
-
-