Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def camera_feedback():
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(but_restart,GPIO.IN)
- #~ GPIO.add_event_detect(but_restart, GPIO.RISING, callback=RRestart, bouncetime=1000)
- rospy.init_node("GPIO_SIGNAL", anonymous=False)
- rospy.Timer( rospy.Duration(0.1),RRestart)
- rospy.spin()
- GPIO.cleanup()
- if __name__ == "__main__":
- try:
- camera_feedback()
- except rospy.ROSInterruptException:
- pass
- def RRestart(channel):
- global flag_reset2
- global RR_alr
- global flag_inreset
- #~ if (GPIO.input(but_restart) == 1 and flag_reset2 == False):
- #~ flag_inreset = True
- #~ flag_reset2 = True
- #~ elif (GPIO.input(but_restart) == 0 and flag_reset2 == True):
- #~ flag_reset2 = False
- channel = GPIO.wait_for_edge(but_restart, GPIO.RISING)
- if channel is None:
- print("timeout")
- else:
- print("edge detected on channel",channel)
- flag_inreset = True
- if (flag_inreset ==True):
- print("Restart")
- RR_alr = True
- print("waiting killing now and then restart")
- flag_inreset = False
- call(['bash','/home/ubuntu/kill_restart.sh'])
- print("done restart")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement