Go Down

Topic: different action based on the number of times a button is pressed (Read 2226 times) previous topic - next topic

johncc


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: [Select]

// 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 :)

Cheers,
John


arduinodale

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

lloyddean

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.

PaulS

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.

arduinodale

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

PaulS

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.".

arduinodale

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

Logging out

Dale

HazardsMind

#37
Jan 29, 2013, 12:58 am Last Edit: Jan 29, 2013, 02:08 pm by HazardsMind Reason: 1
@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.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

Go Up