Page 458 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 458

S e ria l.p rin tln ("rig h t!");
                    }  b re a k ;
                    c a s e   '5 ':  //정 지
                    {
                     d ig ita lW rite (o u t3 ,H IG H );
                     d ig ita lW rite (o u t2 ,L O W );
                     d ig ita lW rite (o u t1,H IG H );

                       m y S e ria l.p rin tln ("s to p !");
                       S e ria l.p rin tln ("s to p !");
                    }  b re a k ;
                    c a s e   '8 ':  //좌 후 진
                    {
                     d ig ita lW rite (o u t3 ,H IG H );
                     d ig ita lW rite (o u t2 ,H IG H );
                     d ig ita lW rite (o u t1,L O W );
                    }  b re a k ;
                    c a s e   '9 ':  //우 후 진
                    {
                     d ig ita lW rite (o u t3 ,H IG H );
                     d ig ita lW rite (o u t2 ,H IG H );
                     d ig ita lW rite (o u t1,H IG H );

                    }  b re a k ;



                    c a s e   '6 ':  //초 음 파  거 리 감 지
                    {
                     u n s ig n e d   lo n g  d u ra tio n ,c m ;




                     d ig ita lW rite (trig P in _ ma in ,L O W );
                     d ig ita lW rite (e c h o P in _ ma in ,L O W );
                     d e la y Mic ro s e c o n d s  (2 );

                     d ig ita lW rite (trig P in _ ma in ,H IG H );
                     d e la y Mic ro s e c o n d s  (10 );
                     d ig ita lW rite (trig P in _ ma in ,L O W );

                     d u ra tio n = p u ls e In (e c h o P in _ ma in ,H IG H ,5 8 0 0 );
                     c m = d u ra tio n /2 9 /2 ;

                     if(c m < s a fe z o n e _ ma in )
             //적정거 리  안쪽 으로  들 어오게 되면  정 지   1초  후   무조건   좌회전 해서  벽 을   비 껴 감




                                                         -  451  -
   453   454   455   456   457   458   459   460   461   462   463