Here is the code...
Code: Select all
byte incoming1;
byte incoming2;
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
incoming1 = Serial.read();
incoming2 = Serial.read();
if (incoming1 == 1)
{
digitalWrite(13, HIGH);
delay (900);
}
if (incoming2 == 2)
{
digitalWrite(13, LOW);
delay(900);
}
}
}
Here is the PHP code...
Code: Select all
<?php
require("php_serial.class.php");
$serial = new phpSerial();
$serial->deviceSet("COM2");
$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();
$serial->sendMessage("1");
$serial->deviceClose();
?>