In general, Cortex supports many analog and digital sensors that work with Arduino, like the ultrasonic sensor, so you could simply connect them directly to the Cortex without a need for Arduino.
However, if you must have Arduino for some reason, then you could use Cortex UART serial port for communication.
These two threads have relevant discussion, pinouts, and code examples:
So I am trying to upload data from a cortex to a computer and read it. I hooked the UART port up to a serial-USB converter and into my computer. I use tera term to read that data but all of the characters are wrong.
This is what I get from Sending “Hello world”
?åë«::
?åë«::
?åë«::
?åë«::
?åë«::
?åë«::
…
Hello all! One of things on Team BNS we have been trying to figure out is ways of sending and receiving data on the fly to be able to better debug our robots. Our initial approach to this is to use an HC-05 Bluetooth module that connects into the extra UART port on the cortex. There are a lot of advantages to using the HC-05 module like this, such as many computers and phones have bluetooth built in, so connecting to your robot should be pretty straight forward. Additionally, being able to send data to the robot will allow for quick adjustments for things like tuning PID controllers on the fly. Finally, it’s always fun to learn about UART if you don’t know much about it yet
H]
Now what we’ve written is a small library that does two things.
First, allows you to reprogram your HC-05 module to different names/baudrates using AT Commands. This reduces the need to breakout an additional arduino or usb->uart dongle to change these internal settings.
Second, we have included a few examples on how to send and receive data over the UART port on the Vex Cortex.
Check out the library here : https://github.com/JMarple/BNSBluetooth
NOTE: I have noticed a lot of bugs with the debug stream in RobotC 4.32, it’s recommended that 4.27 is used.
To set the HC-05 into a “reprogrammable” mode, set the key pin to 5V
Here is screenshot from my phone when running the IMEBluetoothDemo.c file.
And the wiring from the HC05 to the cortex: