Skip to content

Instantly share code, notes, and snippets.

@paulocoutinhox
Created July 22, 2016 23:09
Show Gist options
  • Save paulocoutinhox/3ab45e5103024b1ec86530a77c9a1fc1 to your computer and use it in GitHub Desktop.
Save paulocoutinhox/3ab45e5103024b1ec86530a77c9a1fc1 to your computer and use it in GitHub Desktop.
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