Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp and I2c bus — Parallax Forums

basic stamp and I2c bus

rapterrapter Posts: 9
edited 2007-02-15 03:46 in BASIC Stamp

HI,

I am new to the basic stamp. I am retired and have decided to build a robot. I have completed the platform and run it around using a joystick no problems ( it weighs in at 200lbs. ). In looking around for the proper brain for it I have looked at the Oopic and basic stamp. When I came across the add for the MSRS Boe-Bot I decided go that route to get my feet wet. I have run the Boe-Bot all around the house using my laptop and MSRS. Now I am ready to move on and transfer to my large robot.

My problem is I want use the CMPSO3 electronic compass and from what I understand I need to use I2C bus for the compass. I know I will have to purchase the BS2P stamp for that but I can not determine if I need to replace the board of education or not in order to use I2C bus. Any help greatly appreciated.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2007-02-15 00:59
    Any 24-pin BS2 'flavor' will plug in to the BOE, no problem.

    It IS possible to make an I2C bus with a 'plain' BS2, but the BS2p does have special commands for it. Meaning it would take more code and work more slowly in a 'plain' BS2.
  • rapterrapter Posts: 9
    edited 2007-02-15 01:35

    Thanks for the reply. It looks like my best bet is to buy the BS2P and use it on my BOE. I looked a little closer at the BOE doc and believe I now understand now.

    Thanks ED

  • LarryLarry Posts: 212
    edited 2007-02-15 03:46
    You won't need to upgrade to a 2p just to read the compass (though you may wish to for other reasons).
    the CMPS03 also has a PWM output with pulse width proportional to heading.


    a few lines of code make it easy to interface with your Stamp, and I've found the output to be just as accurate as the I2C method.
    here's a code snippet provided by the manufacturer for the different available Stamps:

    bearing var word
    
    main:
      pulsin 8, 1, bearing                          ' Get reading
      bearing = (bearing-500)/50                    ' BS2(e) - Calculate Bearing in degrees
      ' bearing = (bearing-1250)/125                ' BS2sx - Calculate Bearing in degrees
      ' bearing = (bearing-1333)/133                ' BS2p - Calculate Bearing in degrees
      debug 2,1,1, "Compass Bearing ", dec3 bearing ' Display Compass Bearing
      goto main                                     ' around forever
    
    
    



    further explanations here:

    www.robot-electronics.co.uk/htm/cmps2pwm.shtml

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.