Skip to content

Instantly share code, notes, and snippets.

@elizabethn119
Last active August 31, 2020 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elizabethn119/1f7d02b3b662c1008ab7923a842e1214 to your computer and use it in GitHub Desktop.
Save elizabethn119/1f7d02b3b662c1008ab7923a842e1214 to your computer and use it in GitHub Desktop.
import time
from ISStreamer.Streamer import Streamer
from board import SCL, SDA
import busio
from adafruit_seesaw.seesaw import Seesaw
# --------- User Settings ---------
SENSOR_LOCATION_NAME = "House Plant"
BUCKET_NAME = "House Plant"
BUCKET_KEY = "soilsensor"
ACCESS_KEY = "ENTER ACCESS KEY HERE"
MINUTES_BETWEEN_READS = 0.25
# ---------------------------------
i2c_bus = busio.I2C(SCL, SDA)
ss = Seesaw(i2c_bus, addr=0x36)
streamer = Streamer(bucket_name=BUCKET_NAME, bucket_key=BUCKET_KEY, access_key=ACCESS_KEY)
while True:
# read moisture level through capacitive touch pad
touch = ss.moisture_read()
# read temperature from the temperature sensor and convert to F
temp = ss.get_temp()
temp_f = format(temp * 9.0 / 5.0 + 32, ".2f")
streamer.log(SENSOR_LOCATION_NAME + " Moisture", touch)
streamer.log(SENSOR_LOCATION_NAME + " Temperature", temp_f)
streamer.flush()
time.sleep(60*MINUTES_BETWEEN_READS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment