commit c5ac7e4c6fadf3d94cf7f6d2c08446a6de0ec368
Author: dsorber <david.sorber@gmail.com>
Date:   Sat Mar 30 16:04:12 2013 -0400

    Added a couple more scripts including one to talk to the 7 segment display.

diff --git a/525.743/code/test scripts/7seg.py b/525.743/code/test scripts/7seg.py
new file mode 100644
index 0000000..ebc056c
--- /dev/null
+++ b/525.743/code/test scripts/7seg.py	
@@ -0,0 +1,141 @@
+import sys
+import time
+
+import smbus
+
+SEGMENTS_OFF = 0x00
+SEGMENT_G    = 0x01
+SEGMENT_F    = 0x02
+SEGMENT_E    = 0x04
+SEGMENT_D    = 0x08
+SEGMENT_C    = 0x10
+SEGMENT_B    = 0x20
+SEGMENT_A    = 0x40
+SEGMENT_DOT  = 0x80
+
+DIGIT_0 = SEGMENT_A | SEGMENT_B | SEGMENT_C | SEGMENT_D | SEGMENT_E | SEGMENT_F
+DIGIT_1 = SEGMENT_B | SEGMENT_C
+DIGIT_2 = SEGMENT_A | SEGMENT_B | SEGMENT_G | SEGMENT_E | SEGMENT_D
+DIGIT_3 = SEGMENT_A | SEGMENT_B | SEGMENT_G | SEGMENT_C | SEGMENT_D
+DIGIT_4 = SEGMENT_F | SEGMENT_G | SEGMENT_B | SEGMENT_C
+DIGIT_5 = SEGMENT_A | SEGMENT_F | SEGMENT_G | SEGMENT_C | SEGMENT_D
+DIGIT_6 = SEGMENT_A | SEGMENT_F | SEGMENT_G | SEGMENT_E | SEGMENT_D | SEGMENT_C
+DIGIT_7 = SEGMENT_A | SEGMENT_B | SEGMENT_C
+DIGIT_8 = SEGMENT_A | SEGMENT_B | SEGMENT_C | SEGMENT_D | SEGMENT_E | SEGMENT_F | SEGMENT_G
+DIGIT_9 = SEGMENT_A | SEGMENT_B | SEGMENT_C | SEGMENT_D | SEGMENT_F | SEGMENT_G
+
+class SevenSegmentDisplay(object):
+
+    digit_map = {'0': DIGIT_0,
+                 '1': DIGIT_1,
+                 '2': DIGIT_2,
+                 '3': DIGIT_3,
+                 '4': DIGIT_4,
+                 '5': DIGIT_5,
+                 '6': DIGIT_6,
+                 '7': DIGIT_7,
+                 '8': DIGIT_8,
+                 '9': DIGIT_9}
+
+    def __init__(self):
+        self.bus = smbus.SMBus(1)
+        self.address = 0x38
+        # 2 digits at 9ma sink
+        self.bus.write_byte_data(self.address, 0x00, 0x35)
+
+    def segment_test(self):
+        print 'Testing segments...'
+        self.bus.write_byte_data(self.address, 0x00, 0x3E)
+        time.sleep(3)
+        self.bus.write_byte_data(self.address, 0x00, 0x35)
+        print 'Test complete'
+
+    def read_status(self):
+        return bus.read_byte(address)
+
+    def write_digit0(self, pattern):
+        self.bus.write_byte_data(self.address, 0x03, pattern)
+
+    def write_digit1(self, pattern):
+        self.bus.write_byte_data(self.address, 0x01, pattern)
+
+    def clear(self):
+        self.write_digit0(SEGMENTS_OFF)
+        self.write_digit1(SEGMENTS_OFF)
+
+    def display_number(self, number):
+        str_num = '%02d' % number
+        self.write_digit1(self.digit_map[str_num[1]])
+        self.write_digit0(self.digit_map[str_num[0]])
+
+
+
+def main():
+    
+    display = SevenSegmentDisplay()
+
+    # segment test
+    display.segment_test()
+
+    # blink segment G x20
+    for ctr in xrange(20):
+        display.clear()
+        time.sleep(0.1)
+        SEGMENT_G
+        display.write_digit1(SEGMENT_G)
+        display.write_digit0(SEGMENT_G)
+        time.sleep(0.1) 
+
+    # outer snake clockwise, both
+    segs = [SEGMENT_F, SEGMENT_A, SEGMENT_B, SEGMENT_C, 
+            SEGMENT_D, SEGMENT_E]
+
+    for xtr in xrange(2):
+        for segment in segs:
+            display.clear()
+            display.write_digit1(segment)
+            display.write_digit0(segment)
+            time.sleep(0.2)
+
+    # outer snake counter clockwise, both
+    segs = [SEGMENT_E, SEGMENT_D, SEGMENT_C, SEGMENT_B, 
+            SEGMENT_A, SEGMENT_F]
+
+    for xtr in xrange(2):
+        for segment in segs:
+            display.clear()
+            display.write_digit1(segment)
+            display.write_digit0(segment)
+            time.sleep(0.2)
+
+    # figure 8 both (clockwise start)
+    segs = [SEGMENT_G, SEGMENT_F, SEGMENT_A, SEGMENT_B, SEGMENT_G, 
+            SEGMENT_E, SEGMENT_D, SEGMENT_C]
+
+    for xtr in xrange(3):
+        for segment in segs:
+            display.clear()
+            display.write_digit1(segment)
+            display.write_digit0(segment)
+            time.sleep(0.1)
+
+    # figure 8 both (counter clockwise start)
+    segs = [SEGMENT_G, SEGMENT_E, SEGMENT_D, SEGMENT_C, SEGMENT_G, 
+            SEGMENT_F, SEGMENT_A, SEGMENT_B]
+
+    for xtr in xrange(3):
+        for segment in segs:
+            display.clear()
+            display.write_digit1(segment)
+            display.write_digit0(segment)
+            time.sleep(0.1)
+
+    # count down
+    while True:
+        for num in xrange(99, -1, -1):
+            display.clear()
+            display.display_number(num)
+            time.sleep(0.3)
+
+if __name__ == '__main__':
+    sys.exit(main())
\ No newline at end of file
diff --git a/525.743/code/test scripts/LED_cycle.py b/525.743/code/test scripts/LED_cycle.py
new file mode 100644
index 0000000..49c36ee
--- /dev/null
+++ b/525.743/code/test scripts/LED_cycle.py	
@@ -0,0 +1,48 @@
+import itertools
+import sys
+
+import RPIO
+
+from blinky_pattern import cylon, randomize, turn_on_top_down, turn_off_top_down,\
+						   turn_on_bottom_up, turn_off_bottom_up
+
+outputs = [23, 24, 25, 8, 7]
+
+def main():
+	# Use the BCM addressing scheme
+	RPIO.setmode(RPIO.BCM)
+
+	# Setup input
+	RPIO.setup(22, RPIO.IN)
+
+	# Setup all five outputs
+	for gpio in outputs:
+		RPIO.setup(gpio, RPIO.OUT)
+		RPIO.output(gpio, False)
+
+	# Setup switch interrupt with debounce
+	RPIO.add_interrupt_callback(22, switch_callback, edge='rising', 
+								pull_up_down=RPIO.PUD_DOWN, threaded_callback=True, 
+								debounce_timeout_ms=150)
+
+	print 'Okay, waiting for interrupts...'
+
+	# Main (blocking) loop
+	while True:
+		RPIO.wait_for_interrupts()
+
+def switch_callback(gpio_id, val):
+	global CURRENT
+	print 'Switch activated!  %s --- %s' % (gpio_id, val)
+
+	# Turn off current LED
+	RPIO.output(CURRENT, False)
+
+	# Get next output and turn it on
+	CURRENT = out_iterator.next()
+	print CURRENT
+	RPIO.output(CURRENT, True)
+
+
+if __name__ == '__main__':
+	sys.exit(main())
\ No newline at end of file
diff --git a/525.743/code/test scripts/button_LED.py b/525.743/code/test scripts/button_LED.py
index 1ea6e61..fbf9994 100644
--- a/525.743/code/test scripts/button_LED.py	
+++ b/525.743/code/test scripts/button_LED.py	
@@ -3,9 +3,9 @@ import sys
 
 import RPIO
 
