#Exception trying to set up L298N Motor controller (Solved)

1 messages · Page 1 of 1 (latest)

royal basin
#

I feel like I am swamping the general board. I am trying to get my legs under me here, but its sort of a whole new thing for me. I appreciate all the help!

I am running a really simple set of code on an ESP32.

ESP32 (ESP32-D0WD-V3 (revision v3.1)), Features WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Flash size 4MB unknown from TENX (manufacturer 0x94 device 0x16406)

My code has been reduced down to:

DCMotor motor = DCMotor.Create(PwmChannel.CreateFromPin(14), 27, 26) ;

When I push my code, I get this:

++++ Exception System.ArgumentNullException - 0x00000000 (1) ++++
++++ Message: 
++++ Iot.Device.DCMotor.DCMotor::Create [IP: 0009] ++++
++++ L298N_Testing.Program::Main [IP: 0028] ++++

I have verified all my wiring, 26 and 27 go to the input 1 and 2, 14 is connected to the Enable.

I looked at the code for the 3 wire DC motor and it throws that (at least it looks like it) if I don't provide a PWN - which I seem to be doing.

Any thoughts on this? EDIT: CreateFromPin is returning a null.

royal basin
#

I did confirm the hardware... if I deal with the GPIO directly I can spin up the fans on the controller.

royal basin
#

Exception trying to set up L298N Motor controller (Solved)

#

So I am thrilled to report I figured this one out on my own. Apparently you need to set the pin for PWM to be a PWM pin before running the sample code.

inner schooner
royal basin