Created
August 30, 2018 10:06
-
-
Save erikaheidi/8ae418c25f0a632a1da17bf017425a0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
$serial = new PhpSerial(); | |
$serial->deviceSet("/dev/ttyUSB0"); | |
$serial->confBaudRate(19200); | |
$serial->confParity("none"); | |
$serial->confCharacterLength(8); | |
$serial->confStopBits(1); | |
$serial->confFlowControl("none"); | |
$serial->deviceOpen(); | |
echo "Initializing device..."; | |
sleep(10); | |
echo "Now sending message..."; | |
$serial->sendMessage("PHP and Arduino\n"); | |
sleep(2); | |
$serial->deviceClose(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment