8 years, 10 months ago.

Variable condition for Simulink StateFlow

Hi everyone!

I'm doing a project about a queue car assitance using Matlab's Simulink to generate the code and use it in the mbed compiler.

The system uses a Distance Sensor HC-SR04. Using the distance information I decide if the car should advance or not.

Distance sensor HC-SR04 uses an echo and trigger to compute de distance ( which I have correctly programmed in the compiler). I have declare the next inputs and outputs in Simulink:

Input for Controller State Machine: Trigger

Outputs: LedAdvance, LedBack, Echo

My doubt is about how to declare this distance condition to change between states in my StateFlow. The condition to change between states for example could be:

state0 ~~~~~~~ [distance>10] ~~~~~> state1

I have tried to declare 'distance' as a parameter in the Model Explorer. Do I have to declare it as another input for the Controller State Machine?

Thank you in advance!

Be the first to answer this question.