fixed test

This commit is contained in:
Tristan Hearn
2013-05-11 21:57:59 -04:00
parent 12d7b13e2b
commit dea0cb2dbd
2 changed files with 3 additions and 30 deletions

View File

@@ -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
Blink(13, '9600', port="/dev/tty.usbserial-A700e08i")

View File

@@ -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()