Skip to content

Instantly share code, notes, and snippets.

View BobBurns's full-sized avatar

Bob Burns BobBurns

  • Santa Cruz, CA
View GitHub Profile
@BobBurns
BobBurns / reactionTimer.asm
Created November 29, 2014 03:58
reaction timer program from AVR Programming
;
;reaction timer program from AVR programming
;button on PD2 // leds on PORTB
;
.equ UBBRvalue = 12
.equ UCSR0C = 0xc2 ;SRAM address of UCSR0C
.def temp = r16
.def count = r17
.def temp2 = r18
.def xL = r26 ;x reg used as global counter
@BobBurns
BobBurns / SPI-hello_eeprom.asm
Created December 10, 2014 23:48
demo assembly program using 25LC256 EEPROM with SPI
;demo program to learn how the avr can talk to another device with SPI
;in this case the 25LC256 eeprom
;
;based on the example code in c from Elliot Williams AVR Programming
;this example writes a string to the eeprom and then read it into sram to be sent over USART
;
;compile with gavrasm SPI-hello_eeprom.asm
;flash with avrdude -c avrisp -p m168 -P /dev/tty.useyourmodem -b 19200 -U flash:w:SPI-hello_eeprom.hex
;
;there are a couple extra convenience routines to use later
@BobBurns
BobBurns / Leaky_Broadcast.asm
Last active August 29, 2015 14:12
Bluetooth LE Broadcast ACI for Leaky Faucet Project
;new program to set up and test the nRF8001 blufruit module
;compile with gavrasm leaky_broadcast.asm
;flash with avrdude -c avrisp -p m168 -P /dev/tty.usbmodem1411 -b 19200 -U flash:w:leaky_broadcast.hex
;
; I/O pins:
; ** use PORTB except RDYN on PORTD **
; ** SCK on pin 5 configured as output **
; ** MISO on pin 4 configured as input with pullup **
; ** MOSI on pin 3 configured as output **
; ** REQN on pin 2 configured as output **
@BobBurns
BobBurns / appDelegate.m
Created December 23, 2014 20:52
Mac OSX discover leaky_broadcast
//
// AppDelegate.m
// leakyFaucetDesktop
//
// Created by WozniBob on 12/22/14.
// Copyright (c) 2014 Bob_Burns. All rights reserved.
//
#import "AppDelegate.h"
@BobBurns
BobBurns / newLeak.asm
Last active August 29, 2015 14:12
Water flow sensor code for Leaky Faucet project
;new routines for leaky_faucet
;uses adafruit liquid flow meter 828
;
;flash with avrdude -c avrisp -p m168 -P /dev/tty.usbmodem1411 -b 19200 -U flash:w:newLeak.hex
;
;*** use int1 for senor interrup PD3 ****
; make sure to check registers before importing into ble program
.equ UBBRvalue = 12
.def temp = r16
.def count = r17
@BobBurns
BobBurns / piezoLeak.asm
Created December 31, 2014 18:44
Piezo vibration detector to test with Leaky Faucet
;sound sensor program using piezo to detect a dripping faucet
;adapted from the footstep detector from AVR-Programming by Elliot Williams
;
;flash with avrdude -c avrisp -p m168 -P /dev/tty.usbmodem1411 -b 19200 -U flash:w:piezoLeak.hex
;
;use adc2 on PC2 for piezo input
; make sure to check registers before importing into ble program
.equ UBBRvalue = 12
.def temp = r16
.def count = r17
@BobBurns
BobBurns / wsds.php
Last active August 29, 2015 14:17
php websocket device server
#!/usr/bin/php
<?php
/* websocket/device server program for raspberry pi
* this program only deals with packets that are 125 bytes max
* currently only one client can connect at a time. Maybe not a bad thing.
* run as super user (for gpio access)
* check out https://gist.github.com/BobBurns/6f83930912da4094f014 for the client html code
* much of the juicy bits adapted from ghedipunk/PHP-Websockets
*
@BobBurns
BobBurns / client.html
Last active August 29, 2015 14:17
php websocket device client
<!DOCTYPE html>
<!-- put this in your /var/www/ folder -->
<!-- see wsds.php for server/client commands -->
<html>
<head>
<title>Web Socket Device</title>
</head>
<body onunload="sendClose()"> <!-- doesn't work with Safari -->
<h1>Web Socket Device Fun<br></h1>
<h2><p id="temp"></p></h2>
@BobBurns
BobBurns / better_backup
Created April 5, 2015 01:29
bash script to backup directory to usb drive
#
# important! cannot use this program to backup itself ->$HOME/bin
# script to backup directory to usb drive mounted to bobsUSB
#
# first make sure file is used as argument
if [ ! -d "$1" ]
then
echo "usage: better_backup mydir"
exit 1
@BobBurns
BobBurns / darby.m
Created July 19, 2015 03:24
mac app to receive nfc data
//
// AppDelegate.m
// nfc_socket_client
//
// Created by WozniBob on 6/19/15.
// Copyright (c) 2015 Bob_Burns. All rights reserved.
//
#import "AppDelegate.h"
#import "Student.h"