Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsThe Nano 33 BLE Sense Rev2 carries an APDS-9960 gesture, proximity and colour sensor next to the USB port. The official Arduino_APDS9960 library reports up, down, left and right swipes. This sketch maps each swipe to a colour on the board's RGB LED. It needs no wiring, so it is a quick way to try the board's sensors before a bigger build.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB, or 5-21 V on VIN for a stand-alone lamp.
gesture_lamp.inoVerify & upload in Electrolark#include <Arduino_APDS9960.h>
void colour(bool r, bool g, bool b) { // the RGB LED is active LOW
digitalWrite(LEDR, r ? LOW : HIGH);
digitalWrite(LEDG, g ? LOW : HIGH);
digitalWrite(LEDB, b ? LOW : HIGH);
}
void setup() {
pinMode(LEDR, OUTPUT); pinMode(LEDG, OUTPUT); pinMode(LEDB, OUTPUT);
colour(false, false, false);
if (!APDS.begin()) { while (true) { colour(true, false, false); delay(200); colour(false, false, false); delay(200); } }
}
void loop() {
if (APDS.gestureAvailable()) {
switch (APDS.readGesture()) {
case GESTURE_UP: colour(true, false, false); break; // red
case GESTURE_DOWN: colour(false, true, false); break; // green
case GESTURE_LEFT: colour(false, false, true); break; // blue
case GESTURE_RIGHT: colour(false, false, false); break; // off
default: break;
}
}
}
Swipe slower, 5-10 cm above the sensor, and avoid direct sunlight.
The sensor did not start: check you selected the Nano 33 BLE board, not the classic Nano.
Double-tap the reset button to enter the bootloader and upload again.
Yes, turn on two channels for yellow, cyan or magenta.
No, only the Sense versions have the APDS-9960.
Yes, add a WS2812 strip on a digital pin with its own 5 V supply.
1 part: Arduino Nano 33 BLE Sense Rev2 ABX00069. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 45 minutes. The build on this page has 5 steps.
No. This page has the complete, tested code (gesture_lamp.ino).
About ₹3,949 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Using the onboard APDS-9960 gesture sensor; Active-low RGB LED pins; The Arduino Mbed OS Nano board package.
Your first MicroPython project: temperature and humidity on an OLED.
A web page with ON and OFF buttons that switches a relay over Wi-Fi.
A warm ring light that fades up at dusk and down at dawn.
Turn a Pi and a touchscreen into a home command centre with a clock and to-do list.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.