Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run servomotor using this library #21

Open
H889761123 opened this issue Apr 11, 2015 · 1 comment
Open

run servomotor using this library #21

H889761123 opened this issue Apr 11, 2015 · 1 comment

Comments

@H889761123
Copy link

Hi
I am trying to simulate PWM by writing this code to run a servomotor

#!/usr/bin/env php
<?php

require 'vendor/autoload.php';

use PhpGpio\Gpio;
$gpio = new GPIO();
$gpio->output(18,0);
while(true)
{
$gpio->output(18,1);
usleep(1500);
$gpio->output(18,0);
usleep(2000000);
}

but the servo is not working, a similar code is written in python on this video and it is working: http://www.youtube.com/watch?v=ddlDgUymbxc&feature=youtu.be

any ideas?

@calcinai
Copy link

I suspect you'll find that sysfs isn't fast enough to toggle the pin state that quickly. You're probably better off using the hardware PWM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants