Created
March 30, 2012 13:03
-
-
Save priithansen/2251372 to your computer and use it in GitHub Desktop.
Makibot php
This file contains 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 | |
include "php_serial.class.php"; | |
$go = $_GET["go"]; | |
// Let's start the class | |
$serial = new phpSerial; | |
// First we must specify the device. This works on both linux and windows (if | |
// your linux serial device is /dev/ttyS0 for COM1, etc) | |
$serial->deviceSet("/dev/cu.usbserial-A4007mX9"); | |
// We can change the baud rate, parity, length, stop bits, flow control | |
$serial->confBaudRate(9600); | |
$serial->confParity("none"); | |
$serial->confCharacterLength(8); | |
$serial->confStopBits(1); | |
$serial->confFlowControl("none"); | |
// Then we need to open it | |
$serial->deviceOpen(); | |
// To write into | |
$serial->sendMessage($go); | |
// Or to read from | |
//$read = $serial->readPort(); | |
// If you want to change the configuration, the device must be closed | |
$serial->deviceClose(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment