Skip to content

Instantly share code, notes, and snippets.

@dglaude
dglaude / All keycode sorted (by column 2)
Last active March 16, 2024 19:51
Keyboard mapping CardPuter Card Computer
K.APPLICATION
K.Z
K.C
K.B
K.M
K.DOWN_ARROW
K.SPACEBAR
K.CAPS_LOCK
K.S
K.F
@dglaude
dglaude / code.py
Last active January 25, 2024 05:25
Raspberry Pi Pico thermal camera
# mlx90640_pygamer learn guide:
# * https://learn.adafruit.com/adafruit-mlx90640-ir-thermal-camera/circuitpython-thermal-camera#
#
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
#
# Adapted by David Glaude for 240x240 screen.
#
# 1) RedRobotics Pico to Zero Adaptor v0.2:
# * https://www.tindie.com/products/redrobotics/pico-2-pi-adapter-board/
@dglaude
dglaude / xmas.py
Created December 20, 2017 22:06
RTTTL xmas song in Python
# xmas RTTTL tunes extracted from the internet.
# Below from https://www.freewebspace.net/forums/index.php?threads/xmas-ringtones.15092/
SONGS = [
'Happy New Year:d=4,o=5,b=125:a5,d.,8d,d,f#,e.,8d,e,8f#,8e,d.,8d,f#,a,2b.,b,a.,8f#,f#,d,e.,8d,e,8f#,8e,d.,8b5,b5,a5,2d,16p',
'Hark The Herald Angels:d=4,o=5,b=100:10a.,19p,40a.,36p,20a.,20p,26g.,5p,24e.,15p,6f.,40p,e.,96p,23e.,72f.,30p,240,g.,19p,c.,40p,3c.,17p,3d.,13p,1c.',
'Have Yourself A Merry Little Christmas:d=4,o=5,b=100:16b,8c,8e.,g.,16b,8c6,8g,f,16p,8e,16d,c,16c,d.,8p,16b,8c,8e,g.,16b,8c.6,2g,p,e,g,c6,16d6,8e.6,8d.6,8c6,8b,8a,g,16e,f,2e,16p,8f,16g,16d,16d,8c,8d,16a,c.,e,g,16b,8c.6,8g,f.,16p,8e,16d,8c,16d,16e,8d.,8e,8p,16c,8e,g.,16b,8c6,2g,p,e,g,c6,d6,8d.6,16c6,16p,8b,16a,g#.,8b.,16b,2c.6,16p',
'I Saw Mommy Kissing Santa Claus:d=4,o=5,b=160:2c.,d,e,g,a,8c6,2b.,g,1e,a,g,e,c,a,g,e,8c.,1b.,f,e,d,d.,8c#.,2d.,8a.,16b.,8a.,g.,f#.,8a.,2g.,e,d,e,f#,g,a,g#,a,a#,b,a,f,8e,2d.,g,2c.,d,e,g,a,8c6,1b,g,1e,a,g,2e,16c,a,g,e,8c.,1a,16g#,8a.,16b,c6,8c.6,c6,8d.6,1b,f#,8a.,16a
@dglaude
dglaude / mapping_Physical_to_BMC.py
Created April 3, 2021 22:43
Having Physical Pin number for the Pi under Blinka
#GPIO_P1 = 3V3
#GPIO_P2 = 5V
GPIO_P3 = D2
#GPIO_P4 = 5V
GPIO_P5 = D3
#GPIO_P6 = GND
GPIO_P7 = D4
GPIO_P8 = D14
#GPIO_P9 = GND
GPIO_P10 = D15
@dglaude
dglaude / code_2x.py
Last active January 16, 2024 06:36
ulab 2x, 3x image upscaling in CircuitPython
# Double size upscaling of an array by @v923z
import ulab
n = 4 # input size, the thermal sensor is 8x8
b = ulab.array(range(n * n)).reshape((n, n)) # dummy data for testing
a = ulab.zeros((2*n-1, 2*n-1)) # the upscaled image
# Some magic by @v923z
a[::2,::2] = b
a[1::2,::2] = 0.5 * (b[:-1,:] + b[1:, :])
@dglaude
dglaude / 1st_readme.txt
Last active January 6, 2024 14:14
Home Assistant Rainbow Loop with Ikea Tradfri RGB light
Please find below the various piece of code that together control my RGB light to loop in Rainbow.
Every two seconds, it change from one colour to another based on the value of the second.
So it compute 30 differents RGB value in a "circle", all with the same Saturation and Brightness both forced to 1.0
The transition from one colour to another is done in one seconds.
The name of my Tradfri RGB light bulb is "light.couleur"
A link to my video on Twitter:
https://twitter.com/DavidGlaude/status/1059596285991366657
@dglaude
dglaude / thinker.md
Last active December 31, 2023 15:12
Projects logs of David Glaude based on twitter post
@dglaude
dglaude / code.py
Last active December 22, 2023 06:05
Playing an wav audio file on button press with "Feather RP2040 Prop-Maker" (update Debounce)
import supervisor
supervisor.set_next_code_file(None, reload_on_error=True)
import board
import audiocore
import audiobusio
import audiomixer
from digitalio import DigitalInOut, Direction, Pull
from adafruit_debouncer import Debouncer
@dglaude
dglaude / notes.md
Last active November 15, 2023 09:32
WebHID research notes
@dglaude
dglaude / Ruxpin_wakeup.py
Created October 31, 2023 21:55
Halloween Teddy Ruxpin: Monitor time of fly distance and power off USB-A port for 5 minutes when there is activity.
# SPDX-FileCopyrightText: 2022 David Glaude (based on 2021 ladyada for Adafruit Industries)
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Carter Nelson for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
# Simple demo of the VL53L1X distance sensor.
# Will print the sensed range/distance every second.