Skip to content

Instantly share code, notes, and snippets.

@greed9
greed9 / sketch_simple_recv.ino
Created June 16, 2025 15:15
Receive command chars sent via IR Remote Protocol
// Headers for sd1306 display
/* Based on code Written by Limor Fried/Ladyada for Adafruit Industries,
with contributions from the open source community.
BSD license, check license.txt for more information
All text above, and the splash screen below must be
included in any redistribution.
**************************************************************************/
#include <SPI.h>
#include <Wire.h>
@greed9
greed9 / sketch_hbridge_starter.ino
Created June 23, 2025 19:00
Incomplete sketch to control DC motor speed via H-Bridge and potentiometer
// hacked from: https://lastminuteengineers.com/drv8833-arduino-tutorial/
// Define the control inputs
#define MOT_A1_PIN 6
#define MOT_A2_PIN 5
void setup(void)
{
// Set all the motor control inputs to OUTPUT
pinMode(MOT_A1_PIN, OUTPUT);
@greed9
greed9 / sketch_touch_switch.ino
Last active July 1, 2025 14:04
Arduino touch switch using the Touchy library
// Arduino "No hardware" touch switch
// Based on https://github.com/todbot/TouchyTouch
#include "TouchyTouch.h"
#define STATUS_LED 4
#define SENSE_PIN 12
const int touch_pin = SENSE_PIN;
// Install as TouchyTouch library in Arduino.
TouchyTouch touches ;
@greed9
greed9 / sketch_button_press_proto.ino
Last active July 7, 2025 18:50
Incomplete starter sketch for interrupt/debounce demo
// *****************************************
// Fill in the missing parts of this sketch
// Does not currently compile
// *****************************************
#define BUTTON_PIN /* ? */
#define LED_PIN /* ?*/
// This must be declared volatile since it is accessed from
// the ISR and from loop()
//https://en.wikipedia.org/wiki/Volatile_(computer_programming)
@greed9
greed9 / sketch_reaction_time.ino
Last active July 8, 2025 20:27
Simple reaction timer app using switch and interrupts
// *****************************************
// Reaction timer using interrupt
// *****************************************
#define BUTTON_PIN 2
#define LED_PIN 8
// This must be declared volatile since it is accessed from
// the ISR and from loop()
//https://en.wikipedia.org/wiki/Volatile_(computer_programming)
static volatile int isr_counter = 0 ;