## ##########################################################
## @title: IoT simulator test
## @author: Milos Viktorovic
## @email: m.viktorovic@tue.nl
## @version: 1.0b [13-11-19]
## ##########################################################
import iot_simulator as device
from time import sleep
# ______________________________________________________________________________________
# In this example we are simulationg the IoT device with 3 analog ports A0,A1,A2
# To each port we have device attached
# A0 - Temperature Sensor (range 0-50Celsius, coresponding to 0-5VDC)
# A1 - Humidity sensor (range 0-100%, coresponding to 0-5VDC)
# A2 - LED (output 0-5VDC)
#
# ______________________________________________________________________________________
temp_max_value = 50
temp_min_value = 0
temp_conversion = (temp_max_value - temp_min_value)/1024
temp_sensor = 0 # A0
device.pinMode(temp_sensor,"INPUT")
sleep(1)
while 1:
x = device.analogRead(2)
print(x)
sleep(2)
# while 1:
# try:
# sensor_read = device.analogRead(temp_sensor)
#
# temp = sensor_read * temp_conversion
# print(temp)
# except Exception as e:
# print("Error occured: "+str(e))
#
# sleep(2)