Skip to content

Instantly share code, notes, and snippets.

from webiopi.devices.sensor import DS18S20
import datetime
import pylab
import math
# sensors found with "ls /sys/bus/w1/devices/"
tmp0 = DS18S20(slave="10-000802de0ee7")
tmp1 = DS18S20(slave="10-000802de4b20")
N = 50
from webiopi.devices.sensor import DS18S20
import datetime
import pylab
import math
# sensors found with "ls /sys/bus/w1/devices/"
tmp0 = DS18S20(slave="10-000802de0ee7")
tmp1 = DS18S20(slave="10-000802de4b20")
N = 50
from webiopi.devices.sensor import DS18S20
import datetime
# sensors found with "ls /sys/bus/w1/devices/"
tmp0 = DS18S20(slave="10-000802de0ee7")
tmp1 = DS18S20(slave="10-000802de4b20")
while True:
print("{0} TEMP0: {1}C TEMP1: {2}C").format(datetime.datetime.now(),
tmp0.getCelsius(),
from webiopi.devices.sensor import DS18S20
# sensors found with "ls /sys/bus/w1/devices/"
tmp0 = DS18S20(slave="10-000802de0ee7")
tmp1 = DS18S20(slave="10-000802de4b20")
print("TEMP0: {0} C TEMP1: {1} C").format(tmp0.getCelsius(), tmp1.getCelsius()) # print temperature
from webiopi.devices.sensor import DS18S20
import datetime
import pylab
tmp0 = DS18S20(slave="10-000802de0ee7") # sensor found with "ls /sys/bus/w1/devices/"
time = [datetime.datetime.now()]
temp = [tmp0.getCelsius()]
pylab.ion()
from webiopi.devices.sensor import DS18S20
import datetime
import pylab
tmp0 = DS18S20(slave="10-000802de0ee7") # sensor found with "ls /sys/bus/w1/devices/"
N = 50
x = [0.0]*N
y = [0.0]*N
from webiopi.devices.sensor import DS18S20
tmp0 = DS18S20(slave="10-000802de0ee7") # sensor found with "ls /sys/bus/w1/devices/"
print("TEMP: {0} C ").format(tmp0.getCelsius()) # print temperature
import webiopi
from webiopi.devices.digital import PCF8574A
mcp = PCF8574A(slave=0x38) # 0111000
GPIO = webiopi.GPIO # Assign webiopi library to GPIO object
leds = 4 # number of led outputs in total
SWITCH0 = 4 # Set Switch value to P4
for index in range(leds):
import webiopi
from webiopi.devices.digital import PCF8574A
mcp = PCF8574A(slave=0x38) # 0111000
GPIO = webiopi.GPIO # Assign webiopi library to GPIO object
leds = 4 # number of led outputs in total (negative logic)
for index in range(leds):
mcp.setFunction(index, GPIO.OUT) #Set pin at index as output
import webiopi
from webiopi.devices.digital import PCF8574A
mcp = PCF8574A(slave=0x38)
GPIO = webiopi.GPIO # Assign webiopi library to GPIO object
LED0 = 0 # Set PCF8574 GPIO pin 0 to connect to the LED (negative logic)
mcp.setFunction(LED0, GPIO.OUT) #Set Pin 0 as output
mcp.digitalWrite(LED0, GPIO.LOW) # Turn on the LED for the first time