This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| * 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function vi ($File){ | |
| $File = $File -replace "\\", "/" -replace " ", "\ " | |
| bash -c "vi $File" | |
| } | |
| function nano ($File){ | |
| $File = $File -replace "\\", "/" -replace " ", "\ " | |
| bash -c "nano $File" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <ModbusMaster.h> | |
| #define MAX485_DE_RE 4 | |
| ModbusMaster node; | |
| void preTransmission() | |
| { | |
| digitalWrite(MAX485_DE_RE, HIGH); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <ModbusMaster.h> | |
| #define MAX485_DE_RE 4 | |
| #define OUTPUT_MOTOR_FREQ 0x0007 | |
| #define DRIVE_STATUS 0x0006 | |
| #define DRIVE_TEMP 0x0018 | |
| ModbusMaster node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "build": { | |
| "arduino": { | |
| "ldscript": "esp32c3_out.ld" | |
| }, | |
| "core": "esp32", | |
| "extra_flags": [ | |
| "-DARDUINO_LOLIN_C3_PICO", | |
| "-DARDUINO_USB_MODE=1", | |
| "-DARDUINO_USB_CDC_ON_BOOT=1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include "Animator.h" | |
| Animator::Animator(){ | |
| // nothing for now | |
| } | |
| void Animator::begin(Adafruit_SSD1306 *display, unsigned int width, unsigned int height, HardwareSerial* serial){ | |
| _display = display; | |
| _stream = serial; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from picamera import PiCamera | |
| from picamera.array import PiRGBArray | |
| import sys, curses, time, cv2 | |
| import numpy as np | |
| import warnings | |
| import collections | |
| # TODO: resolve these at some point | |
| warnings.filterwarnings(action='ignore', message='Mean of empty slice') | |
| warnings.filterwarnings(action='ignore', message='invalid value encountered in double_scalars') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void displayPositionedText(char* buf, int textSize, Position vpos, Position hpos) { | |
| display.setTextSize(textSize); | |
| int16_t x1, y1; | |
| uint16_t w, h; | |
| display.getTextBounds(buf, 0, 0, &x1, &y1, &w, &h); | |
| int _vpos = 0, _hpos = 0; | |
| switch (vpos) { | |
| case CENTER: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- this was just a rapid development program for fun --> | |
| <html> | |
| <body> | |
| <h1>Chutes and Ladders!</h1> | |
| <button onclick="beginGame()">Play Game</button> | |
| <img src="https://thumbs.dreamstime.com/z/s-board-games-chutes-ladders-woodbridge-new-jersey-october-circa-game-shown-128701391.jpg" /> | |
| <script> | |
| // general configs | |
| var spin_min = 1, spin_max = 6; | |
| var exact_space_win = true; |
NewerOlder