File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1818servo_one = True
1919# servo_two = True
2020
21+ # angles for servo
22+ ANGLE_MIN = 0
23+ ANGLE_MAX = 180
24+
2125try :
2226 from secrets import secrets
2327except ImportError :
5155 out_feed = io .get_feed ("touch-1" )
5256 in_feed = io .get_feed ("touch-2" )
5357 except AdafruitIO_RequestError :
54- # if no feed exists, create one
58+ # if no feed exists, create one and push the first value
5559 out_feed = io .create_new_feed ("touch-1" )
5660 in_feed = io .create_new_feed ("touch-2" )
61+ io .send_data (in_feed ["key" ], float (abs ((ANGLE_MAX - ANGLE_MIN )/ 2 )))
5762# setup for display 2
5863if servo_two :
5964 CALIB_MIN = 15668
6368 out_feed = io .get_feed ("touch-2" )
6469 in_feed = io .get_feed ("touch-1" )
6570 except AdafruitIO_RequestError :
66- # if no feed exists, create one
71+ # if no feed exists, create one and push the first value
6772 out_feed = io .create_new_feed ("touch-2" )
6873 in_feed = io .create_new_feed ("touch-1" )
74+ io .send_data (in_feed ["key" ], float (abs ((ANGLE_MAX - ANGLE_MIN )/ 2 )))
6975
7076received_data = io .receive_data (in_feed ["key" ])
7177
7480FEEDBACK_PIN = board .A2
7581touch = touchio .TouchIn (board .TX )
7682
77- # angles for servo
78- ANGLE_MIN = 0
79- ANGLE_MAX = 180
80-
8183# servo setup
8284pwm = pwmio .PWMOut (SERVO_PIN , duty_cycle = 2 ** 15 , frequency = 50 )
8385servo = servo .Servo (pwm )
You can’t perform that action at this time.
0 commit comments