Created
April 7, 2016 17:28
-
-
Save Immortal-/bb8f76e0a694dade5ffcce6027e1876e to your computer and use it in GitHub Desktop.
Using Onion Omega's GPIO using 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 | |
//When I get bored again Ill turn this into a library. | |
function SetIO($pin, $value) | |
{ | |
exec("fast-gpio set $pin $value 2>&1", $output); | |
return explode(': ',$output[0])[1]; | |
} | |
function ReadIO($pin) | |
{ | |
exec("fast-gpio read $pin 2>&1", $output); | |
return explode(': ',$output[0])[1]; | |
} | |
function SetPWM($pin, $hZ, $dutyCyclePercent) | |
{ | |
exec("fast-gpio pwm $pin $hZ $dutyCyclePercent 2>&1", $output); | |
return explode(': ',$output[0])[1]; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment