Skip to content

Commit ccdf74e

Browse files
authored
Update main.py
1 parent 5a65bca commit ccdf74e

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

src/main.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,16 @@ def connect():
1919
#print(f"Connected to: {env['SSID']}")
2020

2121
def 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

3027
def 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

4333
if __name__ == "__main__":
44-
main()
34+
main()

0 commit comments

Comments
 (0)