25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test2.c 587 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * test2.c:
  3. * Simple test program to test the wiringPi functions
  4. * PWM test
  5. */
  6. #include <wiringPi.h>
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <stdint.h>
  10. int main (void)
  11. {
  12. int bright ;
  13. printf ("Raspberry Pi wiringPi PWM test program\n") ;
  14. if (wiringPiSetup () == -1)
  15. exit (1) ;
  16. pinMode (1, PWM_OUTPUT) ;
  17. for (;;)
  18. {
  19. for (bright = 0 ; bright < 1024 ; ++bright)
  20. {
  21. pwmWrite (1, bright) ;
  22. delay (1) ;
  23. }
  24. for (bright = 1023 ; bright >= 0 ; --bright)
  25. {
  26. pwmWrite (1, bright) ;
  27. delay (1) ;
  28. }
  29. }
  30. return 0 ;
  31. }