Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added update() and logging for the strip #1

Open
wants to merge 6 commits into from

1 participant

This page is out of date. Refresh to see the latest.
Showing with 37 additions and 5 deletions.
  1. +17 −1 README.md
  2. +18 −4 mimic.py
  3. +2 −0  run_mimic.sh
View
18 README.md
@@ -35,4 +35,20 @@ This should launch an app that lets you display your webcam with a number of dif
SPI
-----
-This blog post has some information about enabling SPI on RPI - http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
+This blog post has some information about enabling SPI on RPI - http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
+
+USAGE
+-----
+Hook up the raspberry pi to the LED strip as seen in http://learn.adafruit.com/light-painting-with-raspberry-pi/hardware
+Connect the webcam. Run
+
+ sudo python mimic.py
+
+If you want to log the colors over time
+
+ sudo python mimic.py -d True
+
+The colors will be printed out with the timestamp and RGB values, all tab separated.
+
+To record the logs, you can use the bash script, 'run_mimic.sh'. Create a directory called 'data' first.
+Since I'm running this on startup, make sure you edit the file paths.
View
22 mimic.py 100644 → 100755
@@ -1,15 +1,29 @@
+#!/usr/bin/python
+
from imgproc import *
import LPD8806
+import datetime
+from optparse import OptionParser
+
+parser= OptionParser()
+parser.add_option("-d", "--data",
+ help="write data to stdout",
+ default=False)
+
+(opts, args) = parser.parse_args()
+
print "Starting MIMIC..."
my_cam = Camera(320,240)
led = LPD8806.strand()
-while 0 < 1:
+while True:
my_img = my_cam.grabImage()
red, green, blue = my_img[160, 120]
- my_img[160, 120] = 0, 0, 0
led.fill(red, green, blue)
-
-
+ led.update()
+ if (opts.data):
+ print "\t".join(map(str,
+ [datetime.datetime.now(),
+ red,green,blue]))
View
2  run_mimic.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+sudo /home/pi/projects/mimic/mimic.py -d True > /home/pi/projects/mimic/data/`date +"%y-%m-%d_%H:%M:%S"`.tsv
Something went wrong with that request. Please try again.