After implementing a python-script that changes duty-cycle for a LED like in this example:
http://raspi.tv/2013/rpi-gpio-0-5-2a-now-has-software-pwm-how-to-use-it
I would like to change duty-cycle in the shell or console, what commands and in what order do they have to be keyed in?
I've done little research so far that brought me to a similar example done with python like in the link above. I also know how to execute console-commands in PHP.
My intention is to take advantage of console-commands to control the brightness of a LED that is triggered by a AJAX To PHP Request. I do not want to execute a python-script in PHP because of right-privileges on Apache2-Server having to be adjusted.
Thanks in advance.
In the meanwhile there is the possibility of directly sending PWM signals with PHP using the php-pigpio library, which is an interface for the Pigpio daemon
Pulse width:
Sending an PWM signal with a pulse width of 1500 microseconds on GPIO pin 15:
use Volantus\Pigpio\Client;
use Volantus\Pigpio\PWM\PwmSender;
$client = new Client();
$sender = new PwmSender($client);
$sender->setPulseWidth(15, 1500);
Duty cycle:
Of if you prefer the duty cycle / range mode (as in your own example):
Setting the range to 1024:
$sender->setRange(15, 1024);
Sending a signal of 50%:
$sender->setDutyCycle(15, 512);