Skip to content

Instantly share code, notes, and snippets.

@dewski
Forked from atypical/teleduino.php
Created April 27, 2012 20:13
Show Gist options
  • Save dewski/2512564 to your computer and use it in GitHub Desktop.
Save dewski/2512564 to your computer and use it in GitHub Desktop.
teleduino
<?php
include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'_config.php');
include_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'teleduino328_php.php');
if(isset($_SERVER['HTTP_HOST']))
{
echo "<pre>";
}
$Teleduino328PHP = new Teleduino328PHP();
$Teleduino328PHP->setModeEthernetClientProxy($config['ethernet_client_proxy_key']);
echo "defineServo:\n";
$servo = 0; // Servo (0 - 5)
$pin = 3; // Servo pin (0 - 21)
$result = $Teleduino328PHP->defineServo($servo, $pin);
echo print_r($result, true)."\n";
echo "setServo:\n";
$servo = isset($_GET['servo']) ? ((int) $_GET['servo']) : 0; // Servo (0 - 5)
$position = isset($_GET['position']) ? ((int) $_GET['position']) : 180; // Servo position (0 - 180)
$result = $Teleduino328PHP->setServo($servo, $position);
echo print_r($result, true)."\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment