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() { |
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
| 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 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
| using System; | |
| using System.Device.Gpio; | |
| using System.Threading; | |
| namespace trafficlights | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { |
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
| void setup() { | |
| M5.begin(); | |
| M5.M5Ink.clear(); | |
| InkPageSprite.creatSprite(0, 0, 200, 200); | |
| drawScreen("Press to start!", 0); | |
| playTone(1); | |
| } |
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
| 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 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
| 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 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
| void setup() { | |
| M5.begin(); | |
| M5.M5Ink.clear(); | |
| InkPageSprite.creatSprite(0, 0, 200, 200); | |
| drawScreen("Press to start!", 0); | |
| playTone(1); | |
| } |
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
| app.get('/dbinfo', (req, res) => { | |
| const dbKeys = Object.keys(db); | |
| const info = { | |
| size: dbKeys.length | |
| }; | |
| if ('true' === req.query.details) { | |
| info.keys = dbKeys; | |
| } |
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
| app.get('/get/:key', (req, res) => { | |
| res.json({ value: db[req.params.key]}); | |
| }); |