About the pins:
As you can see in the picture above tha pin number 1, 16 and 9 are for Arduino 5v.
- Pin number 2 is to control the motor and according to my sketch it is pin number 2 in Arduino aswel.
- Pin number 3 and 6 are for motor.
- Pin number 4, 5, 12 and 13 are for Arduino GND and GND (-) of external power aswel.
- Pin number 8 is only positive (+) of external power.
int motor = 2; void setup() { // initialize the digital pin as an output. pinMode(motor, OUTPUT); pinMode(motor, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(motor, HIGH); // turn the motor on. delay(5); // wait for miliseconds digitalWrite(motor, LOW); // turn the motor off. delay(500); } |
The yellow highlighted number is the duration of motor given power from the external battery.
And the green highlighted number is the duration when motor will not spin and of course you can change these numbers to make the motor spin faster and slower.
No comments:
Post a Comment