Go to the documentation of this file.00001
00002
00003 """ Example code of how to access button state. """
00004
00005
00006 import roslib; roslib.load_manifest('mini_max_tutorials')
00007 import rospy
00008
00009
00010
00011 from arbotix_msgs.msg import *
00012
00013 class ButtonTest:
00014
00015 def buttonCb(self, msg):
00016
00017 if msg.value == 0:
00018 print "Button pressed!"
00019
00020 def __init__(self):
00021
00022 rospy.init_node('button_test')
00023
00024
00025 rospy.Subscriber('/arbotix/green_button',Digital,self.buttonCb)
00026
00027
00028 rospy.spin()
00029
00030
00031
00032
00033 if __name__ == "__main__":
00034 bt = ButtonTest()