Hello.I’m Chinese,so there will be many mistakes,please don’t care much.I just want to know how to use I2C in RobotC programming and how to connect V4 with ARDUINO（better with picture).And how to use something like I2C in V5 to communicate with ARDUINO.I will appreciate it if someone can answer my question.You must help me a lot,thank you.
For RobotC on the V4, check out this, specifically " Command Library - VEX Cortex" > “ROBOTC” > “I2C Commands” on the left. You’ll need to use the 4-wire port labelled “I2C” on the Cortex; I don’t remember what the pinout is for that. (If you don’t specifically need I2C, then UART is probably easier to get working).
For V5, all the smart ports use RS-485. To communicate with the Arduino, you will need an RS-485 driver such as this one, and will need to connect the A and B pins to the corresponding pins on the V5 cable. The RX and TX pins on the driver will need to connect to corresponding RX and TX for UART on the Arduino. Here is the pinout of the V5 cables by default:
This thread has example code that you can use for V5 to communicate with any other device via RS-485/UART.
Warning: the power (Vcc) pin on the V5 smart port is the battery output voltage (about 13 V), so you probably don’t want to directly connect that to any electronics; instead, either power the Arduino and RS-485 driver from something else, or use a voltage regulator to step it down.
Hopefully this is helpful for you or anyone else who finds this thread.
Thank you.But because of my poor knowledge and skill,I want to ask how to use UART in V4 ROBOTC and how to connect V4 with my ARDUINO board.And if I want to use V5 to connect with ARDUINO in the way you teached me,how should I progamming?(I use VEX Coding Studio with C++Pro )Thank you again.
And another question (may seem that I am silly but I still want to ask) :I can’t find the 4 pins V5 cable where is it ,can you send me a pictue?
That 4 pin V5 cable was probably made by him, they sell the cable and a kit, but it will not include breakout pins like that.
Here is the documentation on how to use UART with the Cortex. For V5, you can take a look at the link I sent in my last reply. I have used that code exactly to communicate between the V5 and an Arduino-based microcontroller before.
This is correct, we made our own cable for testing communications between V5 and other microcontrollers, similar to what you are suggesting.