Page 995 - 3-2
P. 995

// continuous loop to keep the program running until the user terminates the
            program

                        while(console.isRunning()) {
                            try {

                               if(sendData(args[0]))
                                       System.out.println(args[0]);

                                       break;
                            }

                            catch(IllegalStateException ex){
                                ex.printStackTrace();

                            }



                            // wait 1 second before continuing
                            Thread.sleep(1000);

                        }



                    }
                    catch(IOException ex) {

                        console.println(" ==>> SERIAL SETUP FAILED : " + ex.getMessage());
                        return;

                    }
                }



                public static boolean sendData(String data) {

                            try {
                                    serial.write(data);



                            } catch (Exception e) {

                                    System.out.println(e.toString());
                            }

                            return true;
                    }

            }



            다 안드로이드 앱 관련 소스.



                                                         - 995 -
   990   991   992   993   994   995   996   997   998   999   1000