-CURRENT = 23
 outputs = [23, 24, 25, 8, 7]
 out_iterator = itertools.cycle(outputs)
+CURRENT = outputs[0]
 
 def main():
 	# Use the BCM addressing scheme
@@ -22,24 +22,24 @@ def main():
 	# Setup switch interrupt with debounce
 	RPIO.add_interrupt_callback(22, switch_callback, edge='rising', 
 								pull_up_down=RPIO.PUD_DOWN, threaded_callback=True, 
-								debounce_timeout_ms=100)
+								debounce_timeout_ms=150)
 
-	print 'Okay, waiting for interrupts... %d' % CURRENT
+	print 'Okay, waiting for interrupts...'
 
 	# Main (blocking) loop
 	while True:
 		RPIO.wait_for_interrupts()
 
 def switch_callback(gpio_id, val):
+	global CURRENT
 	print 'Switch activated!  %s --- %s' % (gpio_id, val)
 
-	print outputs
-
 	# Turn off current LED
 	RPIO.output(CURRENT, False)
 
 	# Get next output and turn it on
 	CURRENT = out_iterator.next()
+	print CURRENT
 	RPIO.output(CURRENT, True)
 
 
diff --git a/525.743/code/test scripts/saa1064_i2c_test.py b/525.743/code/test scripts/saa1064_i2c_test.py
new file mode 100644
index 0000000..a4ebf4e
--- /dev/null
+++ b/525.743/code/test scripts/saa1064_i2c_test.py	
@@ -0,0 +1,29 @@
+import sys
+import time
+
+import smbus
+
+bus = smbus.SMBus(1)
+address = 0x38
+
+def main():
+    status = bus.read_byte(address)
+    print 'POR Status: %d' % status
+    bus.write_byte_data(address, 0x00, 0x35)
+
+    for shift in xrange(0, 8):
+        val = (1 << shift)
+        print val
+        bus.write_byte_data(address, 0x01, val)
+        time.sleep(0.1)
+
+    for shift in xrange(0, 8):
+        val = (1 << shift)
+        print val
+        bus.write_byte_data(address, 0x03, val)
+        time.sleep(0.1)
+
+
+
+if __name__ == '__main__':
+    sys.exit(main())
\ No newline at end of file
