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 18
18
servo_one = True
19
19
# servo_two = True
20
20
21
+ # angles for servo
22
+ ANGLE_MIN = 0
23
+ ANGLE_MAX = 180
24
+
21
25
try :
22
26
from secrets import secrets
23
27
except ImportError :
51
55
out_feed = io .get_feed ("touch-1" )
52
56
in_feed = io .get_feed ("touch-2" )
53
57
except AdafruitIO_RequestError :
54
- # if no feed exists, create one
58
+ # if no feed exists, create one and push the first value
55
59
out_feed = io .create_new_feed ("touch-1" )
56
60
in_feed = io .create_new_feed ("touch-2" )
61
+ io .send_data (in_feed ["key" ], float (abs ((ANGLE_MAX - ANGLE_MIN )/ 2 )))
57
62
# setup for display 2
58
63
if servo_two :
59
64
CALIB_MIN = 15668
63
68
out_feed = io .get_feed ("touch-2" )
64
69
in_feed = io .get_feed ("touch-1" )
65
70
except AdafruitIO_RequestError :
66
- # if no feed exists, create one
71
+ # if no feed exists, create one and push the first value
67
72
out_feed = io .create_new_feed ("touch-2" )
68
73
in_feed = io .create_new_feed ("touch-1" )
74
+ io .send_data (in_feed ["key" ], float (abs ((ANGLE_MAX - ANGLE_MIN )/ 2 )))
69
75
70
76
received_data = io .receive_data (in_feed ["key" ])
71
77
74
80
FEEDBACK_PIN = board .A2
75
81
touch = touchio .TouchIn (board .TX )
76
82
77
- # angles for servo
78
- ANGLE_MIN = 0
79
- ANGLE_MAX = 180
80
-
81
83
# servo setup
82
84
pwm = pwmio .PWMOut (SERVO_PIN , duty_cycle = 2 ** 15 , frequency = 50 )
83
85
servo = servo .Servo (pwm )
You can’t perform that action at this time.
0 commit comments