Last active
February 28, 2020 18:34
-
-
Save samilkorkmaz/2197238805de7a510db6a161fb3c42da to your computer and use it in GitHub Desktop.
Robolink Rodeo robot motor test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Robolink Rodeo robot motor test. | |
//Robot purchase link: https://www.robolinkmarket.com/arama?q=rodeo | |
//dMoto image link: https://www.robolinkmarket.com/dmoto-robot-kontrol-karti-lite-robotik-kartlar-robolink-teknoloji-11048-62-B.jpg | |
const int m1Dir = 2; //m1: Left motor | |
const int m2Dir = 7; //m2: Right motor | |
const int m1En = 5; | |
const int m2En = 6; | |
const int speed = 100; | |
void setup() { | |
pinMode(m1Dir, OUTPUT); | |
pinMode(m2Dir, OUTPUT); | |
pinMode(m1En , OUTPUT); | |
pinMode(m2En, OUTPUT); | |
Serial.begin(9600); | |
} | |
void testMotor(int mDir, int mEn) { | |
Serial.println("Forward for 3s..."); | |
digitalWrite(mDir, HIGH); | |
analogWrite(mEn, speed); | |
delay(3000); | |
Serial.println("Stop for 1s..."); | |
analogWrite(mEn, 0); | |
delay(1000); | |
Serial.println("Backward for 3s..."); | |
digitalWrite(mDir, LOW); | |
analogWrite(mEn, speed); | |
delay(3000); | |
analogWrite(mEn, 0); | |
} | |
void loop() { | |
Serial.println("*** Motor 1 (left) tests ***"); | |
testMotor(m1Dir, m1En); | |
Serial.println("*** Motor 2 (right) tests ***"); | |
testMotor(m2Dir, m2En); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment