Skip to content

Instantly share code, notes, and snippets.

View simonprickett's full-sized avatar
💭
I'm not your friend on Facebook.

Simon Prickett simonprickett

💭
I'm not your friend on Facebook.
View GitHub Profile
@simonprickett
simonprickett / oxford_circus_central.svg
Created January 16, 2026 19:20
SVG for the Central Line at Oxford Circus Station
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simonprickett
simonprickett / waterloo_and_city_line.svg
Created January 16, 2026 15:59
Waterloo and City Line SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simonprickett
simonprickett / main.c
Created July 7, 2025 17:27
C Program for Raspberry Pi Pico Traffic Lights
#include "pico/stdlib.h"
int main()
{
/* Setup. */
const uint RED_PIN = 4;
const uint AMBER_PIN = 3;
const uint GREEN_PIN = 5;
gpio_init(RED_PIN);
@simonprickett
simonprickett / main.py
Created July 7, 2025 17:26
CircuitPython Trafflc Lights Script
import board
import digitalio
import time
# Setup.
red = digitalio.DigitalInOut(board.GP4)
red.direction = digitalio.Direction.OUTPUT
amber = digitalio.DigitalInOut(board.GP3)
amber.direction = digitalio.Direction.OUTPUT
green = digitalio.DigitalInOut(board.GP5)
@simonprickett
simonprickett / main.py
Created July 7, 2025 17:24
Traffic Lights MicroPython Script
import machine
import time
# Setup.
red = machine.Pin(4, machine.Pin.OUT)
amber = machine.Pin(3, machine.Pin.OUT)
green = machine.Pin(5, machine.Pin.OUT)
# Begin by making sure all the LEDs are off.
red.low()
@simonprickett
simonprickett / main.py
Created July 3, 2025 12:16
CircuitPython script to control 3 x 3v panel gauges from a Raspberry Pi Pico 2W
import board
import pwmio
import time
# Assumes a Raspberry Pi Pico 2 W, with gauges connected
# to GP22 / Pin 29, GP26 / Pin 31 and GP16 / Pin 21 and ground.
# You can use a single ground pin on the Pico and chain the
# ground connections across the three meters.
# Sweeps the gauges back and forth on a continuous timer.
@simonprickett
simonprickett / main.py
Created July 3, 2025 12:07
CircuitPython script to control a 3v panel gauge from a Raspberry Pi Pico 2W
import pwmio
import time
# Assumes a Raspberry Pi Pico 2 W, with gauge connected
# to GP22 / Pin 29 and ground. Sweeps the gauge back and
# forth on a continuous timer.
gauge = pwmio.PWMOut(board.GP22, frequency=1000)
ds = 0
import board
import pwmio
import time
gauge1 = pwmio.PWMOut(board.GP22, frequency=1000)
gauge2 = pwmio.PWMOut(board.GP26, frequency=1000)
gauge3 = pwmio.PWMOut(board.GP16, frequency=1000)
ds1 = 0
delta1 = 1000
@simonprickett
simonprickett / carbonintensity.json
Created September 2, 2023 16:37
Example Carbon Intensity API output for the NG1 postcode in the East Midlands Region
{
"data": [
{
"regionid": 9,
"dnoregion": "WPD East Midlands",
"shortname": "East Midlands",
"postcode": "NG1",
"data": [
{
"from": "2023-09-02T16:00Z",
@simonprickett
simonprickett / carbonintensity.js
Created September 2, 2023 16:16
Embeddable JavaScript Demo - calling the UK Carbon Intensity API
// Swap NG1 for your postcode area...
const intensityAPIResponse = await fetch('https://api.carbonintensity.org.uk/regional/postcode/NG1');
const intensityData = await intensityAPIResponse.json();
const regionData = intensityData.data[0];
const forecastNum = regionData.data[0].intensity.forecast;
const forecastStr = regionData.data[0].intensity.index;
const generationMix = regionData.data[0].generationmix;
// Swap api-demo for the ID of the div that you want to render
// the results to on your page.