Skip to content

Instantly share code, notes, and snippets.

@dglaude
dglaude / 1st_readme.txt
Last active December 2, 2025 22:04
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 / README.MD
Created October 20, 2025 00:26
AI generated BLE to USB-HID for Belgian French keyboard

I needed a way to type my computer from my phone, acting as a keyboard. But I cannot add software to my computer, so I needed to be a USB-HID device. I asked Gemini for help, and he produced this code, first for US EN keyboard, but then I addapted it for Belgian French.

For the Belgian French keyboard, I went to Neradoc repo, but Î could only find French keyboard: https://github.com/Neradoc/Circuitpython_Keyboard_Layouts

So Î went to his page: https://www.neradoc.me/layouts/ Gave it the Belgian French keyboar page: https://kbdlayout.info/kbdbe And it generated for me the needed Python file

@dglaude
dglaude / notes.md
Created September 24, 2022 21:24
USB Host in CircuitPython
@dglaude
dglaude / evcc.yaml
Created July 7, 2024 08:08
Working config of EVCC for Tesla with BLE HTTP Proxy and Teslamate
# Setup and IP addressing:
# 1) EVCC run on an NUC at 192.168.1.157 :7070
# 2) HomeWizard P1 meter reader at 192.168.1.98 :80
# 3) Shelly Pro EM - 50 as PV meter at 192.168.1.191 :80
# 4) TeslaWallConnector as Wall Charger at 192.168.1.42 :80
# 5) wimaha/TeslaBleHttpProxy as BLE proxy to control the Tesla at 192.168.1.157 :8080
# 6) teslamate-org/teslamate with mqtt broker at 192.168.1.35 :1883
network:
schema: http
@dglaude
dglaude / code.py
Created October 18, 2022 22:03
Seeeduino XIAO RP2040: Build in RGB LED simultaniously as NeoPixel.
"""Seeeduino XIAO RP2040: Build in RGB LED simultaniously as NeoPixel."""
import time
import board
import neopixel
import digitalio
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
@dglaude
dglaude / code.py
Created June 2, 2025 19:00
My network.py as it is before the "in the weed".
# How I use network.py
# ...
import network
socket_pool, ssl_context = network.init_network()
# ...
@dglaude
dglaude / adafruit_st25dv16.py
Created December 20, 2021 00:55
Writing URI into st25dv16 from CircuitPython
# SPDX-FileCopyrightText: Copyright (c) 2021 Tim Cocks for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_st25dv16`
================================================================================
CircuitPython driver for the I2C EEPROM of the Adafruit ST25DV16 Breakout
@dglaude
dglaude / code.py
Last active April 25, 2025 20:21
Change the MagTag program you want to run at startup.
# This file should be saved as code.py
# At MagTag startup (or at wakeup time), keep one one of the 4 button pressed.
# The MagTag will switch to the program you choose and remember that decision at each wakeup.
# The trick is to have for each button one CircuitPython program to import.
# You can customise the app_to_start list, here is the current setting:
# no button => magtag_weather
# 1 (D15) => magtag_showtimes
# 2 (D14) => magtag_tree
# 3 (D12) => magtag_spacex
# 4 (D11) => magtag_year_progress_percent
@dglaude
dglaude / boot.py
Last active March 13, 2025 00:40
MacroPad (CircuitPython) that implement Zaparoo protocol to select game on the MisterFPGA
import storage, usb_cdc
import board, digitalio
import usb_hid, usb_midi
# On the Macropad, pressing a key grounds it. You need to set a pull-up.
# If not pressed, the key will be at +V (due to the pull-up).
button = digitalio.DigitalInOut(board.KEY12)
button.pull = digitalio.Pull.UP
if button.value: # Disable devices only if button is not pressed.