Hello everyone I am newbie and I hope I've posted this at the correct section.
I don't know anything about coding ,just watching videos and trying to understand how to programing arduino.
I would like to use a trigger board I got from an airsoft gun as input fro arduino nano.
This trigger board has mounted 3 pushbuttons, which they have a common supply cable and three return seperate cables one for each button. I think normal the arduino will have 3 inputs and 1 output.
Let's name these buttons as: B1 B2 B3 .
B1 = the trigger = when pressed arduino should output to drive a mosfet what drivers a dc motor.
B3 = fire mode selection between , Semi and Full auto. = this is going to be permanent pressed or unpressed to define Fire modes. When pressed it should totally ignore the state of B2 (because B2 is going to be mechanically engaged all the time) or think that B2 is never engaged to create the Full auto mode, and when unpressed it should let the B2 be readed. (because B2 is going to be mechanically engaged all the time)
B2 = cutoff lever = this is a mechanical moving lever that engages once on each gearbox full cycle. This creates the Semi fire mode or 3 round Burst mode for example.
The code has to be like :
If B3 is engaged , then when B1 is pressed it should output until B1 gets released from user/ unpressed and ingore B2.
If B3 is dissengaged , then when B1 is pressed it should output as long as B1 is being pressed but output not longer until B2 is pressed once from the gears..so the gearbox it will make only one cycle.
Also if B1 is still pressed after B2 has been engaged once, then the output should be interrupted until B1 is unpressed. So if I keep pressing the trigger the gearbox it should not operate to have the Single shot mode .
Coincidence issue sometimes the gears may stop on the B2 pressed, so the gearbox will not rotate until i change to full auto ,fire once, and then back to semi again, on the Semi mode if B2 stays pressed for more than 0.010 second ignore it.
{Extra: Burst mode = If B1 is pressed for 5 seconds, then when in Full auto/ B3 engaged, then B2 is not totally ignored but count 3 presses and at 3rd press cuts the output until B1 is unpressed same as before.
If B1 is pressed 5 seconds again, the Full auto goes back on/or totally ignore B2 again }.
I wonder if someone can compile a code for this operation and how hard is it to happen at first excluding the burst mode.
Wiring and powering is not problem for me but the code it is.
Thank you in advance everybody.