Skip to content

Instantly share code, notes, and snippets.

View PatchworkBoy's full-sized avatar

Marci PatchworkBoy

View GitHub Profile
@PatchworkBoy
PatchworkBoy / Pi.md
Last active September 14, 2021 09:36
Raspberry Pi Looped Video / Audio Player

Flash Raspbian Buster Lite (https://www.raspberrypi.org/downloads/raspbian/) to an SD. Whack in Pi (plugged into local network, screen, speakers & with keyboard) - power on. Log in (defaults: pi / raspberry).

Force audio thru headphone jack instead of HDMI via:

sudo raspi-config

Interfacing Options > SSH > Would you like to enable? YES > OK
Advanced > Audio > Force 3.5mm ('headphone') jack > Finish
@PatchworkBoy
PatchworkBoy / mqtt.js
Last active February 13, 2018 20:49
"Connection Lost" handler for unstable MQTT Connections
var mqtt = require('mqtt');
var platform;
var client;
var config = {host: "", port: 0, credentials: false, channel: ""};
module.exports = {
Mqtt: Mqtt
};
function Mqtt(aPlatform, host, port, channel, credentials) {
@PatchworkBoy
PatchworkBoy / stopfocus.py
Created December 22, 2016 16:58
kill focus.py!
#!/usr/bin/python
from subprocess import call
call(["pkill","focus"])
@PatchworkBoy
PatchworkBoy / focus.py
Last active December 22, 2016 17:16
Python Stepper Script for UL2003 driver triggered by GPIO pins defined at line 76
#!/usr/bin/python
#--------------------------------------
# ___ ___ _ ____
# / _ \/ _ \(_) __/__ __ __
# / , _/ ___/ /\ \/ _ \/ // /
# /_/|_/_/ /_/___/ .__/\_, /
# /_/ /___/
#
# Stepper Motor Test
#
@PatchworkBoy
PatchworkBoy / flows.json
Created December 22, 2016 14:58
Stepper Motor Flow
[{"id":"43898bc4.bc7674","type":"subflow","name":"Stepper Motor","info":"","in":[{"x":40,"y":120,"wires":[{"id":"a04d8ed0.5fb27"}]}],"out":[{"x":940,"y":40,"wires":[{"id":"6a04cb0f.95fb34","port":0}]},{"x":940,"y":80,"wires":[{"id":"6a04cb0f.95fb34","port":1}]},{"x":940,"y":120,"wires":[{"id":"6a04cb0f.95fb34","port":2}]},{"x":940,"y":160,"wires":[{"id":"6a04cb0f.95fb34","port":3}]},{"x":940,"y":200,"wires":[{"id":"6a04cb0f.95fb34","port":4},{"id":"1ea1a2a7.e15e5d","port":0}]}]},{"id":"1ea1a2a7.e15e5d","type":"function","z":"43898bc4.bc7674","name":"Toggle Direction","func":"var direction = flow.get('direction')||0;\n\nif (direction === -1)\n{\n direction = 1;\n}\nelse {\n direction = -1;\n}\nflow.set('direction',direction);\nmsg.payload = direction;\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":140,"wires":[[]]},{"id":"a04d8ed0.5fb27","type":"switch","z":"43898bc4.bc7674","name":"Step or Direction","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"Step","vt":"str"},{"t":"eq","v":"Direct
@PatchworkBoy
PatchworkBoy / flows.json
Last active December 21, 2016 08:14
Node-Red flow for Pololu DRV8835 & 2x 12v DC motors + USB MS Sidewinder Gamepad with Nexstar Protocol over TCP support (for SkySafari etc). No feedback encoders yet. Requires wiring-pi to be installed as a node_module within node-red folder and added to global context via settings.js (see “wiring-pi module” section at http://nodered.org/docs/har…
[
{
"id": "ce01dcb1.0d0708",
"type": "ui_slider",
"z": "6e9dcce8.16d0ac",
"name": "Speed",
"label": "PWM Speed",
"group": "529fa907.5b11e8",
"order": 2,
"width": "",
@PatchworkBoy
PatchworkBoy / config.json
Last active December 19, 2021 14:14
Sample homebridge-edomoticz config.json for localhost
{
"bridge": {
"name": "Homebridge",
"username": "CC:21:3E:E4:DE:33",
"port": 51826,
"pin": "031-45-154"
},
"description": "Configuration file for (e)xtended Domoticz platform.",
"platforms": [
{