• This project
    • Loading...
  • Sign in

이다은 / raspberry

%ea%b7%b8%eb%a6%bc1
Go to a project
Toggle navigation Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • Snippets
  • Network
  • Create a new issue
  • Builds
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Network
  • Compare
  • Branches
  • Tags
Switch branch/tag
  • raspberry
  • assignment
  • lab2-5-2.c
  • daeun's avatar
    modify lab2-3-2 · b640b4be
    b640b4be
    daeun authored 2021-04-22 21:46:44 +0900
lab2-5-2.c 361 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include <wiringPi.h>
#include <softPwm.h>

#define LedPin 22

int main(void){
	if (wiringPiSetupGpio() == -1)
		return 1;

	pinMode(LedPin, OUTPUT);
	softPwmCreate(LedPin, 0, 128);
	int i;
	while(1){
		for(i=0;i<129;i+=8){
			softPwmWrite(LedPin, i);
			delay(100);
		}
		for(i=128;i>-1;i-=8){
			softPwmWrite(LedPin,i); 
			delay(100);
		}
	}
	return 0;
}