File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,26 +19,16 @@ def connect():
1919 #print(f"Connected to: {env['SSID']}")
2020
2121def send_measure (measurement : float ):
22- response = requests .post (
23- "https://dev.chompe.rs/submit-measure" ,
24- json = {
25- "value" : measurement
26- }
27- ).text
28- return json .loads (response )
22+ """
23+ Recieves measurement and sends to verification API: https://dev.chompe.rs/submit-measure
24+ using one parameter: value (the distance in feet)
25+ """
2926
3027def main ():
3128 # Connect to internet network
3229 connect ()
33- btn = Pin (15 , Pin .IN , Pin .PULL_UP )
34- sensor = ProxSensor ()
35- while True :
36- if btn .value () == 0 :
37- distance = sensor .pulse (times = 3 )
38- break
39- units = Measurements (distance )
40- print (units )
41- send_measure (measurement = units .feet )
30+ # Create btn at Pin 15, when pressed take a reading from the sensor object,
31+ # and pass to Measurements to get measurements.
4232
4333if __name__ == "__main__" :
44- main ()
34+ main ()
You can’t perform that action at this time.
0 commit comments