呼吸灯
树梅派PWM脉冲
#include<iostream>
#include<wiringPi.h>
#include<softPwm.h>
using namespace std;
int main(){
const int gpio7 = 7;//wPin
while(-1 == wiringPiSetup()){
cout << "error" << endl;
}
pinMode(gpio7, PWM_OUTPUT);
if(softPwmCreate(gpio7,0,100)==0){
while(1){
for(int i=0; i<=100; i++){
softPwmWrite(gpio7,i);
delay(100);
}
for(int i=100; i>0; i--){
softPwmWrite(gpio7,i);
delay(100);
}
}
}
}