Page 1 of 1

very basic question from a newbie about touch sensors

Posted: 22 May 2012, 21:01
by gorm1
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?

Re: very basic question from a newbie about touch sensors

Posted: 22 May 2012, 21:08
by mattallen37
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.

Re: very basic question from a newbie about touch sensors

Posted: 22 May 2012, 21:09
by inxt-generation
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?