Page 992 - 3-2
P. 992

* #L%
             */



            import com.pi4j.io.serial.*;

            import com.pi4j.util.CommandArgumentParser;
            import com.pi4j.util.Console;

            import java.io.IOException;
            import java.util.Date;



            /**

             * This example code demonstrates how to perform serial communications using the Raspberry
            Pi.
             *

             * @author Robert Savage
             */

            public class SerialProject {
                /**

                 * This example program supports the following optional command arguments/options:
                 *   "--device (device-path)"                   [DEFAULT: /dev/ttyAMA0]

                 *   "--baud (baud-rate)"                        [DEFAULT: 38400]
                 *   "--data-bits (5|6|7|8)"                    [DEFAULT: 8]

                 *   "--parity (none|odd|even)"                  [DEFAULT: none]
                 *   "--stop-bits (1|2)"                        [DEFAULT: 1]

                 *   "--flow-control (none|hardware|software)" [DEFAULT: none]
                 *

                 * @param args
                 * @throws InterruptedException

                 * @throws IOException
                 */

                    final static Serial serial = SerialFactory.createInstance();
                public static void main(String args[]) throws InterruptedException, IOException {



                    // !! ATTENTION !!

                    // By default, the serial port is configured as a console port
                    // for interacting with the Linux OS shell. If you want to use

                    // the serial port in a software program, you must disable the



                                                         - 992 -
   987   988   989   990   991   992   993   994   995   996   997