Skip to content

Instantly share code, notes, and snippets.

View petervanderwalt's full-sized avatar
🏠
Working from home

Peter van der Walt petervanderwalt

🏠
Working from home
  • Graaff-Reinet, Eastern Cape, South Africa
View GitHub Profile
@petervanderwalt
petervanderwalt / blackbox x32 esphome config
Created July 24, 2024 14:14
blackbox x32 esphome config
# Home Assistant API
esphome:
name: blackbox-x32
api:
encryption:
key: "khzBNPI53CyaxavRumDUr5I4RQtOJXZuY0XpkKLrwvo="
ota:
password: "4aefe0cd593f9a410cfaa9fa3e29f50b"
@petervanderwalt
petervanderwalt / tz_data.json
Created June 19, 2024 17:02 — forked from alwynallan/tz_data.json
Worldwide timezone data for iotclock.js
{
"servers":[
{"name":"pool.ntp.org"},
{"name":"asia.pool.ntp.org"},
{"name":"europe.pool.ntp.org"},
{"name":"north-america.pool.ntp.org"},
{"name":"oceania.pool.ntp.org"},
{"name":"south-america.pool.ntp.org"}
],
"regions":[
@petervanderwalt
petervanderwalt / wifiscan_debug.ino
Created September 14, 2022 15:06 — forked from tablatronix/wifiscan_debug.ino
arduino esp8266 wifiscanner with detail, rssi sorting and duplicate filtering
/*
* This sketch demonstrates how to scan WiFi networks.
* The API is almost the same as with the WiFi Shield library,
* the most obvious difference being the different file you need to include:
*/
#include "ESP8266WiFi.h"
void setup() {
Serial.begin(115200);
// Serial.setDebugOutput(true);
echo "---------------------------------------------------"
echo "[STARTING] OPENBUILDS-CONTROL INSTALL SCRIPT: "
echo " Please wait for each step to complete. "
echo "---------------------------------------------------"
echo "(1/10) Updating Repositories..."
sudo apt-get update > /dev/null 2>&1
echo "(2/10) Upgrading RaspiOS..."
sudo apt-get upgrade -y > /dev/null 2>&1
echo "(3/10) Installing remote desktop (TightVNC and XRDP)..."
sudo apt install -y tightvncserver > /dev/null 2>&1
@petervanderwalt
petervanderwalt / gist:8b1e058e130b5721ef6fcb90ab5946bb
Last active August 7, 2020 18:01
Parse Grbl PRB result in Arduino
#define STR_GRBL_BUF_MAX_SIZE 80 // size has been increased from 10 to 60 to support grbl [Msg:] Longest is [GC:....] message
//char grblLastMessage[STR_GRBL_BUF_MAX_SIZE] = "[PRB:12.345,10.500,-0.100:1]" ;
char grblLastMessage[STR_GRBL_BUF_MAX_SIZE] = "[MSG:'$H'|'$X' to unlock]" ;
float probeResult[3] ; // 4 because we can support 4 axis
int probeResultIdx = 0;
bool probeResultSuccess = false;
@petervanderwalt
petervanderwalt / gist:128a035d3ec98c8933b84e7052f3d888
Created March 18, 2019 11:45
Arduino Code to handle serial commands A000 style M123 G0 etc
void handleCommand()
{
byte val = cmdArray[arrayIdxRead+1]; // The command parameter value
switch(cmdArray[arrayIdxRead])
{
case 'A': // All Motors on/off
if(val == '1') {digitalWrite(12, HIGH);}
else {digitalWrite(12, LOW);}
break;
@petervanderwalt
petervanderwalt / Attiny85_batteryMonitor.ino
Created October 19, 2018 13:07 — forked from dwhacks/Attiny85_batteryMonitor.ino
Attiny battery monitor with tiny core.
/*
Attiny85_batteryMonitor
Ideas borrowed from: https://github.com/unixbigot/Flat-Mate
modified for arduino tiny core by DWhacks
*@@ Voltage trigger levels.
*
// Function created to obtain chip's actual Vcc voltage value, using internal bandgap reference
// This demonstrates ability to read processors Vcc voltage and the ability to maintain A/D calibration with changing Vcc
// Results printed to serial monitor @ 38400 baud are volt X 100, i.e 5 volts = 500
// Now works for 168/328 and mega boards.
// Thanks to "Coding Badly" for direct register control for A/D mux
// 1/13/10 "retrolefty"
int battVolts; // made global for wider avaliblity throughout a sketch if needed, example for a low voltage alarm, etc
// value is volts X 100, 5 vdc = 500
/*
Version 15-10-2017.002
Arduino MEGA
- Serial1 (pins 18 and 19) communicates with arduino with grbl shield
GCode Sender.
Hardware: Arduino Uno,
,analog thumbstick (small joystick, with intgrated push button)
,sd card reader with SPI interface
@petervanderwalt
petervanderwalt / barbot.ino
Created October 14, 2017 08:16
Bar Robot with LCD
//Compatible with the Arduino IDE 1.0
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Button.h> // from (https://github.com/madleech/Button/)
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
Button button1(2); // Connect your button between pin 2 and GND
Button button2(3); // Connect your button between pin 3 and GND
Button button3(4); // Connect your button between pin 4 and GND