help me with arduino code to make zigbee router & zigbee coordinator & connect to PC via LAN shield?

need arduino program to happen interaction between sensor & PC via IP. Thanks.

Which zigbee module are you using; S2B or S2C?

i’m not sure. probably S2C.

If its S2C, then write a code to create serial socket connection with modules and pass one “CE” AT command to it with appropriate parameter. This parameter is used to configure module to Coordinator/Router.

I wrote a similar code in python, you can use it for reference:

import serial
import sys
import time

######### USER DATA ###########
com_port = ‘COM4’
baud_rate = 9600
###############################

Create serial connection to module

ser = serial.Serial(com_port, baud_rate, timeout=1)

while True:
cmd = raw_input("Enter Command (to quit type EXIT): ")
if cmd == ‘EXIT’:
break
count = 0

while True:
    print "Attempting to enter AT Mode"
    count += 1
    ser.write("+++")
    time.sleep(1)
    resp = ser.read(2)
    if (resp == "OK"):
        print "Successfully entered Command Mode"

        ser.write("AT" + cmd + '\r')

        print "Response from module: "
        print ser.readline()
        print "-----------------------------------------"
        break
    elif (count > 5):
        print "** Unable to enter Command Mode. Check parameters **"
        break

ser.close()