Created
July 22, 2016 23:09
-
-
Save paulocoutinhox/3ab45e5103024b1ec86530a77c9a1fc1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
int rstPin = 8; // reset MC port | |
void setup() { | |
// configure ports and reset the MC | |
Serial1.begin(9600); | |
delay(300); | |
pinMode(rstPin, OUTPUT); | |
digitalWrite(rstPin, LOW); | |
delay(200); | |
digitalWrite(rstPin, HIGH); | |
delay(200); | |
// configure the MC | |
Serial1.write((byte)0x80); | |
delay(1); | |
Serial1.write((byte)0x02); | |
delay(1); | |
Serial1.write((byte)0x01); | |
delay(1000); | |
} | |
void loop() { | |
Serial1.write((byte)0x80); // command | |
Serial1.write((byte)0x01); // device number | |
Serial1.write((byte)0x05); // motor 2 forward | |
Serial1.write((byte)0x3F); // speed | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment