• 검색 결과가 없습니다.

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

참조

관련 문서

6 With this motto, we will work together as a team to make a great class.. 7 Every one of us will

[r]

[r]

The news- letter is published by ASEAN Study Center, Faculty of Social and Political Sciences, Universitas Indonesia, with the support from the Mission of the

문제의 조건에 맞게 간 단한 계산식을 만들어 해결해 봅시다... 따라서

여기에 소리의 센 정도에 따라 기본자에서 획을 더하는 방법으로 ㉡ 가획자를

• Mental illness costs the USA over $160 billion per annum and this figure continues to rise up to 50 per cent of us will experience some mental d isorder in our lifetime (Keyes

일정한 규칙에 의해 삼각형을 늘어놓은