Shop OBEX P1 Docs P2 Docs Learn Events
help-using a digital compass and lcd screen — Parallax Forums

help-using a digital compass and lcd screen

LIZ56LIZ56 Posts: 3
edited 2007-12-14 02:17 in Robotics
I am a newbie with the boe-bot and have a standard kit. I am curious about using a digital compass and simply allowing the boe-bot to tell me which direction its facing... aka "60 degrees east of north" etc. I'm pretty sure I have the code for the compass component, but I don't know how to get the boe-bot to display the direction it is reading on the 2 X 16 LCD screen we have. It only displays when plugged into the computer. Does anyone have any knowledge on using LCD screens / where to put the code (in BASIC) that tells the boe-bot to display the compass data on the LCD?
Thanks! shakehead.gif I'm totally lost on this segment of code!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-14 02:17
    You have two separate tasks here:
    1) Get the data from the compass (and handle the calibration information). There are plenty of examples of this that either come with the compass (the HM-55B) or are downloadable from Parallax's webstore page for the compass.

    2) Display the compass data on an LCD (either serial or parallel interface). There are examples for sending data to the LCD that either come with it or are downloadable from the webstore page for the LCD.

    As will most programming, you do one task, then do the next one. You can also make a subroutine out of each task and call them one at a time like:
    main:
       gosub readCompass
       gosub displayData
       goto main
    
    readCompass:
    ' read the data from the HM55B and normalize it
    ' you want to end up with a direction in degrees preferably
    ' for testing purposes, just leave the data in degrees
      return
    
    displayData:
    ' take the data in degrees (0 to 359 or whatever)
    ' and either display it as is on the LCD or test for
    ' different ranges like from 0 to 44, 45 to 89, 90 to 134,
    ' 135 to 179, 180 to 224, 225 to 269, 270 to 314, 315 to 359.
    ' This will get you N, E, S, W, NE, SE, SW, and NW and you
    ' can decide how do divide these up further.
      return
    
    
Sign In or Register to comment.