Skip to content

Instantly share code, notes, and snippets.

@dglaude
dglaude / BLE_with_color_indicator.py
Last active Jun 22, 2022
Circuit Python USB Host + Keyboard mirroring to USB and BLE
View BLE_with_color_indicator.py
"""
This example acts as a BLE HID keyboard to peer devices.
It get's keycode from UART RX.
Color indication:
* BLUE_LED is blinking when not connected and steady blue when connected
* NEOPIXEL alternate between RED / GREEN / BLUE every time a keycode is transmitted (up and down event)
"""
import time
@dglaude
dglaude / code.py
Last active May 17, 2022 — forked from wildestpixel/code.py
Pimoroni Pico Display Pack Circuitpython 6.2 b1 running code
View code.py
"""
adapted from http://helloraspberrypi.blogspot.com/2021/01/raspberry-pi-picocircuitpython-st7789.html
"""
# Adapted for 240x240 MiniPiTFT from @Pimoroni
# Based on https://gist.github.com/wildestpixel/86ac1063bc456213f92972fcd7c7c2e1
# Found thanks to https://www.recantha.co.uk/blog/?p=20820&
import os
import board
@dglaude
dglaude / 1st_readme.txt
Last active Feb 7, 2022
Home Assistant Rainbow Loop with Ikea Tradfri RGB light
View 1st_readme.txt
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 / adafruit_st25dv16.py
Created Dec 20, 2021
Writing URI into st25dv16 from CircuitPython
View adafruit_st25dv16.py
# 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
Created May 16, 2021
Hidden Mouse Jiggler
View code.py
import time
import board
import digitalio
import storage
import usb_hid
from adafruit_hid.mouse import Mouse
import usb_cdc
#usb_hid.enable(devices=(usb_hid.MOUSE,)) ###AttributeError: 'module' object has no attribute 'MOUSE'
@dglaude
dglaude / code.py
Created Dec 1, 2021
Belgian vaccination status for MagTag
View code.py
from adafruit_magtag.magtag import MagTag
from adafruit_progressbar.progressbar import ProgressBar
# BELGIUM
POPULATION = 11589616
DATA_SOURCE = "https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/vaccinations/country_data/Belgium.csv"
magtag = MagTag(url=DATA_SOURCE)
magtag.network.connect()
@dglaude
dglaude / super_multi.py
Created Sep 8, 2021
Multiple Buzz! controler on one Raspberry Pi.
View super_multi.py
"""
Turn on all the LEDs from each Buzz! controler one after the other.
Work with both kind of wired Buzz! controler.
Require to install hid library, not an easy task.
"""
import hid
import time
@dglaude
dglaude / simple_test.py
Created Jul 24, 2021
keypad simple test by @FoamyGuy found on adafruit Discord 23/07/2021
View simple_test.py
from keypad import Keys
import board
import time
pins = [board.BUTTON_A, board.BUTTON_B]
keys = Keys(pins, value_when_pressed=False, pull=True)
while True:
if keys.events.overflowed:
keys.events.clear()
@dglaude
dglaude / code.py
Last active Jun 16, 2021
Raspberry Pi Pico thermal camera
View code.py
# 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 / emojiclock
Created Jun 14, 2021
Tentative dynamic emoji in Discord (edit previous post and change by a different emoji every second)
View emojiclock
# CircuitPython Discord rotating clock emoji (spam).
# Type an emoji in Discord... do nothing else, with your ItsiBitsy nrF.
# Press the button to replace that emoji by another one every second.
import time
import board
import usb_hid
from digitalio import DigitalInOut, Direction
from adafruit_hid.keyboard import Keyboard