Skip to content
Miloš Viktorović
  • Home
  • Coaching
    • Coaching
    • Introduction to Agile
    • Practical (Remote) Agile
  • Posts & Publications
    • Publications
    • Flying
    • Blog
  • Projects
    • Research Project
    • Student IoT kit
    • CODES
  • About
  • Contact

[CODE] test_IoT.py

## ##########################################################
## @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)
  • [CODE] GrovePi_plus-Example.py
  • [CODE] iot_simulator.py
  • [CODE] GrovePi_plus-startup
  • [CODE] mqtt_and_csv.py
  • [CODE] mqtt_messenger_example.py
  • [CODE] test_IoT.py

Recent Posts

  • Schnitzel flight! EHEH – EDRK
    Schnitzel flight! EHEH – EDRK
    03-Sep-2021
  • Private Pilot License – My journey to PPL!
    Private Pilot License – My journey to PPL!
    22-Apr-2021
  • Solo Cross-country Navigation flight (Big Triangle) EHEH ⇒ EHMZ ⇒ EHSE ⇒ EHEH
    Solo Cross-country Navigation flight (Big Triangle) EHEH ⇒ EHMZ ⇒ EHSE ⇒ EHEH
    13-Dec-2020
  • Spin & acrobatics on Super Decathlon
    Spin & acrobatics on Super Decathlon
    19-Oct-2020
  • Flight log EHEH-EHSE (via Rotterdam)
    Flight log EHEH-EHSE (via Rotterdam)
    19-Oct-2020

Recent Posts

  • Schnitzel flight! EHEH – EDRK
  • Private Pilot License – My journey to PPL!
  • Solo Cross-country Navigation flight (Big Triangle) EHEH ⇒ EHMZ ⇒ EHSE ⇒ EHEH

Archives

  • September 2021
  • April 2021
  • December 2020
  • October 2020
  • August 2020
  • June 2020
  • May 2020
  • January 2020
  • May 2019
Milos Viktorovic © 2023
  • Home
  • Coaching
    • Coaching
    • Introduction to Agile
    • Practical (Remote) Agile
  • Posts & Publications
    • Publications
    • Flying
    • Blog
  • Projects
    • Research Project
    • Student IoT kit
    • CODES
  • About
  • Contact