Hello,
I am using L298N driver with Raspberry pi 4B to run DC motors. In my Papyrus-RT model I am using the following code
Initial block:
wiringPiSetup();
// initializing motor
pinMode(PIN_IN3, OUTPUT);
pinMode(PIN_IN4, OUTPUT);
softPwmCreate(PIN_MOTOR, 0, 100);
The immediate state following initial block has:
digitalWrite(PIN_IN3,1);
digitalWrite(PIN_IN4,0);
softPwmWrite(PIN_MOTOR, MOTOR_SPEED);
And to stop the motor :
softPwmWrite(PIN_MOTOR, 0);
I have attached the capsule image for reference. I am using multiple motors and this particular motor is connected to the IN3,IN4 and ENB of the L298N motor driver and has unpredictable behavior. It starts and stops sometimes, and sometimes it doesn't. But the motor connected to IN1, IN2 and ENA gets initialized and starts properly but sometimes doesn't terminate so , I need to add a final state or some way to handle the termination of the model. The motor doesn't always stop when the Papyrus-RT model is terminated.
I tried running it separately with standalone Python code and it worked perfectly fine. Any input or feedback will be highly appreciated.
Thanks
Shruthi
[Updated on: Mon, 15 November 2021 13:48]
Report message to a moderator