Hi
I tried it like that to keep it simple:
##############################
import viz
viz.go()
import u12
d = u12.U12()
trigg = d.eAnalogIn(0) # AI0
##############################
def ExtTrigg():
print trigg
###+++++++++++++++++++++++++++
def checkTrigger():
if trigg > 2.0:
ExtTrigg()
vizact.onupdate(0, checkTrigger)
##############################
But it gives me this output (ever and ever again; regardless if I change my if-condition to 2.0, what should call the ExtTrigg-function):
{'overVoltage': 0, 'idnum': 0, 'voltage': 1.4208984375}
I can't read in a external voltage into AI0 (a ramp 0V-5V-0V produced by a battery). My output in Vizard is always unchanged by 1.42...V.
Do I also have to address my output like ' if trigg{3} > 2.0' or similar? I tried that, but it didn't seem to work with either [] nor () or {}.
I just have some background in Matlab, so I don't have a clue, what I could try next in Python...
|