I need to send ascii text from my X4 gateway to a zb rs232 module. The ZB Rs232 module (I would like to use the XBIBI dev board) will be communicating with a basic stamp PIC. I was trying to set up the device in the dia software. I am having some trouble setting up the yml file. driver: devices.xbee.xbee_devices.xbee_serial:XBeeSerial. Can anyone share an example of how I could send “Hello world” from my X4 gateway to the rs232 module.
I figured something out. I downloaded the iDigi ESP programming suite. It had a device preloaded called XBee Serial Terminal. It created the yml file for me. Then I created a VB.Net routine to write my string “Hello World” to the digi CLI. I set up a hyperterminal connection with the USB XBIB-U dev board. I was able to send “Hello World” from the X4 to the Xbee radio module, and it printed out on the computer screen. Very cool!
I hope this post can help someone else. I know I need a lot of help.
Here is the YML file
devices:
-
name: xbee_device_manager
driver: devices.xbee.xbee_device_manager.xbee_device_manager:XBeeDeviceManager -
name: OE409
driver: devices.xbee.xbee_devices.xbee_xbib:XBeeXBIB
settings:
xbee_device_manager: “xbee_device_manager”
extended_address: “00:13:a2:00:40:62:d7:f0!” -
name: Pager1
driver: devices.xbee.xbee_devices.xbee_serial_terminal:XBeeSerialTerminal
settings:
xbee_device_manager: “xbee_device_manager”
extended_address: “00:13:a2:00:40:62:92:41!”
presentations:
-
name: rci
driver: presentations.rci.rci_handler:RCIHandler -
name: idigi_db
driver: presentations.idigi_db.idigi_db:iDigi_DB
settings:
interval: 5
sample_threshold: 20
collection: “collection_name”
filename: “file_name” -
name: console0
driver: presentations.console.console:Console -
name: web0
driver: presentations.web.web:Web
settings:
page: “idigi_dia.html”
Here is the vb.net code
Private Sub SendPage(ByRef DataReturned As String, ByVal X4_Ip As String)
Try
Dim x As Integer = 0
Dim tcpClient As New System.Net.Sockets.TcpClient()
tcpClient.Connect(X4_Ip, 4146)
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim Sendbytes As Byte
Dim bytes() As Byte
If networkStream.CanWrite And networkStream.CanRead Then
Sendbytes = Encoding.ASCII.GetBytes("channel_set Pager1.write Hello_World" & vbCr)
networkStream.Write(Sendbytes, 0, Sendbytes.Length)
ReDim bytes(tcpClient.ReceiveBufferSize)
Wait(1000)
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
DataReturned = Encoding.ASCII.GetString(bytes)
Else
DataReturned = "NO DATA"
End If
tcpClient.Close()
Catch
End Try
End Sub