class Cycletools

Toolbox which is given to the called cycle function on each call by .cycleloop() .


  • .core .device .io
    You can direct access the .core, .device and .io object ob your RevPiModIO instance. That makes it very easy to work with more functions and other modules. You just have to pass the Cycletools object.

    def loop(ct):
        # (...) = True
        ct.var.mrk_counter =
        # (...)

  • .first
    Contains the value True in the first cycle at program start, otherwise always False. For example, for creating cycle variables = 2.

    def loop(ct):
        if ct.first:
            ct.var.my_variable = 0
            ct.core.a1green.value = True

  • .flag1c .flag5c .flag10c .flag15c .flag20c
    Changes the status between True and False and hold that value for n cycles.
    1 = 1 cycle False, 1 cycle True
    15 = 15 cycles False, 15 cycles True and so on.

  • .flank5c .flank10c .flank15c .flank20c
    It is Truein the first cycle, then False and in every n cycle True.
    10 = 9 cycles False, in the 10th cycle True and so on

  • .last
    Contains the value True in the last cycle after the program was requested to end. You should use this to cleanup your IOs.

    def loop(ct):
        # (...)
        if ct.last:
            ct.core.a1green.value = False
   = False

  • .runtime
    This property will return the runtime of your cycle loop function at the moment, when you call it. So on the beginning of the function it will be nearly 0 and in the last line of your function you will have the max value.

  • .var
    All cycle variables are appended to this empty class. These are usable in every cycle. The first definition should be made in the first cycle:

    def cycle(ct):
        if ct.first:
            # Create variables in the first cycle
            ct.var.anzahl = 10
            ct.var.text = "Hallo Welt"
            ct.var.noch_eine = 0
        # Variables are now accessible
        if ct.var.anzahl == 10:
            ct.var.noch_eine += 1
        # and so on


.changed(io_object, edge=BOTH)

Check change of IO value from last to this cycle.

  • io_object
    IO to check for changes to last cycle.
  • edge=revpimodio2.BOTH
    Check for RISING, FALLING or BOTH change of BIT orientated IOs.


Gets the value of the power-off delay.

  • name
    Name of the power-off delay.

.set_tofc(name, cycles)

Starts the Switch-off delay whose value must be called via .get_tofc(name) .

  • name
    Name of the power-off delay.
  • cycles
    Number of cycles that the power-on delay should return True when  .get_tofc(Name) is called, after .set_tofc(name, cycles)was not called in the cycle anymore. The cefault cycletime is 50 milliseconds.


Gets the value of the power-on delay.

  • name
    Name of the power-on delay.

.set_tonc(name, cycles)

Starts the power-up delay whose value must be retrieved via .get_tonc(name) .

  • name
    Name of the power-on delay.
  • cycles
    Number of cycles the on-delay should return the value Falsewhen calling .get_tonc(Name), if .set_tonc(name, cycles)is called in each cycle. Only after the cycle number has been reached, .get_tonc(Name)returns the value True. The default cycletime is 50 milliseconds.


Gets the value of the pulse.

  • name
    Name of the pulse.

.set_tpc(name, cycles)

Starts a pulse whose value must be retrieved via .get_tpc(name) .

  • name
    Name of the pulse.
  • cycles
    Number of cycles the pulse should return the value True at call of .get_tpc(name), regardless of other .set_tpc(name, cycles) calls! After reaching the number of cycles, .get_tpc(name) then returns  False . The default cycletime is 50 milliseconds.