Qwiic Kit for Raspberry Pi Hookup Guide

Pages
Contributors: M-Short, bboyho
Favorited Favorite 1

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

Run Demo via Command Line

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.

Run Demo via Python Editor

Assuming you don't get any errors you should see some of the sensor data displayed on your screen.

Output via Command Line Output via Python Editor
Running Demo via Command Line Running Demo via Thonny Editor

Click on images for a closer look!

If you look at the microOLED, you will also notice some of the BME280 sensor data on the display.

BME280 sensor data on the micro OLED

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.

Sensor Data on Cayenne

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.