# Pololu Low Voltage Dual serial motor Controller programming help !

**URL:** <https://forum.arduino.cc/t/pololu-low-voltage-dual-serial-motor-controller-programming-help/50377>\
**Category:** Motors, Mechanics, Power and CNC\
**Created:** [January 28, 2011, 5:05pm UTC](https://forum.arduino.cc/t/pololu-low-voltage-dual-serial-motor-controller-programming-help/50377 "2011-01-28T17:05:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [January 28, 2011, 5:05pm UTC](https://forum.arduino.cc/t/pololu-low-voltage-dual-serial-motor-controller-programming-help/50377/1 "2011-01-28T17:05:43Z")

</div>

I am having a problem with programming my pololu Low voltage dual serial motor controller

> **[Pololu Low-Voltage Dual Serial Motor Controller](https://www.pololu.com/product/120)**
>
> Frustrated by those cheap, low-voltage motors that require too much current? Here’s the answer: a low-voltage motor controller designed specifically for those toy motors. With all of the convenience of the Pololu dual serial motor controllers and the...

if anyone could find what is wrong with my code that would be awesome, it has no compling issuses but it cant drive any motors.  
Below is my code

int rstPin = 2; // Reset Port connected to digital pin 2

void setup() {  
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps  
pinMode(rstPin, OUTPUT); // sets the digital reset pin as output

Serial.write((byte)0x80);  
Serial.write((byte)0x02);  
Serial.write((byte)02000000);  
delay; 1000;  
}

void loop() {

digitalWrite(rstPin, HIGH); // sets the sets rst pin on full to continue

Serial.write((byte)0x80);  
Serial.write((byte)0x00);  
Serial.write((byte)00000011);  
Serial.write((byte)0x7F);

}

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [January 28, 2011, 9:32pm UTC](https://forum.arduino.cc/t/pololu-low-voltage-dual-serial-motor-controller-programming-help/50377/2 "2011-01-28T21:32:55Z")

</div>

I think some of your problem is that you are confusing Octal constants with binary constants...

## The numbers that appear doubtful in your sketch are

## 02000000 = very octal large number that will not fit in a byte - i do not know what was intended here :( (but I think it will set the controller to expect two motors, called 0 and 1).

00000011 is an octal constant, that looks like it was meant to be binary.

## i think your sketch might work better with B00000011 instead to indicate the number is in binary.

I am not sure, but I think that you should set the reset pin in setup() and not change it afterwards.

Hope this helps, and that if you do read the below it does not confuse you.

Regards Dafid

=========================================

In C (and C++ ) a number (for example 255 the largest byte value) can be:

Decimal (base 10 ) - is digits starting with 1 2 3 4 5 6 7 8 or 9 so 255 = 2_10_10 + 5_10 + 5  
Octal (base 8 ) - is made up of digits 0 to 7, starting with 0 so 0177 = 1_8_8 + 7_8 + 7  
HEX (base 16 ) - is made up of 0-9 plus a-f, starting with 0x so 0xff = 15\*16 + 15  
(a=10, b=11, c=12,..., f=15 )

There is no binary in standard C or C++, but there is in Arduino :)

Binary (base 2) - is digits either 0 or 1 starting with a B, so 255 = B11111111 = 1_128+1_64+1_32+1_16+1_8+1_4+1\*2+1

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 12, 2011, 5:49pm UTC](https://forum.arduino.cc/t/pololu-low-voltage-dual-serial-motor-controller-programming-help/50377/3 "2011-06-12T17:49:44Z")

</div>

You didn't read the manual properly ( bottem of page 7 of manual), you must flash the reset line after initialisation.  
Also a while(1) at the end of your void loop would help with testing. Also check your wiring again. It took a whole rainy Sunday afternoon but I got mine working, eventually. Here is my code.

#include \<SoftwareSerial.h\>

#define txmotor 1  
#define rxmotor 0  
#define resmotor 4  
SoftwareSerial motors = SoftwareSerial (txmotor, rxmotor);

void setup()  
{  
delay(20);  
pinMode (resmotor, OUTPUT);  
Serial.begin(9600);  
digitalWrite(resmotor, HIGH);  
delay(20);  
Serial.print(128,BYTE);  
Serial.print(2,BYTE);  
Serial.print(2,BYTE);  
delay(20);  
mflash();  
}  
void loop()  
{

mforwards(); // or use mbackwards or mrotright or mrotleft

while(1);  
}

void mforwards()  
{  
mflash();  
byte movement[] = {128,0,5,127,128,0,7,127};  
for (int i=0; i\<sizeof(movement); i++) {  
Serial.print(movement\*,BYTE);\*  
_}_  
_}_  
_void mbackwards()_  
_{_  
_mflash();_  
_byte movement[] = {128,0,4,127,128,0,6,127};_  
_for (int i=0; i\<sizeof(movement); i++) {_  
\_ Serial.print(movement\*,BYTE);_\_  
\__}_\_  
\__}_\_  
 void mrotright()  
\__{_\_  
 mflash();  
 byte movement[] = {128,0,4,127,128,0,7,127};  
 for (int i=0; i\<sizeof(movement); i++) {  
 \_ Serial.print(movement,BYTE);  
 }  
 }  
 void mrotleft()  
 {  
 mflash();  
 byte movement[] = {128,0,5,127,128,0,6,127};  
 for (int i=0; i\<sizeof(movement); i++) {  
  Serial.print(movement,BYTE);  
 }  
 }  
 void mflash()  
 {  
 digitalWrite(resmotor, LOW);  
 delay(20);  
 digitalWrite(resmotor, HIGH);  
 delay(20);  
 }\*\__

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 4:29am UTC](https://forum.arduino.cc/t/pololu-low-voltage-dual-serial-motor-controller-programming-help/50377/4 "2021-05-06T04:29:12Z")

</div>


