Main Site Documentation

Motor driver


Dear users, dear admins,

Finally my Domino arrived… :slight_smile: But I ran into a little problem. My distributor only had this motor driver in stock:

But, the hobbyist as I am, I ordered it to try to get it to work with your driver. The first problem I ran into is that the board has this hardware setup:

So I will have to change the pin outs in the driver you supply for your own motor shield.

So far no problem, but as soon as I add the motor shield driver I get these errors:

Which applies to the following lines of code:

_pwm1 = new PWM((byte)FEZ_Pin.PWM.Di5);

_pwm2 = new PWM((byte)FEZ_Pin.PWM.Di6);

What is going on with the driver? Is it a simple error?

Thanks for your time and great product!:smiley:


Look at page 57 in the book where it shows how PWM work :slight_smile:

This is in book

PWM pwm = new PWM((PWM.Pin)FEZ_Pin.PWM.LED);

This is your code

_pwm1 = new PWM((byte)FEZ_Pin.PWM.Di5);

I think our file driver example is outdated and needs updating. Can you give me a link to the file you are using so we can fix it please?


I think I know what file you used. The problem is fixed. Please download the new file


thanks for your fast, and professional, response! The drives is error-free now! :smiley:

Might it be possible for you to create a driver for the other motor shield too? I cannot get it to work…

Thanks again! Great support!


We actually have the same shield you are using in the office and it worked just fine. I am not sure why it didn’t work for you :frowning: You seem to have done it right…you only need to see where the pins are at and change the IOs to be what you shield needs.


So you changed

_pwm1 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di5);

_dir1 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di4, false);

_pwm2 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di6);

_dir2 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di7, false);


_pwm1 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di12);

_dir1 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di3, false);

_pwm2 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di11);

_dir2 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di13, false);

? Or am I wrong?


No! Can you help me see where these numbers came from?

I looked up the motor shield you are using and the one of the required PWM pin is not connected to a PWM hardware on FEZ Domino. You will have 2 options, to use OutputCompare then you can generate PWM on any pin but you have to do major changes on the code or you add a wire from a PWM signal to the pin you need…

Before you do any of this, you can control one of the motors just fine with what you have.
Look here
(this is a very bad made schematics but…) PWMA is connected to Di10 and direction is controlled with Di12. Now set these correctly in your code and you will be able to control one of the motor…once that is done ten we can talk about options to run the second one :slight_smile:

Can you please add a Wiki page on what you are doing with this shield so other users can benefit from this in future?
(link removed)

_pwm1 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di10);

_dir1 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di12, false);

_pwm2 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di8);//set it to anything for now

_dir2 = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di9, false);//set it to anything for now


Works fine now ! (motor1)

About the second one: I think it’s best to add a wire to the pin to the correct PWM port.

If I’m right, I should solder a wire from pin 11 (motor shield) to pin 9 (fez domino) ?

Thanks again, you have been a great help!

P.s. if it works, I will add a wiki page for this shield.


Now, you can solve the second motor in software or in hardware :slight_smile:
It is better to solve in hardware so there is less resources used on FEZ but either one will work.

You can add a wire between pin 11 which is needed for the shield and any PWM pin on FEZ Domino, like Di8 or Di9.

You have to be careful when connecting those 2 pins. If you run a wire from any PWM to Di11 then you can no longer use Di11 (2 outputs on same wire and you will damage your FEZ)
How to solve this? You will need to cut the pin on your shield going to Di11 so ti is no longer connected to FEZ Domino…you can bend the pin instead of cutting it.


It works perfectly now! :smiley:

Pin 9 should be connected to pin 11. Both motors work flawlessly.

Thanks a lot for your help! The wiki page will be made in the next few days!:wink:


We have added new categories for motors