Skip to content

Instantly share code, notes, and snippets.

import time
import threading
import gremlin
from vjoy.vjoy import AxisName
# Implement using recurring timer
def slider_update_timer():
vjoy = gremlin.input_devices.VJoyProxy()
@danricho
danricho / arduino-led-matrices.ino
Last active July 12, 2020 10:42
danricho.com example code
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
byte column[8] = {128,64,32,16,8,4,2,1};
byte row[8];
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
int latchPin = 8;
int clockPin = 12;
int dataPin = 11;
byte column[8] = {128,64,32,16,8,4,2,1};
byte row[8];
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
@danricho
danricho / Log.py
Last active November 21, 2021 23:02
def logPrint(*args, sep=" ", system=None, color=Style.RESET_ALL, **kwargs):
if system:
print(datetime.now().strftime('%H:%M:%S.%f')[:-3] + " : " + color + str(system).ljust(10)[0:10] + Style.RESET_ALL + " : " + sep.join(map(str,args)), **kwargs)
else:
print(datetime.now().strftime('%H:%M:%S.%f')[:-3] + " : " + sep.join(map(str,args)), **kwargs)
@danricho
danricho / MSFS2020ControlBox
Last active October 27, 2020 07:44
MSFS2020 Arduino based control box with Python SimConnect interface
Ignore - Gist Naming File
@danricho
danricho / tester.py
Last active December 20, 2020 04:55
Test of XInput-Python library with Xbox Series X controller.
# library: https://github.com/Zuzu-Typ/XInput-Python
# install using: pip install XInput-Python
#
# Tested with Xbox Series X controller on Windows 10, Python 3.8.6
# Controller firmware up to date on 20/12/2020 (Xbox Accessory app on PC)
# New "Share" Button inoperative.
# Got status of battery pack (Xbox Rechargable Battery with USB-C Cable)
# Tested with cable not bluetooth.
from XInput import *
@danricho
danricho / Tkinter_Simple.py
Created January 1, 2021 04:45
Simple wrapper for some of TKinter
from tkinter import *
from tkinter import ttk
from datetime import datetime
# A SMALL PYTHON CLASS I WROTE TO SIMPLIFY GUI DEVELOPMENT.
def myPrinter(str):
print(datetime.now().strftime('%H:%M:%S ') + str)
@danricho
danricho / Arduino Python Comms
Created January 1, 2021 05:04
Arduino Python Comms
This is a simple communication scheme between python and Arduino over Serial.
@danricho
danricho / UniFiClients.py
Last active July 30, 2022 12:59
Unifi API Access
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# BASED ON ALCHEMYDC'S GREAT SCRIPT HERE:
# https://github.com/alchemydc/unifi_device_manager
#
# > ADDED FUNCTIONS FOR GETTING CLIENT LIST AND ACTIVE CLIENT LIST
# > HAD TO ADD "verify=False" TO ALL REQUESTS CALLS
# BECAUSE I HAVEN'T GOT A CERT SORTED IN UNIFI YET
# > TESTED ON CLOUD KEY GEN2 PLUS
@danricho
danricho / govee_h5074.py
Created January 19, 2022 06:31
Govee Receive
# needs to run as sudo (probably to lock the use of the RPi bluetooth).
# based on gist by tchen @ https://gist.github.com/tchen/65d6b29a20dd1ef01b210538143c0bf4
# changed to look for H5074 and decode its data messages
from datetime import datetime
from time import sleep
from bleson import get_provider, Observer
# pip install bleson
govees = {}