Pages: 1 [2]   Go Down
Author Topic: Help with programming a motor controller  (Read 1172 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Solution has been found for anyone else that encounters the same problem.

Code:
void setup()
{
Serial.begin(9600);
digitalWrite(3,HIGH);
pinMode(3,OUTPUT);
delay(10); // gives the motor controller plenty of time to start up
 }

void loop()
{
 //Four byte motor controller command
 Serial.write(10000000); //Start byte
 Serial.write((byte)0); //Device type
 Serial.write(00000101);// Motor number and direction 
 Serial.write(01111111);//Motor speed 0-127
}
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48569
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Solution has been found for anyone else that encounters the same problem.
I find that a little hard to believe. The documentation describes binary values for the command byte. That is NOT a binary value you are passing for the command byte. The 3rd and 4th are octal values. Why you chose base 8 when the documentation uses binary (base 2) needs explaining.
Logged

Pages: 1 [2]   Go Up
Jump to: