hi
I'm a bit new at all this and have only done a few basic robots etc. my question is this- is there a way to program a robot that would respond to various presses of the touch sensor. by this i mean if i pressed it once it would do a. if i pressed it 3 times it would do b etc. I've googled and googled a way to make it respond to two clicks instead of one but to no avail. everything I've tried it either doesn't do anything or reacts after 1.
is there any help you can give me?
very basic question from a newbie about touch sensors
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: very basic question from a newbie about touch sensors
How about something like this:
If pressed, wait till released.
Wait until 500ms has passed, or the button is pressed again. (at this point, if 500ms passed, then it was a single press)
if it was pressed a second time, wait until released.
Wait until 500ms has passed, or the button is pressed again. (at this point, if 500ma passed, then it was a double press)
if it was pressed a third time, wait until released. (at this poing, it was a triple press).
That is just an idea. 500ms is just an example (possibly realistic) amount of time.
If you're programming in NXC, I can try to type up a simple example for you.
If pressed, wait till released.
Wait until 500ms has passed, or the button is pressed again. (at this point, if 500ms passed, then it was a single press)
if it was pressed a second time, wait until released.
Wait until 500ms has passed, or the button is pressed again. (at this point, if 500ma passed, then it was a double press)
if it was pressed a third time, wait until released. (at this poing, it was a triple press).
That is just an idea. 500ms is just an example (possibly realistic) amount of time.
If you're programming in NXC, I can try to type up a simple example for you.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 290
- Joined: 03 Oct 2011, 00:06
- Location: Gallifrey
- Contact:
Re: very basic question from a newbie about touch sensors
It's certainly possible. But first, what programming language are you using? What have you tried? What are the conditions you want to check for?
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
"A kingdom of heaven for RobotC now has recursion!"
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests