I’m trying to develop a proximity indicator using HC-SR04 ultrasonic sensor and LEDs on arduino mega 2560. I have an idea on how to implement it using normal coding, but i’m asked to develop using simulink modelling. I want to control the brightness of the LED(by PWM) depending on the proximity of objects to the sensor(Max brightness for Max proximity). But I’m finding trouble modelling the ultrasonic sensor in simulink, mainly to find a logical implementation for PulseIn(), to calculate the time of the HIGH pulse from the sensor. I checked similar cases in forums, no one has come up with a clear cut solution. Any input towards how to solve this?? Any hint regarding this would be really helpful.
Thanks in advance!