Skip to content

Instantly share code, notes, and snippets.

View CountParadox's full-sized avatar

Lewys Martin CountParadox

View GitHub Profile
binary_sensor:
- platform: gpio
id: pullswitch
pin:
number: 32
mode: INPUT_PULLUP
- platform: template
id: switch_actuated
internal: true
lambda: 'return id(pullswitch).state;'
esphome:
name: sop-power-monitor
friendly_name: sop-power-monitor
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
#include <SoftwareSerial.h>
SoftwareSerial mySerial(1, 2); // RX, TX
// Pin definitions
// START
const int LED_RED_1 = 2;
const int LED_GREEN_1 = 3;
const int SWITCH_1 = 4;
import csv
import os
import xml.etree.ElementTree as ET
# Set the directory containing the dataset files
data_dir = '/path/to/dataset/files/'
# Set the threshold for outlier detection (in standard deviations from the mean)
threshold = 3
#include <SoftwareSerial.h>
SoftwareSerial mySerial(1, 2); // RX, TX
// Pin definitions
// START
const int LED_RED_1 = 2;
const int LED_GREEN_1 = 3;
const int SWITCH_1 = 4;
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 1); // RX, TX
const int LED1_RED = 20;
const int LED1_GREEN = 21;
const int SWITCH_1 = 16;
const int LED2_RED = 7;
const int LED2_GREEN = 8;
const int button[8] = {0, 1, 2, 3, 4, 5, 6, 7};
const int LED[16] = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23};
int buttonState[8];
void setup() {
for (int i = 0; i < 8; i++) {
pinMode(button[i], INPUT_PULLUP);
}
for (int i = 0; i < 16; i++) {
import time
import digitalio
import board
import busio
# Initialize the buttons
buttons = [digitalio.DigitalInOut(board.GPIO0), digitalio.DigitalInOut(board.GPIO1)]
# Initialize the LEDs
leds = [digitalio.DigitalInOut(board.GPIO2), digitalio.DigitalInOut(board.GPIO3),
@CountParadox
CountParadox / MotoUSB.ino
Created February 8, 2023 11:31
Digispark PTT Code
/*
This program will send USB HID keyboard presses to initiate
a PTT call with system of choice.
* Press and hold button 1 to activate PTT (Push-to-Talk) functionality.
*/
#include <DigiKeyboard.h> // Library for sending keystrokes as an HID device over USB
#include <OneButton.h> // Library for button input functions
OneButton button1(
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or