Skip to content

Instantly share code, notes, and snippets.

@davedarko
davedarko / RobotExample.ino
Created January 14, 2024 10:40
fixed? code example for pusher client library
#include <Servo.h>
#include <SPI.h>
#include <Ethernet.h>
#include <PusherClient.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//PusherClient client;
Servo leftServo;
Servo rightServo;
@davedarko
davedarko / pomodoro_5x5.ino
Last active October 15, 2023 11:12
Pomodoro timer script, that randomly turns an LED off after a minute - until none are left. It starts in green and turns red over time. This is written for a tiny ESP32-C3 board that features a 5x5 RGB LED matrix. Now cooldown time integrated.
/* https://www.banggood.com/ESP32-C3-Development-Board-RISC-V-WiFi-Bluetooth-IoT-Development-Board-Compatible-with-Python-p-1914005.html?cur_warehouse=CN
*
* GPIO09 button
* GPIO08 neopixels
* GPIO10 status led
*
*/
#include <Adafruit_GFX.h>
#include <Adafruit_NeoPixel.h>
@davedarko
davedarko / blinkLCD.ino
Created October 5, 2022 20:41
blink example for oddly specific objects LCD featherwing
#include <Wire.h>
#include "OSO_LCD.h"
OSO_LCDWing display;
void setup() {
// put your setup code here, to run once:
if (!display.begin(0x3E, &Wire1)) {
while (1) Serial.println("ERR");
@davedarko
davedarko / countdown-generator.sh
Created February 17, 2020 10:48
Countdown Video Generator for Mate Light
#!/bin/sh
#This example will create a 15min video, with 10 frames per second
fps=10;
seconds=900;
mantissaDigits=2;
upperFont=14;
#upperFont=53;
lowerFont=100;
ffmpeg -loop 1 -i ~/Pictures/black-background.png -c:v libx264 -r $fps -t $seconds -pix_fmt rgb24 -vf "fps=$fps,drawtext=fontfile='/usr/share/fonts/truetype/freefont/FreeMono.ttf':fontcolor=white:fontsize=$upperFont:x=(w-text_w)/2:y=(h-text_h)/2:text='%{eif\:(($seconds-t)/60)\:d}\:%{eif\:(mod($seconds-t, 60))\:\d\:2 }'" "$seconds seconds countdown timer.mp4";
var mqtt = require('mqtt');
var HOST = '192.168.43.10';
var client = mqtt.connect("mqtt:\/\/" + HOST, { port: 1883 });
client.on('connect', function () {
console.log("Connected to " + HOST);
client.subscribe('hermes/intent/#');
});
#include <Wire.h>
#include "SH1106Wire.h"
#include <Adafruit_NeoPixel.h>
#define PIN 0
Adafruit_NeoPixel strip = Adafruit_NeoPixel(2, PIN, NEO_GRB + NEO_KHZ800);
int brightness = 4;
/*
default arduino esp8266 pinout for I2C
/*
Program Description: This program reads a light detecting resistor thru an internal ADC and stores the value,
after scaling it, to eeprom. This ADC value is sent to a PWM channel with attached led. This is essentially a data logger
for light and replay by LED. If, if you aim the LDR at a flickering candle during its recording phase, you have a flickering
led candle.
A circuit description and other details can be found at http://petemills.blogspot.com
Filename: ATTiny_Candle_v1.0.c
Author: Pete Mills
@davedarko
davedarko / tiny_LS_cp_short_buffer_2.ino
Created December 6, 2018 22:59
tiny_LS_cp_short_buffer_2
/*
Based on https://github.com/maltesemanTS1/Charlieplexing-the-Arduino
http://arduino.cc/en/Tutorial/BitMask
*/
int16_t shifter = 0;
uint8_t shifter_factor = 4; // also speed influence
bool toggle = true;
const uint8_t max_leds = 20;
/*
Based on https://github.com/maltesemanTS1/Charlieplexing-the-Arduino
http://arduino.cc/en/Tutorial/BitMask
*/
int16_t shifter = 0;
uint8_t shifter_factor = 8; // also speed influence
bool toggle = true;
const uint8_t max_leds = 20;
/*
Based on https://github.com/maltesemanTS1/Charlieplexing-the-Arduino
http://arduino.cc/en/Tutorial/BitMask
*/
int16_t shifter = 0;
uint8_t shifter_factor = 8; // also speed influence
bool toggle = true;
const uint8_t max_leds = 20;