arduino stuffs
Diffstat (limited to 'generated_examples/MotorTest/MotorTest.ino')
| -rw-r--r-- | generated_examples/MotorTest/MotorTest.ino | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/generated_examples/MotorTest/MotorTest.ino b/generated_examples/MotorTest/MotorTest.ino new file mode 100644 index 0000000..422335a --- /dev/null +++ b/generated_examples/MotorTest/MotorTest.ino @@ -0,0 +1,50 @@ + +void setup() +{ + + // Setup Channel A + pinMode(12, OUTPUT); // Initiates Motor Channel A pin + pinMode(9, OUTPUT); // Initiates Brake Channel A pin + + // Setup Channel B + pinMode(13, OUTPUT); // Initiates Motor Channel A pin + pinMode(8, OUTPUT); // Initiates Brake Channel A pin +} + +void loop() +{ + + // Motor A forward @ full speed + digitalWrite(12, HIGH); // Establishes forward direction of Channel A + digitalWrite(9, LOW); // Disengage the Brake for Channel A + analogWrite(3, 255); // Spins the motor on Channel A at full speed + + // Motor B backward @ half speed + digitalWrite(13, LOW); // Establishes backward direction of Channel B + digitalWrite(8, LOW); // Disengage the Brake for Channel B + analogWrite(11, 123); // Spins the motor on Channel B at half speed + + delay(3000); + + digitalWrite(9, HIGH); // Engage the Brake for Channel A + digitalWrite(9, HIGH); // Engage the Brake for Channel B + + delay(1000); + + // Motor A forward @ full speed + digitalWrite(12, LOW); // Establishes backward direction of Channel A + digitalWrite(9, LOW); // Disengage the Brake for Channel A + analogWrite(3, 123); // Spins the motor on Channel A at half speed + + // Motor B forward @ full speed + digitalWrite(13, HIGH); // Establishes forward direction of Channel B + digitalWrite(8, LOW); // Disengage the Brake for Channel B + analogWrite(11, 255); // Spins the motor on Channel B at full speed + + delay(3000); + + digitalWrite(9, HIGH); // Engage the Brake for Channel A + digitalWrite(9, HIGH); // Engage the Brake for Channel B + + delay(1000); +} |