goglsense.blogg.se

Opensprinkler image 2.3
Opensprinkler image 2.3









opensprinkler image 2.3

At each iteration of the loop, the voltage is read, the GPIO pin is read and the time is noted. I add these values to a python list where I am logging events.

opensprinkler image 2.3

When the callback occurs, I note the time and read the GPIO pin 25. However, the ripple does not go low enough to trigger a falling edge I close the relay, energizing my rectifier and supplying rippling ~ 3.0 v to the GPIO Pin 25. Initialize the GPIO pins and set up GPIO.BOTH edge detection on pin 25 to call my callback routine. ",%d"%conds + ".%06d"%measuretime.microseconds + Print "voltimelist len =", len(voltimelist)įor voltim, volts, state, pin, measuretime in voltimelist:įile.write( "%d"%conds + ".%06d"%mstime.microseconds + ", Count = " + str(avgvoltcnt) + ", state = " + str(state)) Finished! Average volts=" + str("%.4f"%avgvolt) + Timercount = int(testtime / sleeptime) + 1Īvgvolt = ((avgvoltcnt * avgvolt) + voltage) / (avgvoltcnt + 1) Measuretime = datetime.utcnow() - starttime Global state # 0 = not started, 1 = on, 2 = off, 3= zero reached Key = conds + mstime.microseconds / 1000000.0 # timediff.microseconds 7) or (adcnum >= 1 # first bit is 'null' so drop it # voltage = ad_value*(3.3 / 1024) # *5 no voltage divider here # ad_value = readadc(AO_pin, SPICLK, SPIMOSI, SPIMISO, SPICS) # change these as desired - they're the pins connected from the Code: Select all #!/usr/bin/env python2.7įrom time import sleep # this lets us have a time delay (see line 12)ĪO_pin = 0 #flame sensor AO connected to ADC chanannel 0











Opensprinkler image 2.3