Study/Arduino

7 segment

zeroplus1 2018. 9. 11. 18:04

참고사이트 : 

https://m.blog.naver.com/PostView.nhn?blogId=sera6612&logNo=221165825573&proxyReferer=https%3A%2F%2Fwww.google.com%2F




byte digits[10][8]={

  {1,1,1,1,1,1,0,0},//0

  {0,1,1,0,0,0,0,0},//1

  {1,1,0,1,1,0,1,0},//2

  {1,1,1,1,0,0,1,0},//3

  {0,1,1,0,0,1,1,0},//4

  {1,0,1,1,0,1,1,0},//5

  {1,0,1,1,1,1,1,0},//6

  {1,1,1,0,0,0,0,0},//7

  {1,1,1,1,1,1,1,0},//8

  {1,1,1,0,0,1,1,0}//9

};


void setup() {

  for(int i=2;i<9;i++){

    pinMode(i, OUTPUT);

  }

}


void loop() {

  // put your main code here, to run repeatedly:

  for(int j=0;j<10;j++){

    for(int i=0;i<8;i++){

      digitalWrite(i+2, digits[j][i]);

    }

  }

}


아래는 복사하지 마세요

아래는 애노드방식의 배열 선언입니다.

byte digits[10][10]={

  {0,0,0,0,0,0,1,1},//0

  {1,0,0,1,1,1,1,1},//1

  {0,0,1,0,0,1,0,1},//2

  {0,0,0,0,1,1,0,1},//3

  {1,0,0,1,1,0,0,1},//4

  {0,1,0,0,1,0,0,1},//5

  {0,1,0,0,0,0,0,1},//6

  {0,0,0,1,1,1,1,1},//7

  {0,0,0,0,0,0,0,1},//8

  {0,0,0,1,1,0,0,1},//9

}

'Study > Arduino' 카테고리의 다른 글

스텝모터 드라이브  (0) 2018.09.18
DHT11  (0) 2018.09.16
LCD I2C 라이브러리 다운로드  (2) 2018.09.13
전자부품구매사이트  (0) 2016.01.17
Arduino 관련 사이트 및 부품 구매 사이트  (0) 2016.01.16