mirror of
https://github.com/brendanhaines/RasPi.git
synced 2024-11-09 16:44:40 -07:00
31 lines
707 B
C++
31 lines
707 B
C++
|
|
#include <iostream>
|
|
#include "wiringPi.h"
|
|
#include "PCA9685.h"
|
|
|
|
int main( int argc, const char* argv[] )
|
|
{
|
|
wiringPiSetup();
|
|
PCA9685 servo = PCA9685( 0x40 );
|
|
servo.setFrequency( 60 );
|
|
std::cout << "freq set" << std::endl;
|
|
|
|
servo.setPwm( 0, 0, 600 );
|
|
std::cout << "pwm set 600" << std::endl;
|
|
while( std::cin.get() != '\n' );
|
|
|
|
servo.setPwm( 0, 0, 150 );
|
|
std::cout << "pwm set 150" << std::endl;
|
|
while( std::cin.get() != '\n' );
|
|
|
|
while( true )
|
|
{
|
|
servo.setPwm( 0, 0, 600 );
|
|
std::cout << "pwm: 600" << std::endl;
|
|
delay( 1000 );
|
|
servo.setPwm( 0, 0, 150 );
|
|
std::cout << "pwm: 150" << std::endl;
|
|
delay( 1000 );
|
|
}
|
|
}
|