I'm trying to develop a PID controller with Simulink as shown in the image PID. I'm using a PID controller to control a motor via an Arduino Uno and motor driver.
I have the PID output connected to an if statement.
- If u1 is larger than 0 then output 1 for digital output pin 2 and output 0 for digital output pin 4.
- If u1 is smaller than 0 then output 0 for digital output pin 2 and output 1 for digital output pin 4.
This changes the direction of the motor so that if the PID overshoots it will change direction. And so on for u1 is smaller than 0.
I also have the PWM signal for the speed of the actuator from 0 being the slowest and 255 as the fastest. I forgot to fix the label for it.
I keep getting an error when I try to run it. The error says that I can't run it because of having multiple digital output blocks with the same pin as shown in this image Error in Simulink.
Is there a solution for this?