Skip to content

Commit bbe4d38

Browse files
committed
Falta agregar métodos para mostrar otras funcionalidades del firmware (funciones de reporte, un método para reset, etc.)
1 parent 79aaeb8 commit bbe4d38

File tree

2 files changed

+53
-15
lines changed

2 files changed

+53
-15
lines changed

tests/pocs/performance_test.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#from MLC.arduino.connection import MockConnection
2+
from MLC.arduino.connection import SerialConnection
3+
from MLC.arduino.protocol import ArduinoInterface
4+
from MLC.arduino import boards
5+
import sys
6+
import time
7+
8+
def actuate(terminal):
9+
connection = SerialConnection(port=terminal)
10+
arduinoDue = ArduinoInterface(connection, boards.Due)
11+
12+
arduinoDue.add_output(40)
13+
arduinoDue.add_output(66)
14+
arduinoDue.add_input(65)
15+
arduinoDue.add_input(64)
16+
arduinoDue.add_input(63)
17+
arduinoDue.add_input(62)
18+
arduinoDue.add_input(61)
19+
arduinoDue.add_input(60)
20+
arduinoDue.add_input(59)
21+
arduinoDue.add_input(58)
22+
arduinoDue.add_input(57)
23+
arduinoDue.add_input(56)
24+
arduinoDue.add_input(55)
25+
arduinoDue.add_input(54)
26+
27+
last_time = time.time()
28+
start_time = last_time
29+
read_c = 0
30+
31+
for i in range(0, 10000):
32+
output = arduinoDue.actuate([(40,1),(66,255)])
33+
#print output
34+
read_c = read_c + 1
35+
new_time = time.time()
36+
37+
if (new_time - start_time) > 1:
38+
print str(read_c-1) # The current read was out of the period
39+
read_c = 1
40+
start_time = new_time
41+
42+
last_time = new_time
43+
44+
45+
if __name__ == "__main__":
46+
if (len(sys.argv) < 2):
47+
print "Usage: test_connection.py /dev/ttyACMX (X == number)"
48+
exit(-1)
49+
actuate(sys.argv[1:][0])
50+

tests/pocs/test_connection.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,9 @@ def actuate(terminal):
1212
arduinoDue.add_output(40)
1313
arduinoDue.add_input(64)
1414

15-
last_time = time.time()
16-
start_time = last_time
17-
read_c = 0
18-
19-
for i in range(0, 100000):
20-
arduinoDue.actuate([(40,1)])
21-
read_c = read_c + 1
22-
new_time = time.time()
23-
24-
if (new_time - start_time) > 1:
25-
print str(read_c-1) # The current read was out of the period
26-
read_c = 1
27-
start_time = new_time
28-
29-
last_time = new_time
15+
output = arduinoDue.actuate([(40,1)])
16+
for i in output:
17+
print "Pin %d output: %s" % (ord(i[0]), i[1])
3018

3119

3220
if __name__ == "__main__":

0 commit comments

Comments
 (0)