Skip to content

Instantly share code, notes, and snippets.

@Lukelectro
Lukelectro / !playlogic
Created November 4, 2024 21:49
Playlogic - play logic patterns on raspberry pi pico pins using the pio, as a proof of concept pattern generator
to name gist
@Lukelectro
Lukelectro / Weerstandenhulpje.py
Last active December 14, 2024 15:35
Een stukje 'terible bit of python' om te helpen samengestelde weerstanden uit te rekenen uit een beperkte, bekende selectie weerstanden op voorraad.
"""
Weerstanden-combinaties-maak programma.
Lijst van waarden opgeven (in source), grenzen voor gewenste waarde opgeven (in source) - todo later prompten
computer probeerd alle mogelijke serie-van-3-combinaties om tot de gewenste waarde te komen
en eventueel een combinatie met 2 parallel (2 serie, 1 parallel)
Ja, er komen dubbele combi's uit (A+B+C = A+C+B = C+A+B = C+B+A = B+A+C = B+C+A etc)
"""
lijst_van_weerstanden = [0, 150, 220, 1000, 1100, 1200, 1800, 3300, 4700, 10000, 11800, 12000, 33000, 47000, 56000, 180000]
@Lukelectro
Lukelectro / runradio.py
Last active October 9, 2024 14:27
radio stream receiver for raspi, bodged together from url mentioned in comments and a few other sources: A website with streaming urls (https://hendrikjansen.nl/henk/streaming.html) and a few adafruit / sparkfun tutorials on audio-to-usb-soundcard and readonly OS. (strangely, after routing audio to card 1 which is the usb card and setting the FS…
#!/usr/bin/env python3
# requires `mplayer` to be installed
# v1.0
# https://raspberrytips.nl/internet-radio-luisteren-raspberry-pi/
# modified to use vlc and a simple hd44780lcd + 3 buttons
# Re-modified 10-2024 to use --loop and --https-reconnect hoping to fix a 'sometimes stops playing' issue
import time
import os
@Lukelectro
Lukelectro / chargepump.pio
Created August 25, 2024 12:30
First experiment with Raspberry Pi Pico PIO: Waveform for Dickson charge pump https://en.wikipedia.org/wiki/Voltage_multiplier#Dickson_charge_pump
.program chargepump
;// this makes the waveshapes for a Dickson charge pump. Frequency can be set by setting PIO state machine clock frequency
.wrap_target
set pins 0
set pins 2 [10]
set pins 0
set pins 1 [10]
.wrap
@Lukelectro
Lukelectro / configuration.h
Created October 1, 2023 18:52
Marlin 2.1.2.1 configuration.h for Leapfrog Creatr (based on reverse engineering and https://support.lpfrg.com/support/solutions/articles/11000083346-firmware-archive-creatr-xl-), no display
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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
@Lukelectro
Lukelectro / sinetable.py
Created February 19, 2023 20:05
Sine table for MCU use (Not below zero / offset, though ofc this can be changed)
import math
import matplotlib.pyplot as plt
sintable = " "
sinplottable =[]
sinplotfull = []
# for conversion from volts to adc ticks
vfull=3.3
fullscale = 4096
@Lukelectro
Lukelectro / main.c
Created February 18, 2023 16:26
Atmega328p-based DC-AC converter to ring a T65 phone, simpler hardware, but horrible waveshape
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 8e6
#include <util/delay.h>
/*
FUSES = {
.low = 0xE2, //INTRC 8 MHZ, no CKDIV8
.high = 0xD9, // geen bootloader
.extended = 0xFF, // geen BOD
@Lukelectro
Lukelectro / main.c
Last active March 1, 2023 13:33
Atmega328p-based DC-AC converter to ring a T65 phone
/*
* Atmega328p-based DC-AC converter to ring a T65 phone.
* http://www.eluke.nl for schematic
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 8e6
#include <util/delay.h>
@Lukelectro
Lukelectro / main.c
Created March 1, 2023 13:29
neon indicator binary counter: 4 bits on 2 lamps (using both electrodes)
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 8e6
#include <util/delay.h>
/*
FUSES = {
.low = 0xE2, //INTRC 8 MHZ, no CKDIV8
.high = 0xD9, // geen bootloader
.extended = 0xFF, // geen BOD
@Lukelectro
Lukelectro / DemoReel100_modified.ino
Created January 7, 2022 20:51
Showreel for 241 pixel nested LED-rings, based on FastLED's showreel100, includes a modified Fire2012
#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.