-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Description
I'm trying to make a gcode sender in PHP and testing some sends i got that error just with some numbers...
This is what i received:
**Enviado: G0x50.0
Recebido:
ok
Enviado: G0x40.0
Recebido:
error: Bad number format
Enviado: G0x50.3
Recebido:
ok**
That's my code:
<?php
// echo chr(10);
include "PHP-Serial/src/PhpSerial.php";
exec("mode COM8 BAUD=57600 PARITY=N data=8 stop=1 xon=off");
$serial = new phpSerial();
$serial->deviceSet("COM8");
$serial->confBaudRate(57600); //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();
sleep(3);
if (ob_get_level() == 0) ob_start(); //Inicia o Buffer
$read = $serial->readPort();
echo "<pre>".$read."</pre>";
ob_flush(); //Start Buffer
flush(); //Send Buff
$gcode[] = "G0x50.0\n";
$gcode[] = "G0x40.0\n";
$gcode[] = "G0x50.3\n";
foreach ($gcode as $line) {
echo "Enviado: " . $line . "</br>";
$serial->sendMessage($line);
$read = $serial->readPort();
echo "Recebido: <pre>" . $read . "</pre>";
ob_flush();
flush();
if(!$read == "ok"){
$serial->deviceClose();
die($read);
}
}
Metadata
Metadata
Assignees
Labels
No labels