A repository for MicroPython code that communicates with and relays information from the Texas Instruments TMP117/119 temperature sensor.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
863 B

2 months ago
1 month ago
2 months ago
  1. import asyncio
  2. from lib.topic_message import TMQueue
  3. from async_tasks.onboard_tasks import measure_sensors
  4. async def main_wifi(uuid, sensors, mqtt_client, temperature_topic, inbound_topic):
  5. from async_tasks.wireless_tasks import mqtt_publish_tmsgs
  6. outbound_queue = TMQueue()
  7. asyncio.create_task(measure_sensors(sensors, 1, uuid, outbound_queue, temperature_topic))
  8. asyncio.create_task(mqtt_publish_tmsgs(mqtt_client, outbound_queue, 0.5))
  9. while True:
  10. await asyncio.sleep(5)
  11. async def main_wired(uuid, sensors, temperature_topic, inbound_topic):
  12. from async_tasks.wired_tasks import usb_send_data
  13. outbound_queue = TMQueue()
  14. asyncio.create_task(measure_sensors(sensors, 1, uuid, outbound_queue, temperature_topic))
  15. asyncio.create_task(usb_send_data(outbound_queue, 0.5))
  16. while True:
  17. await asyncio.sleep(5)