Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Shaw wyojustin

View GitHub Profile
View DS3231 bus change
## 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 Apr 2, 2015
EMSL Alpha5 mods with Zulu and DST
View Alpha5
/*
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 Apr 23, 2017
Add GET_NUM_PIXELS command to BiblioPixel DriverSerial
View firmware_code.ino
enum CMDTYPE
{
SETUP_DATA = 1,
PIXEL_DATA = 2,
BRIGHTNESS = 3,
GETID = 4,
SETID = 5,
GETVER = 6,
GET_NUM_LEDS = 7
};
View ULTiM8_ScreenGrab.py
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
View wmd.ino
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
View WMD.py
import time
from numpy import *
import struct
import serial
PIXEL_DATA = 2
BRIGHTNESS = 3
def msg(s, code, payload):
sz = len(payload)
View led.py
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 = []
View Wolfram_rules.py
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 Jul 14, 2017
generic algebraic graph lib
View graph.py
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 Oct 28, 2018
ClockIOT for esp8266
View ClockIOT.ino
#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>