BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Tue Oct 23, 2018 10:24 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: BUTTON command help
PostPosted: Sat Sep 08, 2012 6:52 pm 
Offline
Citizen

Joined: Sat Mar 10, 2012 8:18 pm
Posts: 5
Hey guys,
I have been having some trouble with the BUTTON command and was wondering if there is a way to make it read the number of presses on it within a timeframe (like 2 presses within 3 seconds), and depending on how many times you press it, will have a different outcome.

so for example: If I press the button 2 times, it will make an LED blink 3 times; if I only press once, it will make an LED turn on and remain lit, and pressing once again will turn it off.


thanks


Top
 Profile  
 
 Post subject: Re: BUTTON command help
PostPosted: Mon Sep 10, 2012 5:28 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
The command by itself can't do that. All button does is keep track of the last button state and keeps a running count of the number of times its been called in your loop to determine if the delay and repeat rates have been met.

You will need to make your control loop code(the loop your button command is running in) count and keep track of the number of presses per X loops, where X loops would be approx 3 seconds(as per your example).

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO