예제 #1
1
 public function getSerial()
 {
     if (!isset(self::$_serial)) {
         $this->displayDebug('Création de l\'interface série sur le port : ' . $this->getConfiguration('port'));
         $serial = new phpSerial();
         $serial->deviceSet($this->getConfiguration('port'));
         $serial->confBaudRate(9600);
         $serial->confParity('none');
         $serial->confStopBits(1);
         $serial->confCharacterLength(8);
         $serial->confFlowControl('none');
         $serial->sendParameters("-ignbrk -hupcl -onlcr -echo -echok -echoctl -echoke");
         $serial->setValidOutputs(array('OK', 'ERROR', '+CPIN: SIM PIN', '+CPIN: READY', '>', 'COMMAND NOT SUPPORT', '+CMS ERROR: 305'));
         self::$_serial = $serial;
         $this->cleanDevice();
     }
     return self::$_serial;
 }
예제 #2
0
 function MySensorMasterCom($device)
 {
     $serial = new phpSerial();
     $serial->deviceSet($device);
     $serial->confBaudRate(115200);
     $serial->confCharacterLength(8);
     $serial->confParity("none");
     $serial->confStopBits(1);
     $serial->confFlowControl("none");
     $this->Serial = $serial;
 }
예제 #3
0
파일: index.php 프로젝트: fuho12/bochovj
function sendCommand($n)
{
    $serial = new phpSerial();
    $serial->deviceSet("/dev/ttyUSB0");
    $serial->confBaudRate(9600);
    $serial->confParity("none");
    $serial->confCharacterLength(8);
    $serial->confStopBits(1);
    $serial->confFlowControl("none");
    $serial->deviceOpen();
    $serial->sendMessage($n);
    // $read = $serial->readPort();
    $serial->deviceClose();
}
예제 #4
0
파일: dylos.php 프로젝트: woolf-wen/dylos
 function init()
 {
     $this->port = $serial = new phpSerial();
     $p = DylosReaderConf::$serialPort;
     $this->log("Opening {$p}");
     $serial->deviceSet($p);
     $serial->confBaudRate(9600);
     $serial->confParity("none");
     $serial->confCharacterLength(8);
     $serial->confStopBits(1);
     $serial->confFlowControl("none");
     // Then we need to open it
     $serial->deviceOpen();
 }
예제 #5
0
function setupSerial($device)
{
    $serial = new phpSerial();
    $serial->deviceSet($device);
    $serial->confBaudRate(9600);
    //Baud rate: 9600
    $serial->confParity("none");
    //Parity (this is the "N" in "8-N-1")
    $serial->confCharacterLength(8);
    //Character length     (this is the "8" in "8-N-1")
    $serial->confStopBits(1);
    //Stop bits (this is the "1" in "8-N-1")
    $serial->confFlowControl("none");
    $serial->deviceOpen();
    return $serial;
}
// ************************************************
// ***************** include **********************
// ************************************************
// vriski tin thessi tou auto
require_once "/root/phpscripts/position.php";
// ************************************************
// ***************** fopen **********************
// ************************************************
//fopen motor write
$serial = new phpSerial();
$serial->deviceSet($DIYmotors);
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");
// fopen for write data cloud
if (!($DIYpipecloud = fopen("/root/arduinocloud", "r+"))) {
    echo "Cannot link with sonar, wrong usb connected";
    exit;
}
// fopen for read sonar data
if (!($sensors = fopen("/dev/ttysonar", "r"))) {
    echo "Cannot link with sonar, wrong usb connected";
    exit;
}
// ************************************************
// ***************** function cloud *********
// ************************************************
//function for write data cloud
function writeCloud($data)