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 / read_dec.asm
Created July 19, 2015 12:08
avr code to control pn532 to read and decrement MiFare card value
;this program attempts to read a MiFare card initialized with a name at address 0x04
; and a value block at 0x05
;
;compile with gavrasm read_dec.asm ;flash with avrdude -c avrisp -p m168 -P /dev/tty.usbmodem1411 -b 19200 -U flash:w:read_dec.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 **
@BobBurns
BobBurns / write_pn532.asm
Created July 19, 2015 12:04
avr code to control pn532 and write to MiFare classic.
;new program to set up and test the PN532 chip reader
;compile with gavrasm write_pn532.asm ;flash with avrdude -c avrisp -p m168 -P /dev/tty.usbmodem1411 -b 19200 -U flash:w:write_pn532.asm
;
; 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 **
; ** NSS on pin 2 configured as output **
; ** NSS on pin 2 not selected (high)
@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"
@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 / 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 / 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 / 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 / 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 / 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 / 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 **