Page 244 - Build Your Own Quadcopter_ Power Up Your Designs with the Parallax Elev-8
P. 244

Chapter 8: GPS and a Real- T ime Situational Displa y           223


                               pst    : “Parallax Serial Terminal Plus”  ‘ Terminal
                                                                                    tools
                               time   : “Timing”                           ‘ Timing convenience
                                                                                 methods
                               xb     : “XBee_Object_1”                    ‘ XBee communication
                                                                                 methods
                               lcd    : “debug_lcd”


                             PUB Go | c

                               pst.Start(115_200)                          ‘ Start Parallax
                                                                                   Terminal
                               xb.start(7,6,0,9600)                        ‘ Propeller Comms -
                                                                                       Baud
                               xb.AT_Init                                  ‘ Initialize for fast

                               xb.AT_ConfigVal(string(“ATMY”), 9)          ‘ Set MY address to 9
                               xb.AT_ConfigVal(String(“ATDL”), 8)          ‘ Set Destination Low
                                                                                     8

                               if lcd.init(LCD_PIN, LCD_BAUD, LCD_LINES)   ‘ init returns True
                                                                                   started
                                 lcd.cursor(0)                             ‘ cursor off
                                 lcd.backLight(True)                       ‘ turn on backlight
                                 lcd.cls                                   ‘ clear display
                                 lcd.str(string(“GPS Real Time Display V1.0”))  ‘ welcome
                                                                                           screen
                                 waitcnt(clkfreq + cnt)                    ‘ wait 1 second
                                 lcd.cls                                   ‘ clear the screen
                                                                                again
                                 waitcnt(clkfreq/2 + cnt)                  ‘ wait .5 seconds


                               repeat                                      ‘ Main forever loop
                                 c :=  xb.rxCheck                          ‘ Check buffer
                                 if c <> -1                                ‘ If it’s not
                                                                                   (-1)
                                   pst.Char(c)                             ‘ Then display the

                                                                                   terminal
                                   lcd.putc(c)                             ‘ Display the same

                                                                                   screen

                                I chose to connect the LCD display to pin 19 because that is also a BOE servo port. That
                             way, I could use a servo cable to connect the LCD display with the BOE as I did in Chapter 7.
   239   240   241   242   243   244   245   246   247   248   249