This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"regionid": 9, | |
"dnoregion": "WPD East Midlands", | |
"shortname": "East Midlands", | |
"postcode": "NG1", | |
"data": [ | |
{ | |
"from": "2023-09-02T16:00Z", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyflipdot.pyflipdot import HanoverController | |
from pyflipdot.sign import HanoverSign | |
from serial import Serial | |
import random | |
import time | |
ser = Serial('/dev/ttyUSB0') | |
controller = HanoverController(ser) | |
sign = HanoverSign(address=6, width=84, height=7) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FlipDot from 'flipdot-display'; | |
const flippy = new FlipDot('/dev/ttyUSB0', 6, 7, 84); | |
async function sleep(millis) { | |
return new Promise((resolve) => { | |
setTimeout(resolve, millis); | |
}); | |
} | |
flippy.once('open', async function() { |
NewerOlder