Pages: 1 2 [3]   Go Down
Author Topic: different action based on the number of times a button is pressed  (Read 1434 times)
0 Members and 1 Guest are viewing this topic.
Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 354
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

John thanks for the second link, I've done a copy and paste
Quote

Here is an example of countdown using a for loop:
1234567891011
Code:
// countdown using a for loop
#include <iostream>
using namespace std;
int main ()
{
  for (int n=10; n>0; n--) {
    cout << n << ", ";
  }
  cout << "FIRE!\n";
  return 0;
}
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, FIRE!

I don't think there is a better way to learn then to see an example of how its done.
Actually that is an example showing a case where the braces are not required, sorry <shrug>.  You only really need a "compound statement" aka "block" (with the braces) , as a way of putting more than one statement as part of your loop.  But in this case they don't hurt, and are even recommended by many (because it doesn't hurt for a block to have only one statement).  It is explained more thoroughly at the top of that page.

Quote
Here is my working code: with better comments
Awesome, glad its working better now!

Quote
John I was looking Jeremy Blum vid on youtube and seen a familiar name in the recommendations John NYCCNC is that you?
No, 'fraid not smiley

Cheers,
John

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all the people that have helped (mainly John) on this project and those that have been less than, why bother posting a reply. I did try to get the button code working but it's way beyond me, After researching around I found the best example was in the examples/digital/state change detection. I did try and hack this code into my prog but have admitted defeat.

Kind regards

Dale
Logged

Des Moines, WA - USA
Offline Offline
God Member
*****
Karma: 25
Posts: 779
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With the hope you check back here several more times ...

I don't know much about you but myself I do a lot of my problem solving in the background when I'm not giving any conscience effort to it - usually while sleeping.

My suggestion is not to admit defeat but simply set it aside for awhile relax some and come back to it at a later date.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46221
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Thanks for all the people that have helped (mainly John) on this project and those that have been less than, why bother posting a reply.
It's hard to know what will help a person. Sometimes a hint or a gentle nudge or a bit of encouragement is all that a poster needs. Sometimes the poster needs to have there hand held for a while.

If you try holding someone's hand when all they need is a hint, they don't like it. If all you give is a hint to someone that needs there hand held for a while, they don't like it.

You need to remember that the pay here isn't all that great. We're all volunteers. Sometimes that works; sometimes it doesn't.

If the project is important to you, and is beyond your skill set, you have two choices. Expand your skill set (learn!) or head over to Gigs and Collaboration, and offer to pay for the help you need.

Whining about people that try to help is not the correct answer.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This forum is for help and is unique from all others I have used, in that the amount of comments posted that are unhelpful. If somebody asks for a hint then give them a hint, it's that simple. but most on here are noobs asking for help.
Quote
You need to remember that the pay here isn't all that great. We're all volunteers. Sometimes that works; sometimes it doesn't.

If the project is important to you, and is beyond your skill set, you have two choices. Expand your skill set (learn!) or head over to Gigs and Collaboration, and offer to pay for the help you need.

 I've got a few "how to" videos on youtube machining related, but I'm not asking a payment for them, just done it to help others. This is what makes the internet great, expanding people's minds.

Regards

Dale
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46221
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If somebody asks for a hint then give them a hint, it's that simple. but most on here are noobs asking for help.
The problem is that someone that just needs a hint or a nudge asks for help. Someone that needs their hand held for a while asks for help. How are we to decode "I need help"?

How would you feel if, after watching one of your videos, a viewer posted a comment that said "Well, that wasn't helpful at all"? I'm sure that you would think "Well, so what? You got what you paid for! Other people appreciated it.".
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul this could go on for a long time, which you have a lot of.

Logging out

Dale
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2943
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@arduinodale

Quote
Paul this could go on for a long time, which you have a lot of.

Logging out

Dale
That was uncalled for.
Everyone who took the time to look at your post and comment, tried to help. We all deserve some gratitude.

Quote
those that have been less than, why bother posting a reply.
Appearently everyone's comments but johncc, were not what you needed, so then i'll go ahead and get rid of mine. Why bother posting a reply, right?

Edit: Previous post removed.
« Last Edit: January 29, 2013, 08:08:04 am by HazardsMind » Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Pages: 1 2 [3]   Go Up
Jump to: