![]() |
Getting a button to latch its value until it is pressed again
Alright... when I press a button I need it to hold a value of 1 even if it is released. Then... when it is pressed again I need it to return its value to 0. To anyone who responds to this post you have all of my respect and thanks. Just to say it again to make sure I don't screw up in saying it... when I press a button I need it to hold a value of one even after it has been released. Then when i press it again i need it to return its value to 0. Thanks again.
|
Re: Getting a button to latch its value until it is pressed again
This involves storing the last state of your button, something like this:
Code:
void Run_Motor_Button (void) |
Re: Getting a button to latch its value until it is pressed again
Depending on your usage, another option may be to by a pushbutton switch. Search for anything that's either "spst pushbutton" or "spdt pushbutton", but not "momentary". Here are two options from RadioShack: http://www.radioshack.com/product/in...ductId=2062510
http://www.radioshack.com/product/in...ductId=2062544 |
| All times are GMT -5. The time now is 12:07. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi