New to Arduino, apologies in advance for arduino community faux pas!


Hello and welcome.

For the power if you mean what I know as a PP3, usually used in smoke alarms, they are good for smoke alarms and not much else. A PP3 will either not power your project at all or not for very long.

For programming you need to be clear about what you are asking for, there's lots of help here plus examples in the IDE, all designed to help a beginner to learn to program. Ask us when you get stuck.

If you want someone to write code for you then click on 'report to moderator' and ask for this to be moved to 'gigs and collaborations' and indicate how much you are willing to pay.

Your first faux pas is not giving the topic a meaningful title. I suggest that you modify your post and give it a better description

All successful programs are a collection of separate parts working together. Start by writing short separate programs to learn how to get each part of your system to work - for example motor control, the push button switch and the SR04 sensors. Only try to build a composite program when you can get all the individual parts to work.

You will probably find that the example programs that come with the Arduino IDE cover most (maybe all) of the techniques you will need.

Another advantage of this approach is that it is much easier to help with short single-purpose programs.

One thing to watch out for is to avoid using the delay() function to manage timing. It's simplicity is tempting when you are starting but it is very likely to get in the way when you want to create a responsive program. Have a look at how millis() is used to manage timing without blocking in Several Things at a Time.

And see Using millis() for timing. A beginners guide if you need more explanation.

You may also like to have a look at Planning and Implementing a Program for ideas about how to structure your program when the time comes to create your complete project.