- Código: Seleccionar todo
doesn't claim to be a serial port at progra.pl line7
can't call method "baudrate" on an undefined value at progra.pl line8
El código es este:
Using perl Syntax Highlighting
#!C:\perl\bin\perl.exe -w
use Win32::SerialPort;
$com="COM5"; # no colon here!
$PortObj=Win32::SerialPort->new($com);
$PortObj->baudrate(9600);
$PortObj->databits(8);
$PortObj->parity("none");
$PortObj->stopbits(1);
$PortObj->handshake("none");
$PortObj->write_settings;
$Message="probando";
$PortObj->write("AT+CMGF=1 & Chr$(13)");
$PortObj->write("AT+CSCA= & Chr$(34) & 12345 & Chr$(34) & Chr$(13)");
$PortObj->write("AT+CMGS= & Chr$(34) & +5410 & Chr$(34) & Chr$(13) ");
$PortObj->write("$Message & Chr$(26) & Chr$(13)");
sleep 1; #delay for reply to be sent
$result=$PortObj->input;
print "$result";
$PortObj->close;
undef $PortObj;
exit(1);
use Win32::SerialPort;
$com="COM5"; # no colon here!
$PortObj=Win32::SerialPort->new($com);
$PortObj->baudrate(9600);
$PortObj->databits(8);
$PortObj->parity("none");
$PortObj->stopbits(1);
$PortObj->handshake("none");
$PortObj->write_settings;
$Message="probando";
$PortObj->write("AT+CMGF=1 & Chr$(13)");
$PortObj->write("AT+CSCA= & Chr$(34) & 12345 & Chr$(34) & Chr$(13)");
$PortObj->write("AT+CMGS= & Chr$(34) & +5410 & Chr$(34) & Chr$(13) ");
$PortObj->write("$Message & Chr$(26) & Chr$(13)");
sleep 1; #delay for reply to be sent
$result=$PortObj->input;
print "$result";
$PortObj->close;
undef $PortObj;
exit(1);
Coloreado en 0.004 segundos, usando GeSHi 1.0.8.4