This file contains 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 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 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 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() { |
This file contains 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
use std::{thread, time}; | |
use std::sync::Arc; | |
use std::sync::atomic::{AtomicBool, Ordering}; | |
use ctrlc; | |
use rust_gpiozero::LED; | |
fn main() { | |
let keep_going = Arc::new(AtomicBool::new(true)); | |
let kg = keep_going.clone(); |
This file contains 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
using System; | |
using System.Device.Gpio; | |
using System.Threading; | |
namespace trafficlights | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains 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
void setup() { | |
M5.begin(); | |
M5.M5Ink.clear(); | |
InkPageSprite.creatSprite(0, 0, 200, 200); | |
drawScreen("Press to start!", 0); | |
playTone(1); | |
} |
This file contains 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
if (currentState != STATE_IDLE) { | |
unsigned long timeNow = millis(); | |
if (timeNow - startTime >= MILLIS_IN_ONE_MIN) { | |
minsRemaining--; | |
if (minsRemaining == 0) { | |
playTone(3); | |
// Work out what state comes next... | |
if (currentState == STATE_WORKING) { |
This file contains 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
if (M5.BtnPWR.wasPressed()) { | |
drawScreen("Bye, love you!", 0); | |
playTone(1); | |
delay(3000); | |
M5.M5Ink.clear(); | |
delay(1000); | |
currentState = STATE_IDLE; | |
M5.PowerDown(); | |
} |
This file contains 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
void setup() { | |
M5.begin(); | |
M5.M5Ink.clear(); | |
InkPageSprite.creatSprite(0, 0, 200, 200); | |
drawScreen("Press to start!", 0); | |
playTone(1); | |
} |
NewerOlder