• Advertisement
Sign in to follow this  

Time button is pressed

This topic is 745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

Its simple but if you want a code example you should specify what you're using. You just need a way to store time and to tell if the key is down or the key is up.

if(isButtonDown())
{
  clock.start();
 
}

if(isButtonUp())
{
  clock.stop();

}

Edited by UAas

Share this post


Link to post
Share on other sites

You're going to have to provide more detail.  Are you writing a program?  If so, what language?  Are you using any external libraries to handle input? Details, please.

Share this post


Link to post
Share on other sites

You're going to have to provide more detail.  Are you writing a program?  If so, what language?  Are you using any external libraries to handle input? Details, please.

thank you for replying no i'm not writing any program i just want a way that i can calculate time button is pressed

Share this post


Link to post
Share on other sites

 

Its simple but if you want a code example you should specify what you're using. You just need a way to store time and to tell if the key is down or the key is up.

if(isButtonDown())
{
  clock.start();
 
}

if(isButtonUp())
{
  clock.stop();

}

i just want a code that let me calculate time button is pressed on my computer keyboard

Share this post


Link to post
Share on other sites

 

 

Its simple but if you want a code example you should specify what you're using. You just need a way to store time and to tell if the key is down or the key is up.

if(isButtonDown())
{
  clock.start();
 
}

if(isButtonUp())
{
  clock.stop();

}

i just want a code that let me calculate time button is pressed on my computer keyboard

 

But why do you want that?

There are a lot of ways to do it. Easy ways like using a library, and hard ways like writing everything yourself. We can't give you code without you specifying what language you're using or if you're using a library.

Share this post


Link to post
Share on other sites

Just using Windows I assume?  Sorry, I don't have any idea, outside of writing a program to do it for you.

Edited by BeerNutts

Share this post


Link to post
Share on other sites

Just using Windows I assume?  Sorry, I don't have any idea, outside of writing a program to do it for you.

can you please write me a program cause i don't know how and thank you

Share this post


Link to post
Share on other sites

 

 

 

Its simple but if you want a code example you should specify what you're using. You just need a way to store time and to tell if the key is down or the key is up.

if(isButtonDown())
{
  clock.start();
 
}

if(isButtonUp())
{
  clock.stop();

}

i just want a code that let me calculate time button is pressed on my computer keyboard

 

But why do you want that?

There are a lot of ways to do it. Easy ways like using a library, and hard ways like writing everything yourself. We can't give you code without you specifying what language you're using or if you're using a library.

 

thank you for replying can you please tell me how to do it using library

Share this post


Link to post
Share on other sites

Look into keyboard macro programs (or whatever theyre called) and keyloggers etc. Since they log the times of recorded events (which seems to be what you want).

 

Eg I found this with some googling, and in the picture near middle of that page it shows some events, with duration in milliseconds (I dont know, you have to record some keypresses, then open that edit window it shows??).

 

 

But I doubt anybody is going to write you a program - you didnt even say why you need it or give any sort of detail, and writing a program takes time. At least not for free.

 

edit:

If you want to write it yourself, youll need to know how to program (at least basics). If you do know how, or if you dont but are willing to dedicate lots of time to learn, then do say so.

Edited by Waterlimon

Share this post


Link to post
Share on other sites

Look into keyboard macro programs (or whatever theyre called) and keyloggers etc. Since they log the times of recorded events (which seems to be what you want).

 

Eg I found this with some googling, and in the picture near middle of that page it shows some events, with duration in milliseconds (I dont know, you have to record some keypresses, then open that edit window it shows??).

 

 

But I doubt anybody is going to write you a program - you didnt even say why you need it or give any sort of detail, and writing a program takes time. At least not for free.

 

edit:

If you want to write it yourself, youll need to know how to program (at least basics). If you do know how, or if you dont but are willing to dedicate lots of time to learn, then do say so.

hi thank you for your help what i'm trying to do is to sync music with LED light for example i follow the beat of a song by pressing a button then i program the led with my arduino so the led will sync with the beat

Share this post


Link to post
Share on other sites

 

 

 

Its simple but if you want a code example you should specify what you're using. You just need a way to store time and to tell if the key is down or the key is up.

if(isButtonDown())
{
  clock.start();
 
}

if(isButtonUp())
{
  clock.stop();

}

i just want a code that let me calculate time button is pressed on my computer keyboard

 

But why do you want that?

There are a lot of ways to do it. Easy ways like using a library, and hard ways like writing everything yourself. We can't give you code without you specifying what language you're using or if you're using a library.

 

kk

Edited by alex12

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement