Society of Robots - Robot Forum

General Misc => Misc => Topic started by: ert481 on October 31, 2008, 10:54:33 AM

Title: 50$ robot
Post 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?
Title: Re: 50$ robot
Post by: pomprocker on October 31, 2008, 12:10:48 PM
It depends on what the function of this push button would be.
Title: Re: 50$ robot
Post by: Admin on November 04, 2008, 12:02:11 AM
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.
Title: Re: 50$ robot
Post by: ert481 on November 04, 2008, 07:29:24 AM
THANKS ADMIN!
Title: Re: 50$ robot
Post by: ert481 on November 07, 2008, 03:17:33 PM
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?
Title: Re: 50$ robot
Post by: Admin on November 09, 2008, 01:23:12 AM
Quote
am i suposed to hook a 40 ohm resistor to the ground?
nope, not for a push button

Quote
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