I am new to Arduino and have a small query. I am building a simple system that switches on a motor and switches it off after some time and repeats this in a loop.
The Arduino that I am using is a “DIY UNO Play Breadboard -ATMEGA328P with FT232 Breakout Board” (Rs. 825, or $12.38USD, from Mangalore). The Arduino board is similar in size to a Nano but without USB. The FT232 board has a USB B port on one end and serial pins on the other.
My query is whether I should connect the positive end of battery supply to the motor and then connect in series using a motor controller circuit to port 7 and connect the negative terminal to the gnd port.
Or do I need a separate voltage source for my Arduino, because this Arduino has no built in USB ports.
This is my code to switch on and switch off the motor:
int motorPin = 7;
pinmode(motorPin,OUTPUT);
digitalWrite(motorPin,HIGH); //turn motor on
delay(500); //wait
digitalWrite(motorPin,LOW); //turn motor off
delay(500); //wait