Basically I don't want to use an h bridge, I just want to protect my arduino when changing the direction of the motor.
The code i use:
void setup() {
pinMode(2, OUTPUT); // sets the digital pin 2 as output
pinMode(12, OUTPUT); // sets the digital pin 12 as output
}
void loop() {
//ROTATE TO RIGHT
digitalWrite(12, HIGH); // sets the digital pin 12 on
digitalWrite(2, LOW); // sets the digital pin 2 off
delay(1000); // waits for a second
//ROTATE TO LEFT
digitalWrite(2, HIGH); // sets the digital pin 2 on
digitalWrite(12, LOW); // sets the digital pin 12 off
delay(1000); // waits for a second
}
Scheme used:
I am using "dc motor 130" (3V-6V), I want to protect it from anything that could damage my arduino, giving it such use, and protection if the motor gets stuck, using a 1N4007 diode or resistors...