Cannot read orientation sensor during the while do loop

Hello,
I can't read any data from the orientation sensor within the Do loop (rolling inclination).
Is there a known problem and if so is there a workaround?

greeting

Devices older than Android 4.4 have an orientation sensor; devices younger use an accelerometer or geomagnetic field sensor as the orientation sensor is depricated. Your device might not have an orientation sensor. If so, use an accelerometer to determine orientation.

Hello Steve,
I have Android 5.0 and 6.0 and the orientation sensor works, but not in the while loop.

Interesting. My 8.1 does not have the hardware.

Regarding your issue the conditional blocks you are using do not seem right. You probably should be using if..then else if else construction. What should it be? Sorry, I cannot test. This link might help Programming Your App to Make Decisions . It has some examples to experiment with. See the section on complex conditions.

Sending commands to bluetooth while in the 'loop' might be part of the issue or your while criteria 'ready' --false might not be engaging. How are you determining fertig falsh or nicht falsh?

Sorry, my high school Deutchsprechen , other than left and right fails me.

image

The same only involved in a timer. This is how it works, but not clearly in the overall program.

Mein englisch ist auch nicht besser :grinning:

I am with @SteveJG on this. replace any while test blocks with if else blocks.

without a timer ?
How does that work

maybe for understanding:
the whole thing is supposed to be a scale. I have 2 motors that I control depending on the X position. I query the X position until it is between 0.5 and -0.5 degrees and then switch off the corresponding motor (lift right or lift left).

The clock timer should be OK, I am meaning:

replace

image

with

image

but looking at your blocks again, you do not appear to have any while test blocks....

i have do it in the timer version. see the picture . but it is not the best solution

Have another look at your conditional statements to ensure that they do not clash with each other. for example:

1 > 0   = true
1 > 0.4 = true

The goal is reached when X is between 0.4 and -0.4. The version with the timer also works, just not the one in the loop.
I thank you anyway and leave it for now with the timer version.

greetin :v: