Skip to content

Instantly share code, notes, and snippets.

View terryspitz's full-sized avatar

Terry Spitz terryspitz

View GitHub Profile
@terryspitz
terryspitz / gist:970b801030fc6008e65956263c2f6500
Last active May 1, 2022 10:47
Using PIC SPI to control WS2812b neopixel
void WS281x_Send() {
//[My] WS2812b seems sensitive only to timing of high, signal can be low for any period less than 50us reset.
//Using PIC at 32Mhz, SPI at FOSC/4 = 8Mhz
//Write one SPI byte per WS2812 bit,
//for WS2812 1 bit use pattern 0b01111110 which is high for 6x125=750ns
//for WS2812 0 bit use pattern 0b00111000 which is high for 3x125=375ns
//(keep first SPI bit low as this affects timings - SPI SDO goes high early before the clock starts)
//and ignore delays between SPI bytes as it stays low
for (char b=0; b < 3 * LED_COUNT; ++b) {
char colour = WS281x_buffer[b];
//#include <ArduinoOTA.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <WiFiManager.h>
#include <BlynkSimpleEsp8266.h>
// Auth Token for Blynk App.
// see http://docs.blynk.cc/#getting-started-getting-started-with-the-blynk-app-4-auth-token
char blynkAuth[] = "<your code here>";
@terryspitz
terryspitz / blinds.ino
Created February 9, 2020 16:44
ESP8266 with motor shield for controlling blinds via Blynk or Google Assistant via IFTTT
#include "WEMOS_Motor.h"
#include <ESP8266WiFi.h>
#include <DNSServer.h> //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h> //Local WebServer used to serve the configuration portal
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager allow phone to configure device wifi connection
//#include <ESP8266HTTPClient.h> //doesn't support https easily, so use WiFiClientSecure instead
#include <WiFiClientSecure.h>
#include <EEPROM.h>
//------------------------------------------------------------------------------
// 8x8 single color LED Tetris for Arduino UNO and a joystick breakout.
// [email protected] 2015-01-22
//------------------------------------------------------------------------------
// Copyright at end of file.
// please see http://www.github.com/MarginallyClever/ArduinoStarterKit for more information.
//
// The LED grid is a red 8x8.
// The Arduino is an UNO.
// The joystick is a xinda ps3/xbox style clickable stick on a breakout board.
@terryspitz
terryspitz / bitclock.ino
Last active July 19, 2019 07:54
added seconds toggle by closing pins D0/RX briefly
//Terry Spitz, 2019
// Hardware:
// DS3231 Real Time Clock board
// 4x MAX7219 8x8 LED Matrix with controller
#include "LedControl.h"
#include <Wire.h>
#include <RtcDS3231.h>
@terryspitz
terryspitz / conrad-foo.ino
Created May 5, 2019 09:10
WeMos ESP8266Audio code for playing Foo Fighter through Conrad the Camel see https://hackaday.io/project/165395-conrad-the-camel-plays-foo-fighters
#include <ESP8266WiFi.h>
#include "AudioFileSourceSPIFFS.h"
#include "AudioGeneratorWAV.h"
#include "AudioOutputI2SNoDAC.h"
#include <ESP8266SAM.h>
AudioGeneratorWAV *audio;
AudioFileSourceSPIFFS *file;
AudioOutputI2SNoDAC *out;
ESP8266SAM *sam;
# Terry Spitz 2018
# word clock for waveshare ePaper
# based on https://github.com/mattohagan/word-clock/blob/master/word_clock.py
try:
import epd7in5
except:
#continue without ePaper display for debugging
epd7in5 = None
from PIL import Image, ImageDraw, ImageFont