Hardware Reference
In-Depth Information
$serial = new phpSerial;
$serial->deviceSet($serial_port);
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
Now, you can actually open the connection:
$serial->deviceOpen();
We can now send the command and read the answer:
$serial->sendMessage($command . "\r");
$answer = $serial->readPort();
Now, we close the serial connection:
$serial->deviceClose();
Finally, we send back the data that was read:
echo $answer;
We are now ready to test our project. You can of course find all the code for this part on
the GitHub repository of the project at the following website:
https://github.com/openhomeautomation/arduino-home-automation/tree/master/chapter1
Make sure that your web server is running, and that all the files of the project are placed
inside a folder in your web server's main folder. You can now head over to this folder,
usually accessible by typing localhost in your favorite web browser. Open the HTML
file, and you should see something similar to the following screenshot:
Search WWH ::




Custom Search