"""
      if self._inited:
         self._inited = False
         self._cb.cancel()
         pigpio.set_mode(self._trig, self._trig_mode)
         pigpio.set_mode(self._echo, self._echo_mode)

if __name__ == "__main__":

   import time

   import pigpio

   import sonar_trigger_echo

   pigpio.start()

   sonar = sonar_trigger_echo.ranger(7, 8)

   end = time.time() + 60.0

   while time.time() < end:

      print(sonar.read())
      time.sleep(0.03)

   sonar.cancel()

   pigpio.stop()

Example #2
0
            self._inited = False
            self._cb.cancel()
            self.pi.set_mode(self._trig, self._trig_mode)
            self.pi.set_mode(self._echo, self._echo_mode)


if __name__ == "__main__":

    import time

    import pigpio

    import sonar_trigger_echo

    pi = pigpio.pi()

    sonar = sonar_trigger_echo.ranger(pi, 23, 24)

    end = time.time() + 600.0

    r = 1
    while time.time() < end:

        print("{} {}".format(r, sonar.read()))
        r += 1
        time.sleep(0.03)

    sonar.cancel()

    pi.stop()
Example #3
0
         self._inited = False
         self._cb.cancel()
         self.pi.set_mode(self._trig, self._trig_mode)
         self.pi.set_mode(self._echo, self._echo_mode)

if __name__ == "__main__":

   import time

   import pigpio

   import sonar_trigger_echo

   pi = pigpio.pi()

   sonar = sonar_trigger_echo.ranger(pi, 23, 18)

   end = time.time() + 600.0

   r = 1
   while time.time() < end:

      print("{} {}".format(r, sonar.read()))
      r += 1
      time.sleep(0.03)

   sonar.cancel()

   pi.stop()

Example #4
0
         self._inited = False
         self._cb.cancel()
         self.pi.set_mode(self._trig, self._trig_mode)
         self.pi.set_mode(self._echo, self._echo_mode)

if __name__ == "__main__":

   import time

   import pigpio

   import sonar_trigger_echo

   pi = pigpio.pi()

   sonar = sonar_trigger_echo.ranger(pi, 26, 19)

   end = time.time() + 600.0

   r = 1
   while time.time() < end:

      print("{} {}".format(r, sonar.read()))
      r += 1
      time.sleep(0.03)

   sonar.cancel()

   pi.stop()

Example #5
0
            self._inited = False
            self._cb.cancel()
            self.pi.set_mode(self._trig, self._trig_mode)
            self.pi.set_mode(self._echo, self._echo_mode)


if __name__ == "__main__":

    import time

    import pigpio

    import sonar_trigger_echo

    pi = pigpio.pi()

    sonar = sonar_trigger_echo.ranger(pi, 21, 20)

    end = time.time() + 600.0

    r = 1
    while time.time() < end:

        print("{} {}".format(r, sonar.read()))
        r += 1
        time.sleep(0.03)

    sonar.cancel()

    pi.stop()
Example #6
0
         self._inited = False
         self._cb.cancel()
         self.pi.set_mode(self._trig, self._trig_mode)
         self.pi.set_mode(self._echo, self._echo_mode)

if __name__ == "__main__":

   import time

   import pigpio

   import sonar_trigger_echo

   pi = pigpio.pi()

   sonar = sonar_trigger_echo.ranger(pi, 19, 26)

   end = time.time() + 600.0

   r = 1
   while time.time() < end:

      print("{} {}".format(r, sonar.read()))
      r += 1
      time.sleep(0.03)

   sonar.cancel()

   pi.stop()

Example #7
0
        """
      Cancels the ranger and returns the gpios to their
      original mode.
      """
        if self._inited:
            self._inited = False
            self._cb.cancel()
            self.pi.set_mode(self._trig, self._trig_mode)
            self.pi.set_mode(self._echo, self._echo_mode)


if __name__ == "__main__":

    import time

    import pigpio

    import sonar_trigger_echo

    pi = pigpio.pi()

    sonar = sonar_trigger_echo.ranger(pi, 17, 18)

    end = time.time() + 600.0

    print sonar.read()

    sonar.cancel()

    pi.stop()