Arduino RC project



I am workig on a RC battlebot for RoboDojo inspired cardboard Battlebot workshop.

The RC to Adruino shield has already been coded, but for the 2 bus L293D Motor shield. I am testing the code on the old Adafruit V1 shield 4 bus shield. The RC code after remapping the pins works fine. The motors are not moving.

I think I have remapped the pins (the code has different assumptions, I assume the motor enable pin is the PWN. However I not by nature or temprement a coder so I could have left some stupidity in there.

Eventually this will be mute as I will move from a Mega and 4 bus to a Nano and 2 bus and I can cut and paste the code without change. I just want to know what I am doing and learn from the cuts and burns :smile:


Hi voradams
Yes it is most common to use pwm to enable pins to control motor speed.
As long as you are wireing the same pins as you are coding for you will be fine, you will need to check the specs of the L293D shield you are using.
If you were using a L293D breakout board (or making your own) you could save yourself a digital pin by using a 2 input NAND gate chip. The motor1_pin1 would go to both the inputs of the NAND gate and also the one of the inputs of the L293D. The output of the NAND gate would go to the other input of the L293D. The output of the NAND will always be opposite to the input of the NAND. Therefore the input 1 of the L293D would always be opposite to the input 2 of the L293D.

When you change to using a Nano will you still be using shields or will you be migrating to breakout boards?

I haven’t checked through all your code (I find that difficult without the same/similar hardware setup to debug on). I tend to use an ammeter to check the power draw and led’s instead of motors to see what is happening( the shield probably has these already).

Hope this helps.