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