How to use both accelerometer and gyroscope sensors

Hello everyone;
When I use the Arduino Nano 33 ble accelerometer sensor and gyroscope sensor in the LSM9DS1 library, I find that the serial port disappears after I write the code and burn it. I hope someone can help me out!Below is my code

Despite their best efforts, computer scientists have so far failed to compile pictures.

Please remember to use code tags when posting code.

1 Like
float x,y,z,a,b,c;
   if(!flag)
   {

         
          if (IMU.accelerationAvailable() && IMU.gyroscopeAvailable())
          {
             IMU.readAcceleration(x, y, z);
             digitalWrite(LEDR, LOW);
             delay(1000);
             digitalWrite(LEDR, HIGH);
             delay(1000);
          
                Ax[begin_index]=-y;
                Ay[begin_index]=-x;
                Az[begin_index]=z;

               Serial.print(Ax[begin_index]);
 
              
               IMU.readGyroscope(a, b, c);
 
                    Aa[begin_index]=-b;
                    Ab[begin_index]=-a;
                    Ac[begin_index]=c;
                Serial.print(Aa[begin_index]);
                    begin_index++;
                    
                  }
    }    

Sorry, this is my first time using

No.

Please post all your code.

Hello, do yourself a favour and please read How to get the best out of this forum

May I use that from time to time?

Sure (though I'm not entirely sure it's true!)

On iOS or Mac OS OCR capability are now integrated so you can select the text from the picture and paste it in the IDE…

Still not a good reason to post an image instead of code (with code tags)

I would like to ask if there are any examples of using two sensors at the same time, thank you

Try Serial.println. You’re using Serial.print() so you’ll never get a new line.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.