BASIC4MCU | 질문게시판 | 답변 : 아두이노 시리얼 통신 제어 질문입니다(비주얼 스튜디오에서)
페이지 정보
작성자 master 작성일2018-09-19 21:43 조회9,922회 댓글2건
https://www.basic4mcu.com/bbs/board.php?bo_table=gac&wr_id=3144
작성일
본문
visual studio 코드//if(faces.size()>0){//detectStatus='1';if(num==1){cout<<"Left!!"<<endl;serialComm.sendCommand('1'); // num1=수평 모터 값 증가if(temp==1){ cout<<" UP!!"<<endl; serialComm.sendCommand('3'); } // temp1=수직 모터 값 증가if(temp==2){ cout<<" down!!"<<endl; serialComm.sendCommand('4'); } // temp2=수직 모터 값 감소}if(num==2){cout<<"Right!!"<<endl;serialComm.sendCommand('2'); // num2=수평 모터 값 감소if(temp==1){ cout<<" UP!!"<<endl; serialComm.sendCommand('3'); } // temp1=수직 모터 값 증가if(temp==2){ cout<<" DOWN!!"<<endl; serialComm.sendCommand('4'); } // temp2=수직 모터 값 감소}
VC++ 및 아두이노의 전체 소스코드가 있어야 파악이 될 것 같습니다.
댓글 2
조회수 9,922JJJJ님의 댓글
JJJJ 작성일
감사합니다!!
if와 else if 의 적절한 사용이 어렵네요 ㅜㅜ
master님의 댓글
master
if(), else if() 로 사용하지 않아도 문제가 될 것이 없어서
가독성을 높이려고 if(), if() 로 사용 했습니다.