Skip to content

Instantly share code, notes, and snippets.

View toxicantidote's full-sized avatar

toxicantidote

View GitHub Profile
@toxicantidote
toxicantidote / fridge_fault_bridge.ino
Last active March 8, 2024 10:25
Compressor interfacing for new fridge controller
// pins where things are connected
#define PIN_INTERRUPT 2
#define PIN_LED_R 11
#define PIN_LED_G 10
#define PIN_LED_B 9
#define PIN_STATUS 13
#define PIN_RELAY_1 A0
@toxicantidote
toxicantidote / fridge_gui.py
Last active March 27, 2024 10:56
Fridge GUI/control
import board
from micropython import const as S
## Screen parameters
LCD_WIDTH = S(130)
LCD_HEIGHT = S(64)
LCD_ROTATION = S(0)
## Button thresholds
THRESHOLD_BLUE = S(8000)
@toxicantidote
toxicantidote / picow_st7735s.py
Created July 13, 2023 23:53
ST7735S display test - CircuitPython (Pico W) - NOT WORKING
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import board
import terminalio
@toxicantidote
toxicantidote / esp32_st7735s.py
Created July 13, 2023 23:38
ST7735S display test - CircuitPython (ESP32)
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
This test will initialize the display using displayio and draw a solid green
background, a smaller purple rectangle, and some yellow text.
"""
import board
import terminalio
@toxicantidote
toxicantidote / Nayax sales reporting.py
Created June 28, 2022 08:18
Nayax sales reporting
## standard libraries
import re
import time
import queue
import threading
import json
from tkinter import *
from tkinter import ttk, font, messagebox, filedialog
import datetime
import os
@toxicantidote
toxicantidote / wifi_select.ino
Last active May 22, 2023 01:08
ESP32 Wi-Fi search and connect to saved
#include <WiFi.h>
#include <Preferences.h>
#include <esp_task_wdt.h>
#define CMDPROMPT "ESP32> "
#define TIMEOUT 10000
// cmd line vars
char cmdBuffer[32];
int cmdBufferPosition = 0;
@toxicantidote
toxicantidote / SolarInterface.py
Created April 25, 2022 11:32
MPP solar PIP-1012-MSE interfacing
#!/usr/bin/python3
## which serial port the MPP Solar inverter is connected to
serial_port = '/dev/ttyS0'
###
import serial ## provided by 'pyserial' from pip
import crc16 ## provided by 'crc16' from pip
import sys ## inbuilt library
@toxicantidote
toxicantidote / foxhunter.py
Created August 5, 2021 04:53
Finds Fieldfox units on the LAN
import socket
import threading
import re
class FoxHunter(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.name = 'thread_FoxHunter'
self.units = []
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@toxicantidote
toxicantidote / pinger.py
Last active June 22, 2021 01:26
Network host ping tool
## Site ping check tool ##
##
## Originally developed and tested on Win10 with Python 2.7. Updates made with
## Python 3.7, but should still work on Python 2.x provided the Tk install
## isn't ancient.
##
## Reads one or more files containing details of sites to ping, pings them at
## the defined frequency, and displays the result in a GUI.
##
## Within the host files, the last word on each line is considered to be the
@toxicantidote
toxicantidote / MCP2200 via websockets.py
Created October 26, 2018 11:23
Controlling MCP2200 (Denkovi relay) via Websockets and NanoPi switches
## Automation relay switcher server
## Allows control of MCP2200 based four port relay board via a websocket. Also interfaces with two pins
## on the NanoPi GPIO to read the state of two buttons using only two wires.
## Address to listen on. Set to 0.0.0.0 for all
listenAddress = '0.0.0.0'
## Port to listen on
listenPort = 8000