Skip to content

Instantly share code, notes, and snippets.

View wyojustin's full-sized avatar

Justin Shaw wyojustin

View GitHub Profile
## For raspberry pi Model B
## edit DS3231.py
### was (Model A version)
class DS3231:
def __init__(self):
self.ds3231 = Adafruit_I2C(DS3231_I2C_ADDR)
### change to new Model B version
class DS3231:
@wyojustin
wyojustin / Alpha5
Created April 2, 2015 03:20
EMSL Alpha5 mods with Zulu and DST
/*
AlphaClock.ino
-- Alpha Clock Five Firmware, version 2.1 --
Version 2.1.0 - January 31, 2013
Copyright (c) 2013 Windell H. Oskay. All right reserved.
http://www.evilmadscientist.com/
@wyojustin
wyojustin / firmware_code.ino
Created April 23, 2017 18:01
Add GET_NUM_PIXELS command to BiblioPixel DriverSerial
enum CMDTYPE
{
SETUP_DATA = 1,
PIXEL_DATA = 2,
BRIGHTNESS = 3,
GETID = 4,
SETID = 5,
GETVER = 6,
GET_NUM_LEDS = 7
};
from pixel_maps import ultim8x8, ultim8x24, ultim8x72, ultim24x24, ultim16x56
from bibliopixel.drivers.serial_driver import DriverSerial, LEDTYPE
from bibliopixel import LEDMatrix, log
from BiblioPixelAnimations.matrix.ScreenGrab import ScreenGrab
log.setLogLevel(log.DEBUG)
# pixel_map = ultim8x8 ### ULTiM8x8
# pixel_map = ultim8x24 ### ULTiM8x24
# pixel_map = ultim24x24 ### ULTiM24x24
import time
from pixel_maps import ultim8x8, ultim8x24, ultim8x72, ultim24x24, ultim16x56
from bibliopixel.drivers.serial_driver import DriverSerial, LEDTYPE
from bibliopixel.drivers.visualizer import DriverVisualizer
from bibliopixel import LEDMatrix, log, MatrixRotation
from BiblioPixelAnimations.matrix.bloom import Bloom
ROTATE_0 = MatrixRotation.ROTATE_0
ROTATE_90 = MatrixRotation.ROTATE_90
ROTATE_180 = MatrixRotation.ROTATE_180
import time
from numpy import *
import struct
import serial
PIXEL_DATA = 2
BRIGHTNESS = 3
def msg(s, code, payload):
sz = len(payload)
class updateDriverThread(threading.Thread):
... cut
def run(self):
while not self.stopped():
try:
self._wait.wait()
self._updating.clear()
self._driver._update(self._data)
self._data = []
from bibliopixel.animation import BaseMatrixAnim
import bibliopixel.colors as colors
def getRule(val, n=8):
bits = [(val >> i) & 1 for i in range(n)]
def f(i):
return bits[i]
return f
def getVal(l):
@wyojustin
wyojustin / graph.py
Created July 14, 2017 13:40
generic algebraic graph lib
import numpy as np
import pylab as pl
def check_edges(edges):
'''Check that no edge is a loop or that has a multiple edge.'''
sorted_edges = []
out = True
try:
for i, j in edges:
assert i != j, "No loop allowed in Graph"
@wyojustin
wyojustin / ClockIOT.ino
Last active October 28, 2018 12:07
ClockIOT for esp8266
#include <Time.h>
#include <Wire.h>
#include <WiFiManager.h>
#include <FastLED.h>
#include <PubSubClient.h>
#include <EEPROM.h>
#include <EEPROMAnything.h>
#include <NTPClient.h>
#include <WebSocketsServer.h>