Skip to content

Instantly share code, notes, and snippets.

@DedeHai
DedeHai / gist:2bf680f9321c379daa54f84aed5097a4
Created January 5, 2026 05:10
Proof of concept of a lava-lamp blob pixel FX
# disclaimer: fully AI generated code, it works just to demonstrate the visual idea
import pygame
import random
import math
import numpy as np
from scipy.ndimage import gaussian_filter
# Initialize Pygame
pygame.init()
/*
Low level driver test to generate 4-lane outputs for LED data (WS281x) using 4-step-cadence to encode the bit signals
This is the result of many hours of trial and error - there is little to no documentation and whatever I found in online examples did not properly work for the C3 but finally figured out a way that works.
took some inspiration from an M2M dma trasnfer example here: https://esp32.com/viewtopic.php?t=39242
also found something very similar with a similar jurney (welcome to hell ;) )https://github.com/vladkorotnev/plasma-clock/blob/main/src/display/akizuki_k875.cpp this may also be a legit way, i.e. using high level API init and then modify, could be less brittle across SDK versions but I could not get it to work that way.
This code works in Arduino IDE 2.3.4 using "esp32 by Espressif Systems v. 3.3.5"
To anyone stumbling on this piece of code: feel free to put it to whatever use you want, no licensing restrictions.
If you find it useful to you, please feel free to buy me a beer or two :) p
/*
Capacitive Sensing methods using Arduino
Visit https://bashtelorofscience.wordpress.com/ for a description and the circuit required to make this work.
Please see https://www.arduino.cc/en/Reference/PortManipulation for an explanation on the direct I/O access used in this sketch.
note:
the assembler command
__asm__("nop\n\t");
is used in the sketch to do single clock (62ns) delays.