-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathLm75a.py
34 lines (26 loc) · 863 Bytes
/
Lm75a.py
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
# This is an example of using the Lm75a temperature sensor connected on a WiFi
# network using the esp8266 service.
# You can also use an Arduino or RasPi service to connect to the Lm75a
port="COM3"
if ('virtual' in globals() and virtual):
virtualArduino = Runtime.start("virtualArduino", "VirtualArduino")
virtualArduino.connect(port)
lm75a = Runtime.start("lm75a","Lm75a")
# esp8266 use
# esp = Runtime.start("esp","Esp8266_01")
# esp.setHost("esp8266-02.local")
# lm75a.attach("esp","0","0x48")
# arduino use
arduino = Runtime.start("arduino","Arduino")
arduino.connect(port)
lm75a.attach(arduino,"0","0x48")
print lm75a.getTemperature()
print lm75a.getConfig()
print lm75a.getTos()
print lm75a.getThyst()
lm75a.setTos(90)
lm75a.setThyst(88)
print lm75a.getTemperature()
print lm75a.getConfig()
print lm75a.getTos()
print lm75a.getThyst()