Skip to content

Instantly share code, notes, and snippets.

Last active June 3, 2018 13:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
MicroPython for Wemos D1 mini to read temperature/humidity and report to InfluxDB
import urequests
from time import sleep
from machine import Pin, reset
p2 = Pin(2, Pin.OUT)
def TempSensReport():
from sht30 import SHT30
sensor = SHT30()
url = "http://orangepipc:8086/write?db=wemos_d1"
for i in range(0,LENGTH+1):
print('Reboot in %d minutes' % (LENGTH-i))
# turn on the WeMOS LED
# measure values
temperature, humidity = sensor.measure()
temp = "temp_C,host=%s value=%.02f" % (HOST,temperature)
hum = "rel_humidity,host=%s value=%.02f" % (HOST,humidity)
# send to InfluxDB API,data=temp),data=hum)
# print on uart for warm fuzzy feeling
print('Temperature:', temperature, ' C, RH:', humidity, '%')
# turn off LED
# reboot every range*LENGTH
Copy link

wthomson commented Jun 3, 2018

Line 15 says # turn on the WeMOS LED
Line 16 says

Line 26 says # turn off LED
Line 27 says p2.on()

Shouldn't the command lines agree with their respective comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment