forked from M-Labs/artiq
1
0
Fork 0

drtio: better LED demo

This commit is contained in:
Sebastien Bourdeauducq 2016-11-09 14:53:45 +08:00
parent d547c5d922
commit 60e748eabe
2 changed files with 47 additions and 5 deletions

View File

@ -32,7 +32,42 @@
"module": "artiq.coredevice.ttl", "module": "artiq.coredevice.ttl",
"class": "TTLOut", "class": "TTLOut",
"arguments": {"channel": 1}, "arguments": {"channel": 1},
"comment": "Hello World" },
"rled2": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 2},
},
"rled3": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 3},
},
"rled4": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 4},
},
"rled5": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 5},
},
"rled6": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 6},
},
"rled7": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 7},
}, },
"rsmap": { "rsmap": {

View File

@ -4,11 +4,18 @@ from artiq.experiment import *
class BlinkForever(EnvExperiment): class BlinkForever(EnvExperiment):
def build(self): def build(self):
self.setattr_device("core") self.setattr_device("core")
self.setattr_device("rled0") self.leds = [self.get_device("rled" + str(i)) for i in range(8)]
@kernel @kernel
def run(self): def run(self):
self.core.reset() #self.core.reset()
self.core.break_realtime()
while True: while True:
self.rled0.pulse(100*ms) for led in self.leds:
delay(100*ms) led.pulse(250*ms)
t = now_mu()
for led in self.leds:
at_mu(t)
led.pulse(500*ms)
delay(250*ms)