embeded/raspberry pi2024. 12. 31. 00:22

 

[링크 : https://www.electronicwings.com/raspberry-pi/raspberry-pi-pwm-generation-using-python-and-c]

[링크 : https://blog.naver.com/emperonics/221821487830]

 

#include <wiringPi.h>

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main (void)
{
  int bright ;

  printf ("Raspberry Pi wiringPi PWM test program\n") ;

  if (wiringPiSetup () == -1)
    exit (1) ;

  pinMode (1, PWM_OUTPUT) ;

  for (;;)
  {
    for (bright = 0 ; bright < 1024 ; ++bright)
    {
      pwmWrite (1, bright) ;
      delay (1) ;
    }

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

  return 0 ;
}

[링크 : https://github.com/WiringPi/WiringPi/blob/master/examples/pwm.c]

'embeded > raspberry pi' 카테고리의 다른 글

rpi pico + st7735 using circuitpython + thonny  (0) 2025.10.09
node-red  (0) 2024.11.21
cli 에서 chrome refresh 하기  (0) 2024.09.24
라즈베리 파이 gui 재시작(lxde)  (0) 2024.09.19
라즈베리 파이 gui 자동실행  (0) 2024.09.19
Posted by 구차니