Is it possible to figure out the direction an Arduino is heading relative to the world, ignoring whether it's right side up, upside down, or anything in between?
Desired behavior:
(Arduino is right side up) I move the Arduino up and it prints up
(Arduino is upside down) I move the Arduino up and it prints up
Current behavior:
(Arduino is right side up) I move the Arduino up and it prints up
(Arduino is upside down) I move the Arduino up and it prints down
Welcome to the Forum! Read the forum guidelines to see how to properly ask a question and some good information on making a good post.
To answer your questions we need a more detailed info about the project. Please describe what the hardware do you use. How do you intend to determine a direction of the arduino?
An accelerometer measures the acceleration due to gravity, and this can be used to determine the direction of "down". For best accuracy the accelerometer should be held still.
If you use one of the sensor fusion libraries like MPU6050_6Axis_MotionApps20 with an MPU6050 (there are better IMU's BTW but I've had good luck with this library) then I think you can do that since the library computes orientation using the accelerometer and gyro. This particular library avoids that and just uses the Kalman filter built into the sensor!
You would be able to tell which way the sensor is oriented and which way it's moving wrt gravity.