Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » DC motor fails to start/stop - Papyrus-RT model
DC motor fails to start/stop - Papyrus-RT model [message #1847964] Mon, 15 November 2021 13:45
Shruthi Basavaraju is currently offline Shruthi BasavarajuFriend
Messages: 4
Registered: September 2021
Junior Member
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


Thanks & Regards
Shruthi B

[Updated on: Mon, 15 November 2021 13:48]

Report message to a moderator

Previous Topic:Parallel / Distributed Execution
Next Topic:Clean termination using CTRL+C handler in Papyrus-RT
Goto Forum:
  


Current Time: Tue Oct 15 12:44:48 GMT 2024

Powered by FUDForum. Page generated in 0.08486 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top