-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
30 lines (23 loc) · 951 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from BrooklynAPI.Brooklyn import Brooklyn, CardType
from BrooklynAPI.Empire import ServoType, MotorType #Import servotype class to make all types accesible from the main class
from time import sleep, monotonic
brook = Brooklyn() #No longer need to pass in COM port Brooklyn will be automaticially found
brook.set_name("KatiesBrook") #You can now set a custom name to your brooklyn to distinguish it from others
print(brook.get_name()) #You an also query the name
card1 = brook.card(1) #No longer need to specify a card type it will be queried automaticially
#motor = card1.motor(0, MotorType.rpm84)
servo1 = card1.servo(1, ServoType.DF9GMS)
#motor.zero_encoder()
#motor.home(1,50)
while True:
start = monotonic()
#motor.read_speed()
#motor.set_power(0,0)
#resp = brook.write(2,4,[])
#print(resp)
servo1.set_angle(0)
sleep(2)
servo1.set_angle(180)
sleep(2)
end = monotonic()
#print(end-start)