Skip to content

Instantly share code, notes, and snippets.

@mohammedhanine
Created February 8, 2013 14:06
Show Gist options
  • Save mohammedhanine/4739214 to your computer and use it in GitHub Desktop.
Save mohammedhanine/4739214 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
$_MODEM="/dev/ttyUSB1";
use Device::Modem;
my $modem = new Device::Modem( port => $_MODEM );
if ( $modem->connect( baudrate => 115200 ) ) {
$modem->echo(1);
$modem->verbose(1);
$modem->atsend( 'AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0'.Device::Modem::CR);
print $modem->answer()."\n";
$modem->atsend( 'AT+CPIN="'.$ARGV[0].'"'.Device::Modem::CR);
print $modem->answer()."\n";
$modem->atsend( 'AT+CLCK="SC",0,"'.$ARGV[0].'"'.Device::Modem::CR);
print $modem->answer()."\n";
print "\nFin de la conexion.\n\n";
} else {
print "ERROR: No encuentro el modem.\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment