language grl 0.1
module W2IOWaitPulse
  const speed v = joint(35 %)
  const zone zf = fine
  target home = joint_target { joints: [0 deg, 0 deg, 0 deg, 0 deg, 0 deg, 0 deg] }
  path io_path {
    defaults { speed: v, zone: zf }
    point p0 movej home
    event at p0 distance 5 + 5 mm pulse io.do[20] duration 50 + 50 ms
  }
  proc main()
    io.do[1] = true
    io.ao[1] = 0.75
    io.go[1] = 3
    wait all(io.di[1] == true, io.di[2] == false) timeout 1 s on_timeout alarm "all timeout"
    wait any(io.di[3] == true, io.di[4] == true) timeout 1 s
    wait rising(io.di[5]) timeout 1 s
    wait falling(io.di[6]) timeout 1 s
    wait changed(io.di[7]) timeout 1 s
    pulse io.do[2] duration 50 + 50 ms
    run_path io_path
  end
end
