Ultrasonic distance sensor with Simulink and Arduino Uno, and Realtime coder

Hi all,

I want to implement some Simulink state flow model in Arduino Uno. For this purpose, I added the Simulink Support Package for Arduino through which I have tested writing a basic blink program to my Arduino Uno using the ON and OFF through a State Flow model. Also, some code is generated by realtime coder.

Now I want to add an Ultrasonic Distance Sensor to this setup. Since the distance sensor requires the pulseIn function to count the duration of pulse, this function is not available in the Simulink Support Package for Arduino. So I thought I can generate the code from Simulink and then use the Arduino IDE to integrate the code generated from Simulink with the Distance Sensor code. The problem is, how do I integrate? The Simulink generates a bunch of .c files alongwith header files, how do I integrate these in the Arduino IDE specifically in the setup() and the loop() functions?

Any help is appreciated.

Abubakar