About Us About Embedded Introduce Editorial Contributions Location Document Android Application Embedded Linux Processor Arduino AVR Devices Resource Android Application Embedded Linux Processor Arduino AVR Devices Education 교육과정안내 교재 프로젝트 자료실 Reference Community 공지사항 제품광고 구인광고
Switch 상태를 UART로 확인하기 작성자 임베디드코리아 작성일25-05-15 17:21 조회172회 댓글0건 첨부파일 UART_switch_OnOff.ino (316byte) 0회 다운로드 DATE : 2025-05-15 18:39:54 이전글 다음글 목록 <* Switch 상태를 UART로 확인하기 *> - Switch를 D8에 연결하고, Serial Monitor로 Switch 상태를 확인한다. - Switch를 "OFF"가 출력도다가, 누르면 "ON"이 출력된다 ---------------------------------------------------------------- const int switch_Pin = 8; bool read_switch; void setup() { Serial.begin(9600); pinMode(switch_Pin, INPUT); } void loop() { read_switch = digitalRead(switch_Pin); if(read_switch){ Serial.write("ON\n"); delay(500); }else{ Serial.write("OFF\n"); delay(500); } } 이전글 다음글 목록