I am trying to simply send a message to another XBee device using the XBee module. I have cut and paste from the module page but cannot get past the simple error below.
syntax error at moduletest.pl line 12, near ") {"
Execution of moduletest.pl aborted due to compilation errors.
Also, does anyone have some working code to send data to and from XBees? Perl examples seem to be non existent : (
use strict;
use Win32::SerialPort;
use Device::XBee::API;
use Data::Dumper;
my $rx;
my $serial_port_device = Win32::SerialPort->start ("tpj4.cfg") || die;
my $api = Device::XBee::API->new( { fh => $serial_port_device } ) ||
+die $!;
if ( !$api->tx( { sh => 0, sl => 0 }, 'hello world!' ) {
die "Transmit failed!";
}
$rx = $api->rx();
die Dumper($rx);
Using the following for tpj4.cfg
Win32::SerialPort_Configuration_File -- DO NOT EDIT --
\\.\COM3
CFG_1,none
eol,10
clear,-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@-
RCONST,1000
istrip,0
CFG_2,none
XOFFCHAR,19
PARITY_EN,0
WCONST,200
intr,3
U_MSG,1
STOP,1
XONLIM,2048
erase,8
XONCHAR,17
BINARY,1
RTOT,0
echonl,0
XOFFLIM,512
icrnl,0
inlcr,0
READBUF,4096
igncr,0
EOFCHAR,0
WRITEBUF,0
RINT,4294967295
ocrnl,0
bsdel,
opost,0
echoke,1
PARITY,none
HNAME,localhost
echoctl,0
CFG_3,none
EVTCHAR,0
icanon,0
isig,0
HADDR,0
E_MSG,1
DATA,8
DVTYPE,none
echo,0
quit,4
s_eof,26
s_kill,21
ERRCHAR,0
onlcr,1
ALIAS,COM3
HSHAKE,none
DATYPE,raw
echok,1
echoe,1
BAUD,57600
WTOT,10