Society of Robots - Robot Forum
General Misc => Misc => Topic started by: ert481 on October 31, 2008, 10:54:33 AM
-
i would like to know how to add a push-button to the $50 robot
a. how and where would i connect it to the robot?
b. what would i add in the SoRutils.h file?
-
It depends on what the function of this push button would be.
-
Schematic:
http://www.societyofrobots.com/sensors_tactbumpswitch.shtml
In the code, set up a pin as an input (digital or analog, doesn't matter). You can use the same sensor code as the photoresistor if you want.
-
THANKS ADMIN!
-
am i suposed to hook a 40 ohm resistor to the ground? then in the code what do i put so it does something when the button is pushed?
-
am i suposed to hook a 40 ohm resistor to the ground?
nope, not for a push button
then in the code what do i put so it does something when the button is pushed?
I'm confident you can figure this out after reading through the source code and searching the forum/google. Give it a try and if you still get stuck, post what you have and we'll help from there.
Step 0: connect one end of the button to ground, the other to your pin
Step 1: configure a port as a digital input
Step 2: turn on pull up resistor
Step 3: read the port value