Skip to content

Instantly share code, notes, and snippets.

View pfeerick's full-sized avatar

Peter Feerick pfeerick

  • Australia
  • 23:57 (UTC +10:00)
View GitHub Profile
@pfeerick
pfeerick / ledStatus.ino
Created July 4, 2016 08:26
Oak MQTT test
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <string.h>
// Update with values suitable for your network.
const char* mqtt_server = "pine64";
WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
@pfeerick
pfeerick / oakBlinkAndPublish.ino
Last active September 30, 2016 05:10
Just s simple script to test some particle stuff on the Oak
/*
Just s simple script to test some particle stuff on the Oak
*/
// this makes the Oak only automatically connect to wifi, not particle
SYSTEM_MODE(SEMI_AUTOMATIC)
// the setup function runs once when you reset or power the board
void setup()
{
@pfeerick
pfeerick / oakNRFsensorMonitorWebpage.ino
Last active October 13, 2016 11:39
Oak NRF receiver code. Generates a local web page to see latest data, and relays data to Particle as events.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <elapsedMillis.h>
@pfeerick
pfeerick / oakDoorMonitor.ino
Created October 17, 2016 04:59
Simple example for the Oak that monitors a reed switch, and publishes an event on Particle when the state changes.
/*
Door Monitor
Monitors a reed switch for an open door, and posts to particle.
Created 2 June 2016
Updated 17th October
by Peter Feerick
*/
const int LED_PIN = 1; //The LED is connected to P1 on the Oak
@pfeerick
pfeerick / oakStaticIp.ino
Last active November 12, 2016 07:30
Simple demo to show how to get a Digistump Oak to change to a Static IP. Isn't the best method, but it works.
//SEMI_AUTOMATIC mode to ensure variable is available
//Probably isn't needed if you don't use Particle.variable in your code
SYSTEM_MODE(SEMI_AUTOMATIC);
#include <ESP8266WiFi.h>
char myIpString[24];
IPAddress myIp;
void setup()
@pfeerick
pfeerick / update.sh
Created December 8, 2016 05:12
Fixed up shell script for Digistump Oak 'easy serial update'
#!/bin/bash
read -p "Please enter the path of your USB-Serial Adapter (ex: /dev/ttyUSB0):" comport
read -p "Ensure Oak is attached as shown here and press a key: digistump.com/wiki/oak/serialupdate" -n1 -s
echo
echo "Updating..."
python esptool.py --baud 115200 --port $comport write_flash -fs 32m 0x1000 blank.bin 0x2000 firmware_v1.bin 0x101000 blank.bin 0x102000 blank.bin 0x202000 blank.bin
echo "Done!"
read -n1 -s -t3
@pfeerick
pfeerick / OakManualWifiStatic.ino
Last active December 18, 2016 00:32
Demo sketch showing how to configure a Digistump Oak's wifi manually with a static IP without a Particle connection
SYSTEM_MODE(MANUAL);
#include <ESP8266WiFi.h>
//Static IP stuff
char SSID[] = "yournetwork"; // your network SSID
char passwd[] = "yourpassword"; // your network password
//WiFi config stuff
IPAddress ip(192, 168, 0, 70); //your static IP
@pfeerick
pfeerick / OakManualWifi.ino
Created December 18, 2016 00:33
Demo sketch showing how to configure a Digistump Oak's wifi manually without a Particle connection
SYSTEM_MODE(MANUAL);
#include <ESP8266WiFi.h>
//Static IP stuff
char SSID[] = "yournetwork"; // your network SSID
char passwd[] = "yourpassword"; // your network password
void setup()
{
@pfeerick
pfeerick / oak-mqtt-led.ino
Created October 8, 2016 00:26
Working MQTT example for a Digistump Oak
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <string.h>
// Update with values suitable for your network.
const char* mqtt_server = "pine64";
WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
@pfeerick
pfeerick / pine64-install-mate-debian.sh
Created June 2, 2018 10:44
Install MATE Desktop Environment for Debian on the pine64
#!/bin/bash
set -e
DISTRO=""
if hash apt-get 2>/dev/null; then
DISTRO=debian
fi
if [ -z "$DISTRO" ]; then