ROBOTC.net forums
http://www.robotc.net/forums/

Coding Problems: Making a Counter that Counts by 1
http://www.robotc.net/forums/viewtopic.php?f=53&t=13440
Page 1 of 1

Author:  SometimeSTEVEEE [ Tue Feb 23, 2016 9:40 am ]
Post subject:  Coding Problems: Making a Counter that Counts by 1

My team and I have been struggling to write code that uses a limit switch or bump switch. We want the code to make a counter that counts each time the switch is pressed down. However our code counts to roughly 60,000 for every 1 second it is pressed. It counts higher and higher the longer you hold it down. We just want the code to count it when it is pressed and not by how many seconds it was held down for. I do not have the code on my person as it is on my teammate's computer but if anybody could offer tips or guidelines to follow, it would much appreciated. :)

Author:  mightor [ Wed Feb 24, 2016 3:18 am ]
Post subject:  Re: Coding Problems: Making a Counter that Counts by 1

This is fairly easily solved with some code that waits for the switch to be NOT pressed before continuing, pseudo code:
wait for button to be pressed
wait for button to be released
increment counter

That's all :)

= Xander

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/