29 lines
748 B
Python
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()
|