Hardware Reference
In-Depth Information
Now, open the connection:
$serial->deviceOpen();
We can then send the following command:
$serial->sendMessage($command . "\r");
$answer = $serial->readPort();
And read the answer (that we won't use in this project):
if ($answer == "") {echo "{\"connected\": false}";}
else {echo $answer;}
Note
The code for this part is available on the GitHub repository of the project at the following
location:
https://github.com/openhomeautomation/arduino-home-automation/tree/master/chapter6
It's now time to test the interface. Please make sure that all the files of the interface are
placed inside a folder on your web server folder, and that the web server is running.
You can now open the HTML file inside the interface folder (usually by typing ht-
tp://localhost in your web browser), and this is what you should see:
Now, try to click on the ON button. You should instantly hear the relay switching, and see
the lamp that is connected to the hacked device turn on.
Search WWH ::




Custom Search