Skip to content

Instantly share code, notes, and snippets.

View lesp's full-sized avatar
🏠
Working from home

Les lesp

🏠
Working from home
View GitHub Profile
@lesp
lesp / colour-control.py
Created June 25, 2026 14:54
Control 50 RGB LEDs using a Qw/ST I2C control pad
import time
from machine import I2C
from qwstpad import ADDRESSES, QwSTPad
import plasma
from random import randint
# Setup the LED strip
NUM_LEDS = 50
led_strip = plasma.WS2812(
NUM_LEDS, color_order=plasma.COLOR_ORDER_RGB
@lesp
lesp / blinky.py
Created June 25, 2026 10:25
Blinking two LEDs using Qw/ST port on Pimoroni Pico Plus 2 W
from machine import Pin
from time import sleep
blue = Pin(4, Pin.OUT)
red = Pin(5, Pin.OUT)
while True:
red.toggle()
sleep(0.1)
red.toggle()
@lesp
lesp / astronauts.py
Created June 24, 2026 14:38
Pimoroni Pico Plus 2 and Clipper 4G LTE - Get ISS astronaut names via 4G IoT connections
import lte
import time
import requests
from machine import Pin, PWM
MOBILE_APN = "iot.1nce.net"
# Setting this to True will attempt to resume an existing connection
RESUME = False
@lesp
lesp / news_app.py
Created May 29, 2026 15:33
Pimoroni Presto News App
# ICON news
# NAME News Feed
# DESC The latest news, direct to your Presto
import requests
from presto import Presto
from picovector import PicoVector, ANTIALIAS_BEST
from time import sleep
import qrcode
presto = Presto()
@lesp
lesp / index.html
Created August 9, 2022 14:06
Tom's Hardware Raspberry Pi Pico W Web Server: Bootstrap Example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tom's Hardware...on a Raspberry Pi Pico W</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.min.js" integrity="sha384-ODmDIVzN+pFdexxHEHFBQH3/9/vQ9uori45z4JjnFsRydbmQbmL5t1tQ0culUzyK" crossorigin="anonymous"></script>
<style>
@lesp
lesp / button-test.py
Created June 27, 2022 10:58
BMO Playback
from gpiozero import Button #Much easier way to interact with the GPIO
from omxplayer.player import OMXPlayer
from pathlib import Path
from time import sleep
from signal import pause
button = Button(17) #Physical pin 11
def video_test():
VIDEO_PATH = Path("BMO_DontSayThings.mp4")
@lesp
lesp / allie-vlc.py
Created June 26, 2022 18:50
Plays a local video file at 50% volume
import vlc
import time
# creating vlc media player object
media_player = vlc.MediaPlayer()
# The video that we wish to play
media = vlc.Media("PiCast.mp4")
# Loading up the video ready for playback
media_player.set_media(media)
@lesp
lesp / capture.sh
Created May 20, 2022 10:14
Simon says...take a screenshot every minute and use the timestamp as the filename
#!/bin/bash
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
echo "Current Time : $current_time"
scrot -d 60 "${current_time}.png"
@lesp
lesp / temp-check.py
Created March 21, 2022 10:20
Using a BME688 Temperature sensor with Pimoroni's Badger 2040. Code is based on the BME688 example, but with added Badger 2040 code.
"""BME688 / BME680 demo
This demo will work for both the BME680 and BME688.
"""
import time
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
from pimoroni_i2c import PimoroniI2C
import badger2040
import machine
badger = badger2040.Badger2040()
@lesp
lesp / secrets.py
Created March 20, 2021 17:13
Secrets.py
# This file is where you keep secret settings, passwords, and tokens!
# If you put them in the code you risk committing that info or sharing it
secrets = {
'ssid' : 'YOUR SSID',
'password' : 'YOUR PASSWORD',
'timezone' : 'YOUR LOCATION', # http://worldtimeapi.org/timezones
}