Total newbie to Arduino coding but like many I have an idea that I'd like to implement but I can't figure out if an Arduino is totally necessary and if so what the coding for it will be.
The vision: pretty simple really. I want a micro switch, that activates once a container lid is opened, which then triggers a 5v pump to run for a set amount of time. Let's say 5 seconds. The pump turns off and won't activate again until the lid is opened again. Closing the lid will not activate anything.
The question: is an Arduino necessary? Can I run the pump straight off the board? Is an "if, then" expression the best way to go about coding this?
You can do this with a relay, a 555 timer, 40175 IC, and some discrete components, but it's probably easier to use an Arduino.
Any Arduino should do the job.
Check out these tutorials: https://www.arduino.cc/en/tutorial/switch
The only reason I do not recommend the relay/switch solution by itself is that you want it to run a specific time and then not come on again until the box closes and reopens.
There's a hundred solutions to the problem, using an Arduino is a relatively easy one.