• 검색 결과가 없습니다.

11 12 int main() 13 { 14 const int led_pin

N/A
N/A
Protected

Academic year: 2022

Share "11 12 int main() 13 { 14 const int led_pin "

Copied!
1
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

1 // LED 를 제어하는 프로그램을 작성하시오. int 형 변수 led 의 값을 2진수 형태로 LED 에 표시할 것 . 1초마다 led 의 값을 왼쪽으로 1비트씩 시프트시킬 것.

2

3 // LED 초기상태 0 0 0 1 4 // 1 초 후 0 0 1 0 5 // 1 초 후 0 1 0 0 6 // 1 초 후 1 0 0 0 7 // 1 초 후 0 0 0 1 8 // 같은 형태로 반복함

9

10 #include <wiringPi.h>

11

12 int main() 13 {

14 const int led_pin[]={25,29,28,27};

15 const int led_count=sizeof(led_pin)/sizeof(led_pin[0]);

16

17 wiringPiSetup();

18

19 for(int i=0;i<led_count;++i){

20 pinMode(led_pin[i], OUTPUT);

21 digitalWrite(led_pin[i], LOW);

22 } 23

24 int led=1;

25

26 while(1){

27 for(int i=0;i<led_count;++i)

28 digitalWrite(led_pin[i], (led&(1<<i)?HIGH:LOW));

29

30 delay(1000);

31 led<<=1;

32 if(led==0x10) led=1;

33 } 34

35 return 0;

36 } 37

참조

관련 문서

Attach the spot circled in red on assembly 13 to the base card and then attach the hills to assembly 13. Fold over and attach the sky

[r]

The JPEG compressed image shows some artifacts and to reduce this artifact different post-processing algorithms are proposed so far. BF is one proposed method; it can reduce

Based on KDI’s hands-on experience on development policy for more than forty years, the Master of Development Policy (MDP) program offers a curriculum where students can

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ).

Ø CheckNegative 함수 내에서는 int형, double형 값에 대한 throw문 발생 가능. n bool CheckNegative(int x,

 FileDialog(Frame fr, String title, int mode): fr 프레임에 부착되고 title을 제목으로 가지는 객체를 생성한다. Mode가 FileDialog.SAVE

auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void.. default