Skip to content

Instantly share code, notes, and snippets.

View jasoncoon's full-sized avatar

Jason Coon jasoncoon

View GitHub Profile
#include <SmartMatrix3.h>
#define COLOR_DEPTH 24 // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24
const uint8_t kMatrixWidth = 32; // known working: 32, 64, 96, 128
const uint8_t kMatrixHeight = 32; // known working: 16, 32, 48, 64
const uint8_t kRefreshDepth = 36; // known working: 24, 36, 48
const uint8_t kDmaBufferRows = 4; // known working: 2-4, use 2 to save memory, more to keep from dropping frames and automatically lowering refresh rate
const uint8_t kPanelType = SMARTMATRIX_HUB75_32ROW_MOD16SCAN; // use SMARTMATRIX_HUB75_16ROW_MOD8SCAN for common 16x32 panels
const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE); // see http://docs.pixelmatix.com/SmartMatrix for options
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
@jasoncoon
jasoncoon / fastled-esp32-test.ino
Last active February 15, 2018 03:28
FastLED ESP32 Test
#include "FastLED.h"
#define DATA_PIN 18
#define NUM_LEDS 14
CRGB leds[NUM_LEDS];
uint8_t gHue = 0;
void setup() {
pinMode(DATA_PIN, OUTPUT);
@jasoncoon
jasoncoon / pyportal_tindie_order_tracker.py
Created March 3, 2019 20:59
Python code for a Tindie order tracker built with an Adafruit PyPortal
import time
import board
from adafruit_pyportal import PyPortal
# Get wifi details and more from a secrets.py file
try:
from secrets import secrets
except ImportError:
print("WiFi secrets are kept in secrets.py, please add them there!")
raise
@jasoncoon
jasoncoon / KC Multi Rotor RGB LED Wi-Fi Gate Instructions.md
Last active June 27, 2020 18:35
KC Multi Rotor RGB LED Wi-Fi Gate Instructions

KC Multi Rotor RGB LED Wi-Fi Gate Instructions

Powering on the gates.

Connect the gates to power via the micro USB port, using USB battery packs, wall adapters, etc. They should immediately light up with the last pattern/animation they were set to.

Controlling the gates via Wi-Fi:

  1. Connect the AP to power via the wall adapter.
  2. A short while after the AP is powered on, you should be able to see and connect to KCMR_GATES on a laptop, tablet, or phone.
#include "FastLED.h"
#define NUM_LEDS 60
#define DATA_PIN 3
CRGB leds[NUM_LEDS];
uint8_t hue = 0;
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
@jasoncoon
jasoncoon / FastLED-RGB-HSV-Tutorial.ino
Last active June 28, 2021 20:40
FastLED RGB & HSV Tutorial
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 8
// Data pin for the LEDs
#define DATA_PIN 17
// Potentiometer pins
#define POT_0_PIN A0
@jasoncoon
jasoncoon / code.py
Created September 18, 2021 13:25
Fibonacci64 - Expanding Rainbows - CircuitPython & NeoPixel Library
# Fibonacci64 - Expanding Rainbows - CircuitPython & NeoPixel
# https://gist.github.com/jasoncoon/a70d24ed38994aa669f943c2e84512e4
# https://www.evilgeniuslabs.org/fibonacci64-micro
# This example uses CircuitPython and the Adafruit NeoPixel library
# You'll need neopixel.mpy in your /lib directory
# More information: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries
import board
import neopixel
@jasoncoon
jasoncoon / fibonacciStars
Last active March 15, 2022 13:57
Star pattern for Fibonacci256: https://www.tindie.com/products/19429
// Fibonacci Stars pattern by Jason Coon
// For Fibonacci256: https://www.tindie.com/products/19429
// Meant for use in this sketch: https://github.com/jasoncoon/esp8266-fastled-webserver/tree/fibonacci256
// Draws shooting stars radiating outward from the center, along Fibonacci spiral lines.
void fibonacciStarsWithOffset(uint16_t stars[], uint8_t starCount, uint8_t offset = 21, bool setup = false, bool move = false) {
// use a number from the Fibonacci sequence for offset to follow a spiral out from the center
for (uint8_t i = 0; i < starCount; i++) {
/*
FastLED Mapping Demo: https://github.com/jasoncoon/led-mapper
Copyright (C) 2022 Jason Coon, Evil Genius Labs LLC
For LumosRing by Bradán Lane STUDIO
https://www.tindie.com/products/bradanlane/lumosring-circuitpython-led-ring-block/
This program 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
// Beating heart pattern. The heart shape is formed by a square turned 45 degees to form a \"diamond\" which is
// the base of the heart. Two semi-circles connect to the upper two sides of the \"diamond\" for the rounded heart
// portion. Depending on your resolution, you may want to play with the anti-aliasing distance to improve the
// definition and appearance of the heart's outline.
//
// Debra Ansell (GeekMomProejcts) 8/18/2022
// Ratio of the height of the heart to the length of one side of the diamond inside it
// length of one side of the diamond is also the diameter of the circle
var ratio = (0.5 + 3*sqrt(2)/4)