[아두이노] TIP : Serial의 Port가 Open 시점 확인

필자는 아두이노 코드 중  Serial 관련 코드가 궁굼하여 해당 코드가 Class로 구성 되어 있지 않을까 판단하여 구글링을 해보았으며 살짝 다른 내용을 확인 하게 되었다


Serial.begin(115200);

while (!Serial); // wait for Leonardo enumeration, others continue immediately


구글링 결과 if(Serial)라는 Function으로 아두이노 별도 구현 되어 있으며 기능은 해당 Port Open여부를 알려주는 기능을 하고 있다. 


 

if(Serial)

Description

Indicates if the specified Serial port is ready.

On the boards with native USB, if (Serial) (or if(SerialUSB) on the Due) indicates whether or not the USB CDC serial connection is open. For all other boards, and the non-USB CDC ports, this will always return true.

This was introduced in Arduino IDE 1.0.1.


살짝 영어가 부족하여 USB장착 된 보드이면 USB연결 시점에 인식하고, 그렇치 않은 경우 Port의 Open 유무 반환하는 것으로 이해된다.


0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기

임베디드 보드

번호 제목 글쓴이 날짜 조회수
2 라즈베리 파이 라즈베리 파이 (Raspberry Pi) 기초 icon 양재동메이커 06-19 16,364
1 라즈베리 파이 (동영상 강의) 라즈베리 파이 강좌 Link icon 양재동메이커 06-17 15,398