Ultrasonic Sensor

I am using EasyC V4 for Cortex and have the latest mastercode. I am trying to test my Ultrasonic Range Finder. When I run the Ultrasonic Test sample code, this message appears in the terminal window:

“Ultrasonic sensor on echo port 1, ping port 2 timed out, check the connections”

One of the ultrasonic sensor wires is connected into digital input port 1, and the other is connected into digital output port 2

I’ve tried:
switching the wires in digital ports 1 and 2,
using another ultrasonic sensor,
trying different ports that I know work
putting the digital input wire into an analog port

None of these methods have worked. The same message shows no matter what I do. Even when I unplug the input or the output wire, the same message shows. I don’t think this is the programming because I tried using Intelitek’s sample code called “Ultrasonic Test”.

Please help right away!
-Mathew Nguyen

Your getting the error because port 2 is a digital input. Either hit F5 and set it has an output or choose ports 10 or higher as the output port.

No, I already changed port 2 to a digital output. Port 2 also shows up when I set the output port for the Ultrasonic sensor so that isn’t the problem. No matter where I plug in the ultrasonic sensor, the same error shows up.

Try using the Ultrasonic Test program in the Samples as-is. Also, make sure the Cortex controller is turned on, with a charged battery or the Ultrasonic sensor won’t work.