Qwiic Kit for Raspberry Pi Hookup Guide
This Tutorial is Retired!
View the updated tutorial: Qwiic Kit for Raspberry Pi V2 Hookup Guide
Let's Run the Code Already!
OK, now that we've updated our code to submit data to our Cayenne account and figured out which variables we want to send where we can run the code. Make sure you save your code (with your Cayenne account information and any other changes you wanted to make). Then open a terminal window and navigate to the folder where your code is if you have not already. Type the following command and ENTER to run the script. Our code actually runs a loop until we decide to cancel the program CTRL + C.
language:bash
python qwiic_kit_for_pi_demo.py
Or hit the Run button in your Python editor to start executing the script. To stop, simply click on the Stop button with your mouse.
Assuming you don't get any errors you should see some of the sensor data displayed on your screen.
Running Demo via Command Line | Running Demo via Thonny Editor |
If you look at the microOLED, you will also notice some of the BME280 sensor data on the display.
Thu Jun 27 2019 03:03:39PM
BME Temperature 81.3 F
Humidity 30.2
Pressure 121347.04 Pa
Altitude -5078.29 ft
CCS Temperature 80.9 F
Distance 1.00
Ambient Light 412.00
TVOC 0.00
CO2 400.00
You will also start seeing the green boxes popping up on Cayenne as well so you can add them to your dashboard and move them around.
Congratulations, you now know how to read Qwiic sensors on a Pi, display data to your Pi, display data on the Qwiic micro OLED screen, and get that information to display on the web. Try adjusting the code to send data to the web at a slower rate or calibrate the sensor readings for stable readings. Keep checking the Qwiic_Py repo for more Python libraries for our Qwiic boards or write your own and start experimenting.