From dea0cb2dbda28d34c10d490c5a0fce01e79ee108 Mon Sep 17 00:00:00 2001 From: Tristan Hearn Date: Sat, 11 May 2013 21:57:59 -0400 Subject: [PATCH] fixed test --- examples.py | 14 ++------------ tests/test_main.py | 19 +------------------ 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/examples.py b/examples.py index efe1f67..653393a 100644 --- a/examples.py +++ b/examples.py @@ -7,6 +7,7 @@ def Blink(led_pin,baud, port = ""): Blinks an LED in 1 sec intervals """ board = Arduino(baud, port=port) + board.pinMode(13, "INPUT") while True: board.digitalWrite(led_pin,"LOW") print board.digitalRead(led_pin) #confirm LOW (0) @@ -67,16 +68,5 @@ def LCD(tx,baud,ssbaud,message, port=""): while True: board.SoftwareSerial.write(" test ") - - - if __name__=="__main__": - a = Arduino('9600', port="/dev/tty.usbserial-A700e08i") - print a.Servos.attach(2),"attach" - import time - i = 0 - while True: - a.Servos.write(2,10*i) - time.sleep(.1) - print a.Servos.read(2),10*i - i+=1 \ No newline at end of file + Blink(13, '9600', port="/dev/tty.usbserial-A700e08i") \ No newline at end of file diff --git a/tests/test_main.py b/tests/test_main.py index b5c96ea..cc481a4 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -13,7 +13,7 @@ should at least be maintained here. class TestBasics(unittest.TestCase): - _ = raw_input('Plug in Arduino board w/LED at pin 13, then press enter') + _ = raw_input('Plug in Arduino board w/LED at pin 13, reset, then press enter') board = Arduino('9600') def test_find(self): @@ -22,22 +22,5 @@ class TestBasics(unittest.TestCase): """ self.assertIsNotNone(self.board.port) - def test_blink(self): - """ - Tests digital pin functionality - """ - led_pin = 13 - self.board.digitalWrite(led_pin, "LOW") - state = self.board.digitalRead(led_pin) - self.assertEqual(state, 0) - - time.sleep(1) - - self.board.digitalWrite(led_pin, "HIGH") - state = self.board.digitalRead(led_pin) - self.assertEqual(state, 1) - - self.board.digitalWrite(led_pin, "LOW") - if __name__ == '__main__': unittest.main()