BASIC4MCU | 질문게시판 | 아두이노 질문이요!
페이지 정보
작성자 초짜 작성일2018-12-02 21:15 조회6,202회 댓글0건본문
#define PORTA 0
void outportb(byte, byte);
byte inportb(byte);
void CWR(byte, byte);
void FND_display(int data)
{
byte ths = 0x80 + data/1000;
byte hun = 0x40 + (data%1000)/100;
byte ten = 0x20 + (data%100)/10;
byte one = 0x10 + data%10;
for(int count =0; count < 0xFF; count++){
outportb(PORTA, one);delay(5);
}
}void setup() {
// put your setup code here, to run once:}
byte out = 0;
byte data = 0;
void loop() {
// put your main code here, to run repeatedly:
FND_display(1234);
}
헤더 파일
void outportb(byte port, byte data)
{
for(int i=0; i<8; i++)
{
if (data%2 == 1)
digitalWrite(port*8+i+2, HIGH);
else
digitalWrite(port*8+i+2, LOW);
data >>=1;
}
}
이렇게 주었는데..... 숫자가 4가 안뜨더라구요.... outportb쪽에 잘못준것 같긴한데...ㅠㅠ
댓글 0
조회수 6,202등록된 댓글이 없습니다.