...
The board controls the motor by running a program when the system is powered. This program writes a constant PWM value to the motor shield as follows, driving the motor:
Code Block | ||
---|---|---|
| ||
int directionPin = 12; int pwmPin = 3; int brakePin = 9; void setup() { //define pins pinMode(directionPin, OUTPUT); pinMode(pwmPin, OUTPUT); pinMode(brakePin, OUTPUT); } void loop() { digitalWrite(directionPin, HIGH); //release breaks digitalWrite(brakePin, LOW); //spin the motor analogWrite(pwmPin, 170); } |
...