Guidance required for project

Hi all
i am looking for a few pointers to make a small piece of code,
that needs to run as fast as posible,
it is verry simple proccess to stamp a product with a solenoid valve,
once a enable button is set and a trigger has fired and maybe a delay has elapsed if needed.

i have tried a few ideas and all have stunbling blocks
the main is i cant seem to use the delay function as it stalls the proccesor
so i presume i am going to have to use the millis

secondly i canot figure out a way of doing a enable buttton (at the moment)

any pointers would be greatly apriciated

as i dare say there will be many routes to the same end


*********** The basics of the required program **********


The program needs to trigger a soilenoid via a trigger button to stamp a product,
But only stamp the product when the enable button is set,
once the enable button is pressed,and the trigger is activated it will trigger
the stamp solenoid either instantly or via a small millis delay set by a potentiometer,
The solenoid needs to be active for only 1.5 ceconds,
But once the trigger has been activated it needs to be inhibbited from
triggering again during the cycle,
once the trigger has triggered for its 1.5 seconds, a delay of 2 seconds occur
then the trigger inhibit and the enable will be reset,
and the whole prccess can be run again, once the enable button is pressed only,
the system must not trigger unless the enable button has been pressed.


Assigned pins are as follows

EnableButton on digital pin 2 Input Momentary Push button to enable
TriggerButton on digital pin 9 Input Momentary signal to trigger stamp
DelayPot on analouge input A3 Potentiometer to set delay 0 to 1 second
SolenoidStamp on digital pin 12 Output Solenoid Valve 1.5 second pulse
ReTrigger on digital pin 13 Output LED to show trigger inhhibited


What parts of the project do you have working? I should think that the mechanical part - the solenoid stamper - needs to be working first, before you program the Arduino.

I’m not sure that this needs an Arduino. Two buttons and the instruction to hold the buttons down for 1.5 seconds will probably work. At least the first prototype can work this way.

It seems like the delay() function might be appropriate for what you need to do, certainly for the first Arduino prototype.

The delay() function indeed blocks the processor from doing anything. It's just sitting at that point in the code waiting for the time to pass.

Indeed for your prototype it looks like it's enough.

loop {
  if (buttonpress()) {
    activateSolenoid();
    delay(1500);
    deactivateSolenoid();
    delay(2000)
  }
}

This is basically what you ask for.

Canoldy:
that needs to run as fast as posible,
it is verry simple proccess to stamp a product with a solenoid valve,
once a enable button is set and a trigger has fired and maybe a delay has elapsed if needed.

How many "stamps" per second do you need?

"As fast as possible" is pretty meaningless. I suspect an Arduino can operate 100 or a 1000 times faster than a solenoid valve.

...R

Robin2:
How many “stamps” per second do you need?

“As fast as possible” is pretty meaningless. I suspect an Arduino can operate 100 or a 1000 times faster than a solenoid valve.

…R

single cycle until enable button is manually pressed
with she stamp time of 1.5 see anyway its going to be 5 -10 second resetting but wont be that quick

That is very slow from the point of view of an Arduino or other microprocessor.

Canoldy:
with she stamp time of 1.5 see anyway its going to be 5 -10 second resetting but wont be that quick

I presume 1.5 means 1.5 seconds, or 2 stamps every 3 seconds.

To add to what @wvmarie has said (in case you are very new to this stuff) an Arduino would have no problem doing 2000 things per second.

...R

How are you synchronizing the part with the stamp? Are you using a conveyor? If so timing is going to be tricky.