Skip to content

Instantly share code, notes, and snippets.

View adammhaile's full-sized avatar

Adam Haile adammhaile

View GitHub Profile
#include "FastLED.h"
FASTLED_USING_NAMESPACE
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
//
// This example also shows one easy way to define multiple
// animations patterns and have them automatically rotate.
@adammhaile
adammhaile / Porting.md
Last active March 1, 2023 04:56
BiblioPixel 3.0 Release docs

Porting from BiblioPixel 2.x to 3.0

As much as possible we've tried to make BiblioPixel 3.0 as backwards compatible as possible with 2.x, so in many cases your code should just work. But there are a few things to be aware of as you get started.

Now Python 3.x only!

By far, the biggest change is that we have completely dropped Python 2 support. Inst ing BiblioPixel via pip will now fail on Python 2 unless you use pip install BiblioPixel<=3 to force it to install the older version. We support Python 3.4, 3.5, and 3.6. As with any work with python, but especially with Python 3, we highly recommend installing everything inside a virtualenv.

Base LED handlers

@adammhaile
adammhaile / FastLEDDisk.ino
Last active November 27, 2020 03:11
Examples of using angle and radius to select pixels on a circular pixel layout using FastLED
#include "FastLED.h"
#define NUM_LEDS 255
#define DATA_PIN SPI_DATA
#define CLOCK_PIN SPI_CLOCK
// Define the array of leds
CRGB leds[NUM_LEDS];
@adammhaile
adammhaile / config.h
Created September 2, 2019 22:48
grbl
/*
config.h - compile time configuration
Part of Grbl
Copyright (c) 2012-2016 Sungeun K. Jeon for Gnea Research LLC
Copyright (c) 2009-2011 Simen Svale Skogsrud
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
def rmdir(path, recursive=True):
for f in os.listdir(path):
fu = os.path.join(path, f)
if os.path.isfile(file_path):
os.unlink(file_path)
elif recursive and os.path.isdir(file_path):
shutil.rmtree(file_path)
from random import randint
import time
class Jewels:
def __init__(self):
self.matrix = [[randint(0, 5) for x in range(16)] for y in range(16)]
self._reset_visited()
def _reset_visited(self):
self.__visited = [[False for x in range(16)] for y in range(16)]
import numpy
import scipy.signal
import pygame, pygame.sndarray
def play_for(sample_wave, ms):
"""Play the given NumPy array, as a sound, for ms milliseconds."""
sound = pygame.sndarray.make_sound(sample_wave)
sound.play(-1)
from __future__ import print_function
import sys
from bibliopixel.drivers.serial_driver import DriverSerial
ports = DriverSerial.findSerialDevices(hardwareID="16C0:0483")
for p in ports:
i = DriverSerial.getDeviceID(p)
print('{} -> {}'.format(p, i))
from __future__ import print_function, division
BASE_SCRIPT = """
S{power}
G90
G0 X{x} Y{y} F12000
G91
G1 X10 F500
2018-01-29 23:16:19,962 - octoprint.server - INFO - --- Log roll over detected ---------------------------------------------------
2018-01-29 23:16:19,962 - octoprint.server - INFO - OctoPrint 1.3.6
2018-01-29 23:16:19,965 - octoprint.plugin.core - INFO - 15 plugin(s) registered with the system:
| Announcement Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.6-py2.7.egg/octoprint/plugins/announcements
| BLTouch Plugin (0.2.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_BLTouch
| Core Wizard (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.6-py2.7.egg/octoprint/plugins/corewizard
| CuraEngine (<= 15.04) (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.6-py2.7.egg/octoprint/plugins/cura
| Discovery (bundled) = /home/pi/oprint/lib/python2.7/site-packages/OctoPrint-1.3.6-py2.7.egg/octoprint/plugins/discovery
| Display ETA (1.0.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_eta
| EEPROM Marlin Editor Pl