Skip to content

Instantly share code, notes, and snippets.

@mcorrigan
mcorrigan / main.cpp
Last active November 28, 2023 22:40
Test Optidrive E3 Modbus RTU
#include <Arduino.h>
#include <ModbusMaster.h>
#define MAX485_DE_RE 4
ModbusMaster node;
void preTransmission()
{
digitalWrite(MAX485_DE_RE, HIGH);
@mcorrigan
mcorrigan / Microsoft.PowerShell_profile.ps1
Created June 3, 2024 14:41
vi and nano in Powershell (using WSL under)
function vi ($File){
$File = $File -replace "\\", "/" -replace " ", "\ "
bash -c "vi $File"
}
function nano ($File){
$File = $File -replace "\\", "/" -replace " ", "\ "
bash -c "nano $File"
}
@mcorrigan
mcorrigan / main.py
Created October 4, 2024 14:58
Advanced User Input Method
import sys
import tty
import termios
def user_input(prompt, default = None, sensitive = False, ret_type = str, required = True):
prompt_default = default
# if they provided a default, the input cannot be required
if default is not None:
required = False
@mcorrigan
mcorrigan / main.cpp
Created December 20, 2025 00:20
ESP32C3 Connects to Generic AB Shutter Clicker
/**
*
* This code is a BLE client for the AB Shutter3.
* It scans for the AB Shutter3 and connects to it.
* It then subscribes to the Input Report characteristic and waits for button events.
* When a button event is received, it prints the button event to the serial monitor.
*
* The code is written in C++ and uses the NimBLE library.
*
* The code is written for the ESP32 board.