comunicación con XBee

hello I need help please it is urgent

I have doubt about the programing in robotC

I have a vex cortex and I want communication between vex cortex PC

I have two xbee 51 pro and I can’t do communication between they

this is the program that I used

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma config(UART_Usage, UART2, uartXBeeZigBee, baudRate9600, IOPins, None, None)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{

while (1==1)
{

sendChar(uartTwo,‘1’);
char p=getChar(uartTwo);
if (p==1)
{
sendChar(uartTwo,‘2’);
}
if (p==49)
{
sendChar(uartTwo,‘3’);
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

what is bad in my program? help me please. it’s a project of school

I think this is where I got this code.

https://vexforum.com/t/vex-and-the-xbee-radio/22507/1

Are your Xbee radios communicating with each other properly? The XCTU utility can help make sure the radios are configured to talk to each other and at 9600 baud. Then you can get the Cortex to talk to the PC.

Inside the main there are some set up tasks that are handling the XBee. You initialize the serial port (UART2) and then have tasks for polling the serial port for transmit and receive (TxString and RxString)

	initSerialPort (); 
	wait10Msec(100);
	StartTask(TxString);
	StartTask(RxString);
	wait10Msec(100);

Then you fill in the variable sOutgoing and it will be sent to the XBee.

When it gets something, it fills in sIncoming variable.
xBeeLogging.zip (3.82 KB)