New to Arduino Programming

Dear community,

I'm new to Arduino programming but I have to learn so for my capstone project at my college. What my group is creating is a Vending Machine that when one momentary button is pressed the DC motor will turn until a candy passes the motion sensor causing it to stop; only 1 motor can be active at a time if I press another button the program will ignore it. I did my research and I'm using a Elegoo MEGA 2560 R3 board with 5 L298N drivers for the 9 12V DC motors, 1 RoboJax HC-SR501 PIR sensor motion sensor, 9 momentary buttons. Here is my issue:

  1. What global variables do I have to make?
  2. Can I just make use 2 pins on the Drivers? Since the motors only need to go in one direction (in1 and in3)
  3. How do I say only one motor can be on at a time?
  4. Why do most Youtube videos never use pins 1 and 2 on the Arduino? Will I damage the board by using them?
  5. What do each pin from 0 to 13 mean?
  6. Does the Out pin for the HC-SR501 sensor have to be on pins 3 to 7 only? (Youtube again)
  7. What If statements do you need to know for the pushbutton to turn the motor on?

Like I said I'm very new to this and I'm not asking to be given the program I want to learn to do it myself for other future projects. Since covid 19 closed my campus non of the electronics buildings will answer their calls so here I am lol...

Have you looked at any of the examples in the IDE?

  1. Why do most Youtube videos never use pins 1 and 2 on the Arduino?

Did you mean pins 0 and 1, the Serial interface pins?

taijeanm:

  1. What global variables do I have to make?
  2. Can I just make use 2 pins on the Drivers? Since the motors only need to go in one direction (in1 and in3)
  3. How do I say only one motor can be on at a time?
  4. Why do most Youtube videos never use pins 1 and 2 on the Arduino? Will I damage the board by using them?
  5. What do each pin from 0 to 13 mean?
  6. Does the Out pin for the HC-SR501 sensor have to be on pins 3 to 7 only? (Youtube again)
  7. What If statements do you need to know for the pushbutton to turn the motor on?

Questions 1, 3 and 7 are impossible to answer with the sparse information you have provided.

Question 2 -- probably. Study the datasheet for the driver.

Question 4 -- already answered

Question 5 -- I don't know what you had in mind when you asked that.
To my mind they are just the numbers that you use in a program to refer to the pins

Question 6 -- I'm not familar with the HC-SR501.

Taken overall your question suggest strongly to me that you should find an online Arduino beginners tutorial and work through it so that you understand the basics before you try to take on a complex project.

...R