Skip to content

Commit

Permalink
full dump of code
Browse files Browse the repository at this point in the history
This is a dump of all of the code used in the project.
  • Loading branch information
Joseph Pugh committed Feb 13, 2013
1 parent 63809eb commit 4af262a
Show file tree
Hide file tree
Showing 20 changed files with 36,459 additions and 0 deletions.
50 changes: 50 additions & 0 deletions arduino/scanner.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const int scanner = 7;
const int turntable = 5;
int timer = 0;
int degree = 0;

void setup() {
pinMode(scanner, OUTPUT);
pinMode(turntable, OUTPUT);
digitalWrite(scanner, LOW);
digitalWrite(turntable, LOW);
Serial.begin(9600);
Serial.println("Hello world!");
}

void loop() {
if (Serial.available()) {
char ch = Serial.read();
if ( ch == 'f') {
digitalWrite(scanner, HIGH);
Serial.println("FIRIN' MAH LAZER!");
delay(2000);

digitalWrite(scanner, LOW);
Serial.println("turning off...");
}
if ( ch == 'n') {
digitalWrite(turntable, HIGH);
Serial.print("spin 3 degrees... ");
delay(360);
digitalWrite(turntable, LOW);
Serial.println("done");
degree += 3;
Serial.print("total degrees: ");
Serial.println(degree);
}
if ( ch == 'r') {
Serial.println("resetting degrees...");
degree = 0;
}
if ( ch == 'z') {
digitalWrite(turntable, HIGH);
timer = millis();
}
if ( ch == 'y') {
digitalWrite(turntable, LOW);
Serial.println(millis()-timer);
timer = 0;
}
}
}
14 changes: 14 additions & 0 deletions bin/scan_daemon
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
while [ 1 ]
do
if [ -e /tmp/scan_nolaser ]
then
scan_nolaser
rm /tmp/scan_nolaser
fi
if [ -e /tmp/scan_laser ]
then
scan_laser
rm /tmp/scan_laser
fi
sleep 3
done
21 changes: 21 additions & 0 deletions bin/scan_laser
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
touch /tmp/scan
DATE=`date +%Y-%m-%d-%H-%M`
mkdir /var/www/scans/$DATE
send r
for i in {1..120}
do
NUMBER=`printf %03d $i`
send n
sleep 1
send f
takepic /var/www/scans/$DATE/$NUMBER.jpg
rm /var/www/pic.jpg
ln -s /var/www/scans/$DATE/$NUMBER.jpg /var/www/pic.jpg
sleep 2
done
rm /var/www/pic.jpg
cp /var/www/scans/$DATE/$NUMBER.jpg /var/www/pic.jpg
chown www-data /var/www/pic.jpg
convert -delay 5 -loop 0 `find /var/www/scans/$DATE/ | grep jpg | sort` /var/www/scans/$DATE/$DATE.gif
rm /tmp/scan
19 changes: 19 additions & 0 deletions bin/scan_nolaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
touch /tmp/scan
DATE=`date +%Y-%m-%d-%H-%M`
mkdir /var/www/scans/$DATE
send r
for i in {1..120}
do
NUMBER=`printf %03d $i`
send n
sleep 1
takepic /var/www/scans/$DATE/$NUMBER.jpg
rm /var/www/pic.jpg
ln -s /var/www/scans/$DATE/$NUMBER.jpg /var/www/pic.jpg
done
rm /var/www/pic.jpg
cp /var/www/scans/$DATE/$NUMBER.jpg /var/www/pic.jpg
chown www-data /var/www/pic.jpg
convert -delay 5 -loop 0 `find /var/www/scans/$DATE/ | grep jpg | sort` /var/www/scans/$DATE/$DATE.gif
rm /tmp/scan
2 changes: 2 additions & 0 deletions bin/send
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DEVICE=`ls /dev/tty* | grep 'USB\|ACM' | head -n 1`
echo $@ > $DEVICE
1 change: 1 addition & 0 deletions bin/start_scan
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nohup scan_nolaser &
1 change: 1 addition & 0 deletions bin/start_scan_laser
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nohup scan_laser &
8 changes: 8 additions & 0 deletions bin/takepic
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
if [ "X$1" == "X" ]
then
PICTURE="/var/www/pic.jpg"
else
PICTURE=$1
fi
fswebcam -F 3 --no-banner -S 5 $PICTURE
Binary file added examples/2012-06-03-07-38.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/2012-08-08-06-09.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4af262a

Please sign in to comment.