Пример #1
0
 def temp_init(pin=PIN_TEMP):
     from components.iot import Thermometer
     ts = Thermometer(pin)
     # tx = tt.ds.scan()
     # ts.read_temp(tx[0])
     return ts
Пример #2
0
# octopusLAB example - 2019
# simple example: dallas thermometer and 8x7 segment display (disp7)

from time import sleep
from utils.octopus import disp7_init
from components.iot import Thermometer

print("init > ")
d7 = disp7_init()
ts = Thermometer()

print("start > ")

while True:
    temp = ts.get_temp()
    print(temp)
    d7.show(temp)
    sleep(2)
Пример #3
0
from components.analog import Analog
from components.iot import Thermometer
from utils.database.influxdb import InfluxDB
from utils.wifi_connect import WiFiConnect

print("init")
led_light = False
led = Led(2)
duty = 0
pir = 0
keep_alive = 0
light_treshold = 1500
led_button = Button(0, release_value=1)
anLight = Analog(36)
pwm = PWM(Pin(17, Pin.OUT), 500, duty) # PWM1
tt = Thermometer(32)
print("light", anLight.get_adc_aver(8))
print("temp.",tt.get_temp())

print("wifi")
net = WiFiConnect()
net.connect()

led.blink()
sleep(3)
led.blink()


min = 0
def timer60s():
    global min
Пример #4
0
print("---oled---")
from edushield import oled, oled_show
oled_show(oled,strB="saved: " + str(tempL) + " | " + str(tempH),num=status)

print("---relay---")
from edushield import relay
led2.value(1)
relay.value(1)
sleep(1)
relay.value(0)
led2.value(0)

print("---thermometer---")
from components.iot import Thermometer
tt = Thermometer(32)  # DEV1 pin 
tx = tt.ds.scan()
print(tt.get_temp(0))
# tt.get_temp(1)

print("---wifi---")
def influx_write():
    print(gc.mem_free())
    gc.collect()
    print(gc.mem_free())
    temp = tt.get_temp()
    return influx.write(relay=statusRelay,tempset=tempX,temperature=temp)


net = w()
ip = net.sta_if.ifconfig()[0]
Пример #5
0
from machine import Timer
from utils.wifi_connect import read_wifi_config, WiFiConnect
from utils.mqtt import MQTT
# from umqtt.simple import MQTTClient
from utils.pinout import set_pinout
from components.led import Led
from utils.octopus import disp7_init
from components.iot import Thermometer
from gc import mem_free

bd = bytes.decode
print("--- RAM free ---> " + str(mem_free())) 

pinout = set_pinout()
led = Led(pinout.BUILT_IN_LED)
ts = Thermometer()
# d7 = disp7_init()       # 8 x 7segment display init

esp_id = ubinascii.hexlify(machine.unique_id()).decode()
print(esp_id)


def simple_blink():
    led.value(1)
    sleep(0.5)
    led.value(0)
    sleep(0.5)


timer_interval = 1 # minutes
it = 0 # every 10 sec.