Bubble level doesn't produce accurate results

In the attached project, there are three cases: a vertical bubble level, a horizontal bubble level, and a center bubble level for horizontal adjustment and set xy values to be zero if bubble in centre

I've programmed the application, but it doesn't produce accurate results !! . How can I force the center bubble to stay within the circle's boundaries?

bubble_level(2).aia (420.1 KB)

You probably need to calibrate your device, and ensure you have a flat, level surface to test on.

I tried a similar app on the store and it gives correct results on the same phone.

I note in your example that the bubbles all "go the wrong way" - should go up when you tilt up.

Your maths were all wrong. I also set your three "bubbles" to origin at center 0.5/0.5

This seems to behave

bubble_level1.aia (419.9 KB)

1 Like


Samsung A13 on my desk Ahmed's app seems to be congruent with real spirit level using Tim's aia (modified) . :smiley: Thanks. Yes, my desktop is not perfectly flat (but my table say is flat)

Steve

Great, I also added to what you did. I applied the circle function so that the bubble would not go outside the circular boundaries of the LEVEL .


bubble_level2.aia (421.3 KB)

To make the Level more realistic, I want the bubble to change shape as the phone moves vertically, tilts forward, or backward. There's a different image for the circular bubble =bubble_h.png , and a different image for the vertical and horizontal bubble = bubble_margin.png
attached in aia file



How can I make the new bubble rotate on the perimeter of circle of the level, and on the outer perimeter of the horizontal and vertical Level correctly? I tried a lot, but it always appears upside down or rotates randomly.
bubble_h
bubble_margin