Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //g++ -o camara camara.cc -lwiringPi -lpthread
- #include <iostream>
- #include <wiringPi.h>
- #include <softPwm.h>
- using namespace std;
- #define BARRIERE0 26//pwm0 BCM12 PIN 32
- #define INIT_VALUE 4//Valeur initial servo moteur
- #define RANGE 200//Valeur final servo moteur
- int main (){
- int degrees0(4);
- int degrees1(4);
- if (wiringPiSetup()==-1 ) {cout <<"Erreur !"<<endl;return 1;}
- softPwmCreate(BARRIERE0,INIT_VALUE,RANGE);
- delay(10);
- while (TRUE){
- degrees0+=1;
- cout<<degrees0<<endl;
- if (degrees0>=26){degrees0=4;delay(2000);}
- if (degrees0>RANGE/10 ){degrees0=3;}
- softPwmWrite(BARRIERE0,degrees0);
- delay(1000);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement