Skip to content

Instantly share code, notes, and snippets.

/*
Shift Register Example
for 74HC595 shift register
*/
//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 13;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
@theapi
theapi / avr_timer0.txt
Last active August 29, 2015 13:55
Notes from Bruce Land video - microcontrollers #2
// see http://people.ece.cornell.edu/land/courses/ece4760/labs/s2012/Sched1GCC644.c
// see http://people.ece.cornell.edu/land/courses/ece4760/Timers/index.html
//**********************************************************
//timer 0 compare ISR
ISR (TIMER0_COMPA_vect)
{
// Called every millis
// 75 cycles in
@theapi
theapi / blink_fade.ino
Created June 12, 2014 08:56
Blink Fade without delay
@theapi
theapi / .avrduderc
Created August 4, 2014 22:19
Setting for Arduino IDE to slow down the USBASP programmer for the ATTINY85 at 1mhz
default_bitclock = 10;
@theapi
theapi / reset.php
Created September 23, 2014 18:13
Reset button for MythTv
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Reset XBMC</title>
<link rel="shortcut icon" href="/reset_xbmc.ico">
<style>
input#reset{
width:200px; /*same as the height*/
@theapi
theapi / boards.txt
Last active August 29, 2015 14:17
ATmega328 on a breadboard (8 MHz internal clock)
atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)
atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600
atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.path=arduino:atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
@theapi
theapi / gist:5447951
Created April 23, 2013 22:27
Convert raw .264 video file from cctv dvr
mkvmerge -o output.mkv --forced-track 0:no -d 0 -A -S -T --no-global-tags --no-chapters input.264 --track-order 0:0
@theapi
theapi / mux_cctv_video.sh
Created April 26, 2013 22:25
Watch the samba share for new videos with the .264 extension then mux them into a .mkv file playable by video players.
#!/bin/sh
# apt-get install inotify-tools
# apt-get install mkvtoolnix
WATCHED_DIR="/mnt/sda1/cctv/videos"
echo "Watching directory: $WATCHED_DIR for new files"
inotifywait -m -q -e create -r "$WATCHED_DIR" --format "%w%f" |
while read file
<?php
/**
* @file
* drush command.
*/
/**
* Implementation of hook_drush_command().
*
@theapi
theapi / stepper.py
Last active December 22, 2015 09:59
Very basic script that rotates a stepper motor with a Raspberry Pi.
#!/usr/bin/env python
# Thanks to http://www.youtube.com/watch?v=Dc16mKFA7Fo
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
ControlPin = [18,22,24,26]