mirror of
https://github.com/brmlab/edubrm.git
synced 2025-08-04 07:43:35 +02:00
finish A module
This commit is contained in:
parent
854d40738f
commit
43ef244ff8
3 changed files with 57 additions and 16 deletions
|
@ -87,10 +87,12 @@ class Device:
|
|||
def read(self):
|
||||
if self.fake:
|
||||
from random import randint
|
||||
return (randint(0,1023), # AD0
|
||||
randint(0,1023), randint(0,1023), randint(0,1023), # AD1 .. AD3
|
||||
randint(0,1023), randint(0,1023), randint(0,1023), # AD4 .. AD6
|
||||
randint(0,1), randint(0,1), randint(0,1)) # IO1 .. IO3
|
||||
from time import time
|
||||
from math import sin
|
||||
return (randint(0,1023), # AD0
|
||||
int(sin(time())*511+512), randint(0,1023), randint(0,1023), # AD1 .. AD3
|
||||
randint(0,1023), randint(0,1023), randint(0,1023), # AD4 .. AD6
|
||||
randint(0,1), randint(0,1), randint(0,1)) # IO1 .. IO3
|
||||
else:
|
||||
i = self.epi.read(self.INSIZE)
|
||||
return (i[0] + (i[1]<<8), # AD0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue