Files
x10sa/script/local.py
2015-08-18 10:34:56 +02:00

29 lines
748 B
Python

###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
#Uncomment this line to create the simulated devices needed to the tutorial scripts.
#run("tutorial/devices")
import random
class SimulatedOutput(Writable):
def write(self, value):
pass
class SimulatedInput(Readable):
def __init__(self):
self.x = 0.0
def read(self):
self.x = self.x + 0.2
noise = (random.random() - 0.5) / 20.0
return math.sin(self.x) + noise
sout = SimulatedOutput()
sinp = SimulatedInput()