🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    BMP180 Grove how to get it working on core2?

    Scheduled Pinned Locked Moved Arduino
    5 Posts 3 Posters 8.7k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      wadoadi
      last edited by Zontex

      Hi,
      I have been trying to get the BMP180 connected via Grove I2C to work and failed, Yes I'm new to the M5Stacks and struggling!

      My code is below, anyone tell me what's wrong or point me at an M5Core2 example?

      #define M5STACK_MPU6886 
      
      #define SDA 25
      #define SCL 13
      
      #include <M5Core2.h>
      #include <Wire.h>
      //TwoWire Wire1 = TwoWire(1);
      
      #include <Adafruit_BMP085.h>
      Adafruit_BMP085 bmp;
      
      float pitch = 0.0F;
      float roll  = 0.0F;
      float yaw   = 0.0F;
      
      //averages 
      float pitcha = 0.0F;
      float rolla  = 0.0F;
      float yawa   = 0.0F;
      
      
      
        int i = 0;
        
      
      void setup(){
      
        // Initialize the M5Stack object
        M5.begin();
        Wire.begin(SDA, SCL);  //M5Stack SDA, SC  
        //Wire1.begin(SDA, SCL, 400000);
        M5.IMU.Init();
        delay(200);
        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setTextColor(GREEN , BLACK);
        M5.Lcd.setTextSize(2);
      
           if (!bmp.begin()) {
            M5.Lcd.println("BMP Error");
         
              }
      
      }
      
      // the loop routine runs over and over again forever
      void loop() {
          // put your main code here, to run repeatedly:1    
      
        M5.IMU.getAhrsData(&pitch,&roll,&yaw);
        
        pitcha += pitch;
        rolla += roll;
        yawa += yaw;
        
            if (i > 60) //average every i loops
              {
        
                pitch = pitcha/i;
                roll = (rolla/i)-90;
                yaw = yawa/i;
                
                pitcha = 0;
                rolla = 0;
                yawa = 0;
              
                i=0;
                
                M5.Lcd.setCursor(10, 20);
                M5.Lcd.printf(" Bank %3.0f   Pitch %3.0f   ", pitch, roll);
                M5.Lcd.println(bmp.readTemperature());
                
               }
        i++;
        delay(10);
      }
      
      1 Reply Last reply Reply Quote 0
      • ZontexZ Offline
        Zontex
        last edited by

        Hello,
        could you please properly comment your code so it will be easier to copy paste it?
        you can use ``` twice one on top of the code one on the bottom to comment it such as

        print("hello world")
        
        1 Reply Last reply Reply Quote 0
        • felmueF Offline
          felmue
          last edited by

          Hello @wadoadi

          just curious, where did you get those pin numbers from?

          #define SDA 25
          #define SCL 13

          The Groove port (red) on M5Core2 uses GPIO32 / 33 for SDA and SCL.

          Thanks
          Felix

          GPIO translation table M5Stack / M5Core2
          Information about various M5Stack products.
          Code examples

          W 1 Reply Last reply Reply Quote 0
          • W Offline
            wadoadi @felmue
            last edited by

            @felmue I saw it in this thread commented out for the M5Stack
            https://community.m5stack.com/topic/255/m5cam-and-bmp180/3

            I now have my application working, I had stupidly loaded the BMP180 when in fact, I have BMP280! also it has the alternative slave address...

            1 Reply Last reply Reply Quote 0
            • felmueF Offline
              felmue
              last edited by

              Hello @wadoadi

              I am glad to hear you got it working. And thanks for reporting back.

              Happy Stacking!
              Felix

              GPIO translation table M5Stack / M5Core2
              Information about various M5Stack products.
              Code examples

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post