Code for programing mechanical inputs, sensors,count,external output=reset?

Hi, I am using a pro mini. I am looking to code this properly for a project. I am looking to use a momentary button to count as interrupts. Example: Momentary switch is pressed 10 times to set a motor off using 3v for 2 secs, the motor will activate through an external sensor that is normally open when active it will close, once the sensor is activated 10 times it activates the motor, and the preset interrupts of 10 once hit internally goes back to 0 and waits until it counts 10 again activates pulse motor and starts all over again. I also need a long button press to reset the the programmed 10 button presses to 0 in case I need the pulse motor to engage with 5 instead of 10. I have tried and cant' get this setup to work right much at all. I am new to code for specific projects, so this has been quite a mind strainer the last week. I would appreciate any help maybe a mock sketch or? I need to know where to store the inputs outputs and correct reference terms for the code and I have not got them right apparently through much study. This is a setup for the model R/C hobbyist Car, Plane, etc...

Thanks micro~

I'm afraid I can't make sense of your long paragraph with little punctuation.

Post the code you have and it may help to understand what you are trying to do.

I don't think the word "interrupts" in line 4 is appropriate in this context. For an Arduino an "interrupt" is a very specific thing which is probably not needed in your project - to the extent that I understand what you are trying to say.

There is some neat code for button presses here which may be useful.

The Thread planning and implementing a program illustrates (among other things) the use of short functions to make the code easy to follow.

...R

Thanks, but maybe this will help. I don't know exactly the best references on how to go about this using the button to program the to count x amount of impacts on the R/C cars, when the sensor gives input lets say the hobbyist pressed the button five times so when five impacts were detected the one directional small motor would engage to disperse a smoke or visual signal. The motor would only need to engage for lets say 3 secs. to achieve this so other contestants could be aware of it. Now if they want to do a 10 any number impact race that is why the external button is needed to be pressed to match how many impacts are sensed to engage the signal motor.

I think a shock sensor might be the best or im still thinking of maybe a piezo electric that acts as a accelerometer/shock sensor to activate them. The device would also need to auto reset once the number of preset sensor inputs were reached to engage the small one directional motor. So the contestant could resume without interference.

I'm using this mock up as follows: - What reference? to make the output engage the motor - ................? set the number of hits, programmed by the button - ................? to get the sensor info, to make the micro controller count against the # set by the button

Hopefully this helps, give you a better idean.? I'm also trying the Debounce with the Boolean code with little luck. I need a little guidance where an how is the best way to go about this? I have seen a few different ways to go about it this is why I'm a little confused. I also figured the Internal_Pullup on pin 13 as a blink to see the number of button inputs.

Any more advice would be great to get a little more precise on my sketch.....

Thanks again,

Sorry, but I feel lost for breath before I even get to the end of your second sentence. Slow down.

Is this how that second sentence is intended to be read?

I don't know exactly the best references on how to go about this

using the button to program the to count x amount of impacts on the R/C cars,

when the sensor gives input (lets say the hobbyist pressed the button five times) so when five impacts were detected the one directional small motor would engage to disperse a smoke or visual signal.

If so, perhaps you can set out the rest of your Post in the same way. Writing clearly may also help you to see a solution yourself.

That sentence suggests the following to me You want to count the number of button presses. I don't actually know if you use the word "impacts" to mean that one car bumps another. If the Arduino counts 5 button presses (or collisions) a motor runs.

One important question is how much time is allowed between successive button presses (or impacts).

I have not tried to interpret any more of your Post.

...R

  1. Sorry, for the missed text, but yes you have it exactly. I am running the button presses 500milli or half sec. I need to know if I need to write the button inputs to count down in eeprom or ? to be stored.

  2. Then the button held for 2000milli or 2 secs or longer will reset it so you can re-enter the number of impacts from (example) 5 from 10.

  3. The sensor when activated will count (example) 5 or 10 impacts to activate the motor. I was wondering to write this as an interrupt to count against the programmed button presses or? When it reaches the set limit it resets to 0 an counts all over again to 5 or 10 to re-activate.

I'm using the reference guide an completing a round about sketch on paper to put into the sketch into play and verify it. Every time I do I get a lot of errors due to using wrong references of code. Knowing the correct references to use to write it properly is what I'm having trouble with.

imicro: 1. Sorry, for the missed text, but yes you have it exactly. I am running the button presses 500milli or half sec. I need to know if I need to write the button inputs to count down in eeprom or ? to be stored.

I don't understand what you have in mind when you mention the EEPROM What are you thinking of storing in the EEPROM? Why?

  1. Then the button held for 2000milli or 2 secs or longer will reset it so you can re-enter the number of impacts from (example) 5 from 10.

There is neat code for this sort of thing here

  1. The sensor when activated will count (example) 5 or 10 impacts to activate the motor. I was wondering to write this as an interrupt to count against the programmed button presses or?

I'm not sure what you are asking? What is the "or?" ?

When it reaches the set limit it resets to 0 an counts all over again to 5 or 10 to re-activate.

Does this mean that the smoke is issued every time it counts to the limit regardless of how short is the interval between reaching the limit?

I'm using the reference guide an completing a round about sketch on paper to put into the sketch into play and verify it. Every time I do I get a lot of errors due to using wrong references of code. Knowing the correct references to use to write it properly is what I'm having trouble with.

The most practical way to get help is to post your code with a description of what it does and what it is supposed to do. If it won't compile then also post the error messages from the compiler

It would be a huge help if you describe clearly what the overall project is.

...R