Page 88 - MDP2022-2
P. 88

byte[]  bytes  =  str.getBytes();
                                    try  {
                                            mmOutStream.write(bytes);
                                    }  catch  (IOException  e)  {

                                            Toast.makeText(getApplicationContext(),  "데이터  전송  중  오류가  발생했습
            니다.",  Toast.LENGTH_LONG).show();
                                    }
                            }
                            public  void  cancel()  {

                                    try  {
                                            mmSocket.close();
                                    }  catch  (IOException  e)  {
                                            Toast.makeText(getApplicationContext(),  "소켓  해제  중  오류가  발생했습니
            다.",  Toast.LENGTH_LONG).show();
                                    }

                            }
                    }


            }

            아두이노  코드
            #include  <Arduino.h>
            #include  <SoftwareSerial.h>


            #define  BT_RXD  3
            #define  BT_TXD  2



            SoftwareSerial  bluetooth(BT_RXD,  BT_TXD);


            int  IN1_1  =  4;

            int  IN2_1  =  5;
            int  IN3_1  =  6;
            int  IN4_1  =  7;
            int  IN1_2  =  8;
            int  IN2_2  =  9;
            int  IN3_2  =  10;

            int  IN4_2  =  11;
            int  thankyou  =  12;
            int  recive  =  0;
            char  remember=NULL;

            void  left_turn()
            {
   83   84   85   86   87   88   89   90   91   92   93