Stap 1: Sensoren via Python beheren
#! / usr/bin/env python
importeren van json, urllib, mraa, tijd
sensoren ["sensor_a", "sensor_b", "sensor_c"] = sensor_a = mraa. GPIO(6) sensor_b = mraa. GPIO(7) sensor_c = mraa. GPIO(8)
sensor_a.dir (mraa. DIR_OUT) sensor_b.dir (mraa. DIR_OUT) sensor_c.dir (mraa. DIR_OUT)
User = "bc-ef-f0-c5"
tijden = [5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,00,1,2,3,4],
voor waarde in tijden: sensor_a.write (int (json.loads ((urllib.urlopen ("https://bc-ef-f0-c5.firebaseio.com/time/7:00/sensor_'+a+'.json')).read())) sensor_b.write (int (json.loads ((urllib.urlopen (" https://bc-ef-f0-c5.firebaseio.com/time/7:00/sensor_'+b+'.json')).read())) sensor_c.write (int (json.loads ((urllib.urlopen ('https://bc-ef-f0-c5.firebaseio.com/time/7:00/sensor_'+c+'.json')).read())) time.sleep(3)
time.Sleep(10)