게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
rasberrypi에서 c로딴 코드 질문있습니다
게시물ID : programmer_22363짧은주소 복사하기
작성자 : hazelnuts
추천 : 0
조회수 : 493회
댓글수 : 1개
등록시간 : 2018/05/01 10:41:36
#include <stdio.h>
 #include <wiringPi.h>
 #define KEYPAD_PB 9 
 int eventCounter = 0;

  void myInterrupt(void){ eventCounter++; }

  int main(void)

{ if(wiringPiSetupGpio() < 0){ return 1; }

 if(wiringPiISR(KEYPAD_PB, INT_EDGE_FALLING, &myInterrupt) < 0){ return 1; }

  while(1)
{ printf("%d\n", eventCounter); 
eventCounter = 0; delay(1000); }
 return 0; }

1초씩딜레이를 주어서 keypad를 눌렀을때 인터럽트가 발생 해서 eventCounter가  1씩 증가하는 프로그램입니다
 if(wiringPiISR(KEYPAD_PB, INT_EDGE_FALLING, &myInterrupt) < 0){ return 1; } 이코드는 발생해서 프로그램이 꺼지게 되는건가요?
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호