Thursday, December 11, 2014

Code #2 for DC Motor


int motorPin = 9;
void setup() {
 pinMode(motorPin, OUTPUT);
}
void loop() {
 digitalWrite(motorPin, HIGH);
 delay(1000);
 digitalWrite(motorPin, LOW);
 delay(1000);



This code will run and stop the motor after 1 second.


Thanks to http://www.dummies.com/how-to/content/how-to-spin-a-dc-motor-with-the-arduino.html

Priyank

No comments:

Post a Comment