BPI-M1+ wiringPi PWM

#include <wiringPi.h>
//
// by MikuQ([email protected]) 2016-5-26
//
int main(void)
{
  int bright ;
  wiringPiSetup() ;
  pinMode (7, PWM_OUTPUT) ;
  for (;; )
  {
    for (bright = 0 ; bright < 1024 ; bright+=5)
    {
      pwmWrite (7, bright) ;
      delay (1) ;
    }

    for (bright = 1023 ; bright >= 0 ; bright-=5)
    {
      pwmWrite (7, bright) ;
      delay (1) ;
    }
  }
}

only 200Hz

1 Like