Skip to content

Instantly share code, notes, and snippets.

@chazcheadle
chazcheadle / feather-huzzah-bme280-mqtt
Last active March 15, 2018 05:37
Feather Huzzah, BME280, mqtt
#include <FS.h> //this needs to be first, or it all crashes and burns...
#include <Wire.h>
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
// MQTT Library
#include <PubSubClient.h>
@chazcheadle
chazcheadle / output
Created April 7, 2016 15:45
Teensy 3 TimerOne test
blink: 400
blink: 749
main: 754
blink: 1099
blink: 1448
main: 1504
blink: 1798
blink: 2147
main: 2254
blink: 2497
@chazcheadle
chazcheadle / timerbuttons.ino
Last active April 12, 2016 15:29
Arduino clock source for 6502 with start/stop and step buttons
#define LED 13
#define startButton 2
#define stepButton 3
volatile int ledState;
bool run = false;
int buttonState;
int lastButtonState;
@chazcheadle
chazcheadle / mosquitto.service
Created August 2, 2016 15:13
Mosquitto MQTT Broker systemd start up script
[Unit]
Description=Mosquitto MQTT Broker daemon
ConditionPathExists=/etc/mosquitto/mosquitto.conf
After=network.target
Requires=network.target
[Service]
Type=forking
RemainAfterExit=no
StartLimitInterval=0
@chazcheadle
chazcheadle / mjpg-streamer.service
Created August 2, 2016 15:56
mjpg-steamer.service and script
[Unit]
Description=mjpg-streamer
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/opt/mjpg-streamer/mjpg-streamer-experimental/mjpg-streamer.sh
@chazcheadle
chazcheadle / server-main.go
Created August 17, 2016 16:18
Golang/MQTT JSON server timestamp
package main
import (
"fmt"
"encoding/json"
"os"
"time"
MQTT "github.com/eclipse/paho.mqtt.golang"
)
@chazcheadle
chazcheadle / send_image_mqtt.go
Created August 18, 2016 03:31
Golang: Send image over MQTT
package main
import (
"fmt"
"io/ioutil"
"os"
log "github.com/Sirupsen/logrus"
MQTT "github.com/eclipse/paho.mqtt.golang"
)
@chazcheadle
chazcheadle / hab_camera-1.sh
Created August 19, 2016 16:29
mjpg_streamer: Out put http and file to custom directory
#!/bin/sh
# Check for image directory and create it if it doesn't exist.
s=${0##*/}
image_dir="/tmp/${s%.*}"
if [ ! -d $image_dir ]
then
mkdir $image_dir
echo "Created $image_dir.";
@chazcheadle
chazcheadle / camera_mon.go
Last active September 29, 2022 22:57
Golang/MQTT service to monitor webcam snapshots and send status
package main
import (
"encoding/json"
"io"
"io/ioutil"
"os"
"sort"
"time"
@chazcheadle
chazcheadle / cameras.yml
Created August 27, 2016 04:12
Publish JSON endpoint to list available camera resources (HTTP 200) loaded from a YAML config file written in Golang
cameras:
Exterior (South):
camera_id: hab_camera-1
url : http://HOST:8091/?action=stream
low_image : http://HOST:8091/low.png
type : mjpeg-streamer
Exterior IR (South):
camera_id: hab_camera-2
url : http://HOST:8090/?action=stream
low_image : http://HOST:8090/low.png