Skip to content

Instantly share code, notes, and snippets.

@AnthonyDiGirolamo
AnthonyDiGirolamo / clock.ino
Created March 26, 2012 15:25
time.h testing
#include <Time.h>
#include <Wire.h>
#include <LibTemperature.h>
LibTemperature temp = LibTemperature(0);
//echo T$(($(date +%s)+60*60*-4)) > /dev/tty.usbserial-A4006DN3
#define TIME_MSG_LEN 11 // time sync to PC is HEADER followed by unix time_t as ten ascii digits
#define TIME_HEADER 'T' // Header tag for serial time sync message
@AnthonyDiGirolamo
AnthonyDiGirolamo / kitchen_timer.pde
Created December 5, 2011 19:19
arduino powered kitchen timer with extras
#include <avr/pgmspace.h>
#include <math.h>
#include <LiquidCrystal.h>
#define ENC_A 14
#define ENC_B 15
#define ENC_PORT PINC
#define LED1 3
#define LED2 5
@AnthonyDiGirolamo
AnthonyDiGirolamo / arduino_calc.pde
Created November 29, 2011 15:38
Arduino Algebraic Calculator using a PS2Keyboard and LiquidCrystal Libraries
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <PS2Keyboard.h>
#include <LiquidCrystal.h>
#define PS2DATA 2
#define PS2IRQ 3
@AnthonyDiGirolamo
AnthonyDiGirolamo / buzzer.pde
Created November 29, 2011 15:30
Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com
// Additions by Christopher Stevens
// http://www.christopherstevens.cc
//referenced from http://www.phy.mtu.edu/~suits/notefreqs.html
//starting with F noteFreqArr[1]
int noteFreqArr[] = {
@AnthonyDiGirolamo
AnthonyDiGirolamo / big_character.pde
Created November 8, 2011 05:00
controlling a large 16 segment display and a rotary encoder using only an atmel328p
#include <avr/pgmspace.h>
#define ENC_A 14
#define ENC_B 15
#define ENC_PORT PINC
const prog_uint8_t character_map[][2] = {
{ B00000000, B00000000 }, // space
{ B00000010, B00000100 }, // ! 32
{ B00101000, B00000000 }, // "
@AnthonyDiGirolamo
AnthonyDiGirolamo / fix_ftt.cpp
Created November 5, 2011 03:17
Arduino LCD VU Meter
#include <avr/pgmspace.h>
#include "fix_fft.h"
#include <WProgram.h>
/* fix_fft.c - Fixed-point in-place Fast Fourier Transform */
/*
All data are fixed-point short integers, in which -32768
to +32768 represent -1.0 to +1.0 respectively. Integer
arithmetic is used for speed, instead of the more natural
floating-point.
@AnthonyDiGirolamo
AnthonyDiGirolamo / calc.c
Created August 29, 2011 19:48
shunting yard algorithm in c
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define CHECKMALLOC(var) if((var) == NULL) {printf("ERROR: malloc\n");abort();}
#define MAXOPSTACK 64
#define MAXNUMSTACK 64
@AnthonyDiGirolamo
AnthonyDiGirolamo / spi_max6954_test.pde
Created August 28, 2011 01:40
Communicating with the MAX 6954 over an SPI bus using an ATMEGA328P.
#include <string.h>
#include <SPI.h>
#include <PS2Keyboard.h>
#include <avr/sleep.h>
#define PS2DATA 2
#define PS2IRQ 3
PS2Keyboard keyboard;
@AnthonyDiGirolamo
AnthonyDiGirolamo / xinitrc
Created August 1, 2011 18:14
MacOSX X11 xinitrc
export PATH=/opt/local/bin:$PATH
xset b off
xmodmap -e "keycode 119 = Insert"
dwmstatus &
dwm
@AnthonyDiGirolamo
AnthonyDiGirolamo / strftime%252520C
Created January 28, 2010 21:58
strftime legend
strftime Formatting Atoms
%a Abbreviated weekday name * Thu
%A Full weekday name * Thursday
%b Abbreviated month name * Aug
%B Full month name * August
%c Date and time representation * Thu Aug 23 14:55:02 2001
%d Day of the month (01-31) 23
%H Hour in 24h format (00-23) 14
%I Hour in 12h format (01-12) 02