-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
34 lines (23 loc) · 742 Bytes
/
example.py
File metadata and controls
34 lines (23 loc) · 742 Bytes
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
31
32
33
34
import time
import pyphox
HOST = "192.168.193.215:8080"
def StartStopExample():
conn = pyphox.connect(HOST)
# 'Start' and 'stop' only start and stop measuring
# There's no urgency to even run these functions
conn.start()
time.sleep(5)
conn.stop()
def SensorsExample():
# Before running this, run an experiment in Phyphox
# that utilizes the light sensor. Don't forget to allow
# Remote Access and change the HOST to the one provided
# in the app
conn = pyphox.connect(HOST)
light: pyphox.VSensor = conn.register_sensor(pyphox.SensorType.LIGHT)
conn.start()
time.sleep(1)
print("light: ", light.get_value())
conn.stop()
if __name__ == '__main__':
SensorsExample()