hi! im new!
so i need help… i use the php_serial.class.php for read and write in the serial port and comunication with arduini…
but my script don’t read from arduinoo why???
this is my script php
<?php
/* Simple serial relay script for turning my sprinkler system on and off from the web!
Utilizes the PHP Serial class by Rémy Sanchez <thenux@gmail.com> (Thanks you rule!!)
to communicate with the QK108/CK1610 serial relay board!
*/
//check the GET action var to see if an action is to be performed
//Action required
//Load the serial port class
require("php_serial.class.php");
//Initialize the class
$serial = new phpSerial();
//Specify the serial port to use... in this case COM1
$serial->deviceSet("COM3");
//Set the serial port parameters. The documentation says 9600 8-N-1, so
$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"); //Device does not support flow control of any kind, so set it to none.
//Now we "open" the serial port so we can write to it
$serial->deviceOpen();
//Issue the appropriate command according to the serial relay board documentation
//to turn relay number 1 on, we issue the command
$serial->sendMessage("1");
// Or to read from
$read = $serial->readPort();
echo $read;
//We're done, so close the serial port again
$serial->deviceClose();
?>
but $read = $serial->readPort(); don’t print nothing…
this is the arduino code
void loop() {
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.write(“ricevuto”);
}
delay(1000);
}