﻿from artiq.experiment import*
class code(EnvExperiment):
    def build(self):
        self.setattr_device('core')
        self.setattr_device('ttl16')
        self.setattr_device('ttl17')
        self.setattr_device('ttl18')
        self.setattr_device('ttl19')
        self.setattr_device('ttl20')
        self.setattr_device('ttl21')
        self.setattr_device('ttl1')
    @kernel
    def run(self):
        self.core.reset()
        with parallel:
            self.ttl1.gate_rising(2*ms)
            with sequential:
                self.ttl16.on()
                delay(100.0*ns)
                self.ttl16.off()
                delay(200.0*ns)
                self.ttl16.on()
                delay(50.0*ns)
                self.ttl17.on()
                delay(50.0*ns)
                self.ttl16.off()
                delay(50.0*ns)
                self.ttl17.off()
                delay(350.0*ns)
                self.ttl16.on()
                delay(100.0*ns)
                self.ttl16.off()
                delay(200.0*ns)
                self.ttl16.on()
                delay(50.0*ns)
                self.ttl17.on()
                delay(50.0*ns)
                self.ttl16.on()
                delay(0.0*ns)
                self.ttl16.off()
                delay(50.0*ns)
                self.ttl17.off()
                delay(50.0*ns)
                self.ttl16.off()
                delay(200.0*ns)
                self.ttl16.on()
                delay(50.0*ns)
                self.ttl17.on()
                delay(50.0*ns)
                self.ttl16.off()
                delay(50.0*ns)
                self.ttl17.off()
                delay(500.0*ns)
        count=self.ttl1.count()
        self.set_dataset('count',count,broadcast=True, save=False)
        print('*******************',count,'***************************')
        print('finish')
