Engineering Kit R2 PID Closed-loop Motor Control for M4

I'm using the Engineering Kit Rev2 to build a drawing robot. I'm having trouble with the motor 2 controller (M2) on the carrier board, so I've switched to the M4 controller. However, the pidMotor closed-loop control function that Arduino provides in MatLab only works for M1 and M2 controllers. Does anyone know if there's a way I can get it to work with M4? I'm using the Nano33IoT with a motor carrier board. I'm a novice with Arduino.

You will need to provide descriptions of the devices you are using (M4, M2, M1, convey nothing meaningful), a wiring diagram, and the sketch you are using.

I have 2 12V DC motors with encoders attached to a nano carrier board. My microcontroller is a nano33IoT. Both motors work. One motor is connected to the M1 terminals and the second is connected to the M4 terminals (see image if it is showing). The M1 motor works fine. However, the software in MatLab that I am running to control the motors does not permit the use of M4.

pidML = pidMotor(carrier,2,'position',3,[0.18,0.0,0.1])

The second argument in pidMotor, 2, is the 'M' number, Only 1 and 2 are allowed. I need to use 4. I cannot get M2 to work at all. This is why I switched to M4. I hope this helps.

"M4" suggest four motors, but you mention "both"... so create a drawing that shows all the devices included.

I only use 2 motors but the nano carrier board can handle up to 4 motors. Since M2 is not working, I switched to using the M4 slot. Thanks.

Was "M2" on the shield (carrier board) used and working before this? If so, how was it configured?

I believe he's attempting to build this


Found here

Yes, M2 is on the shield and did work this past summer when I was testing the drawing robot for the class I'm teaching. However, it has stopped working when my class built and started testing the robot. The configuration did not change (except when I switched to use M4 because M2 failed).

I would try to run one motor on the questionable channel with nothing else attached to verify it is defective. I would guess a motor stalled or using too much current. "Smell" (like burnt electronics) is a good way to check for stressed circuits. Visually inspect discoloration in the area.

I do not know how to make it work again, other than taking measurements for missing voltage, or over voltage, shorts, opens, and replacing components in the path.

I will try it and see if I find something out of order. Thanks for taking the time to help me.