Skip to content

Instantly share code, notes, and snippets.

View jameseleach's full-sized avatar

James Leach jameseleach

View GitHub Profile
@jameseleach
jameseleach / code-deep-sleep.py
Last active January 16, 2021 18:32
Weather Station
# Time libraries
import rtc
import time
import alarm # for sleep and deep sleep
# Adafruit hts221 and supporting libraries
import board
import busio
import adafruit_hts221 # this library is dependent on adafruit_bus_device and adafruit_register
@jameseleach
jameseleach / code.py
Last active December 25, 2020 01:02
NeoPixel Lights
import time
import board
import neopixel
from adafruit_button import Button
from adafruit_pyportal import PyPortal
from adafruit_bitmap_font import bitmap_font
# Define colors
colors = [
{'name': "1900K", 'color': (255, 147, 41)}, # Candle
@jameseleach
jameseleach / results.json
Created December 5, 2020 19:05
Weather JSON
{
"lat": 29.58,
"lon": -98.41,
"timezone": "America/Chicago",
"timezone_offset": -21600,
"current": {
"dt": 1607192444,
"sunrise": 1607174084,
"sunset": 1607211279,
"temp": 48.22,
@jameseleach
jameseleach / dimtext.py
Created November 26, 2020 00:10
displayio.Palette, Reshader, and adafruit_display_text.label.Label...
import board
import displayio
import adafruit_imageload
from adafruit_display_text.label import Label
from adafruit_bitmap_font import bitmap_font
from adafruit_matrixportal.matrix import Matrix
from reshader import Reshader
matrix = Matrix(width=64, height=32, bit_depth=6)
display = matrix.display
@jameseleach
jameseleach / code.py
Last active December 3, 2020 14:04
MatrixPortal Clock and Weather
from time import localtime, monotonic
from json import loads
from board import SCL, SDA, NEOPIXEL, A0
from busio import I2C
from neopixel import NeoPixel
from displayio import Group, Bitmap, Palette, TileGrid
from adafruit_vcnl4040 import VCNL4040
from adafruit_imageload import load
from adafruit_display_text.label import Label
from adafruit_bitmap_font.bitmap_font import load_font
@jameseleach
jameseleach / Uninstall-WindowsStoreApps.ps1
Created November 18, 2020 23:07
Uninstall Windows Store Apps
param (
[System.String]$LogFile = "C:\Temp\IntuneLogs\WindowsAppsUninstall.log",
$apps = (
"Microsoft.3DBuilder",
"Microsoft.BingWeather",
"Microsoft.Messaging",
"Microsoft.Microsoft3DViewer",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.MicrosoftSolitaireCollection",
"Microsoft.MixedReality.Portal",
@jameseleach
jameseleach / simple-clock.py
Last active November 15, 2020 01:24
Simple Clock
import time
import board
from adafruit_matrixportal.matrixportal import MatrixPortal
DEBUG = False
TIME24H = False
# --- Display setup ---
matrixportal = MatrixPortal(status_neopixel=board.NEOPIXEL, bit_depth=4, debug=DEBUG, width=64, height=32)
@jameseleach
jameseleach / code.py
Last active August 20, 2020 22:56
Temp and Humidity Sensor for the Adafruit Clue
"""Monitor customisable temperature and humidity ranges, with an optional audible alarm tone."""
# Modification to allow changing between degrees Fahrenheit and Celsius
# Original source:
# https://github.com/adafruit/Adafruit_CircuitPython_CLUE/blob/master/examples/clue_temperature_humidity_monitor.py
from adafruit_clue import clue
from time import sleep
# Set desired temperature range in degrees Celsius.
min_temperature = 24