Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: MPU6050 on Teensy

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Posts
    7

    MPU6050 on Teensy

    Hey people i need your help. I would like to read three MPU6050 sensors simultaneously. I have now bought a teensy, because this has two I2C busses, not like the arduino. Now I've connected two of the sensors via one bus by changing the address of the one sensor. Now I wonder how I can now control the third sensor via the other bus?

    Many thanks in advance.

  2. #2
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    528
    Simply use one of the other bus objects, i.e. Wire1 instead of Wire.

  3. #3
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    I'm still a bit new in the programming language. So now I have two sensors adressmanipulation connected and it works fine.
    What exactly do I have to change now to read the third sensor?
    I connected it to SCL1 and SDA1....

  4. #4
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    So, what to do is that I just have to chnage Wire to Wire1 to read out the third sensor on the other bus?

  5. #5
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    528
    Quote Originally Posted by Marvikov View Post
    So, what to do is that I just have to chnage Wire to Wire1 to read out the third sensor on the other bus?
    Yes, that's what's needed.

  6. #6
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    Okay thank you

  7. #7
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    So, what do I do with the adress of the thirs sensor? Because two of the sensors now have the same adress (0x68) but on a different bus. Is this a problem for the code?
    And how can I see my output values on the serial monitor? When I upload the code on my teensy there is no error but I can't see anything on the serial monitor.... What could be the problem for that?

  8. #8
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    Do I need to download a new library for wire1?

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    No other library needed. Wire1 is part of the normal Wire library.

    However, if you're using Teensy LC (can't tell which board you have from the messages above), you'll need to edit WireKinetis.h to enable Wire1 in the code. It's disabled by default on LC to save memory, since LC has only 8K or RAM.

    On Teensy 3.2, 3.5 and 3.6, you can just use Wire1. No need to edit anything. Just including Wire.h is enough.

  10. #10
    Junior Member
    Join Date
    Jun 2019
    Posts
    7
    Thank you, now it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •