问题
Since I'm new to App Inventor2 tool, I'm having a little issue trying to get a "pitch" value to trigger the visibility of a label.
I need to have a label being shown when the "AccelerometerSensor", reaches the -30 or 30 degrees point. To make this happen I'm using the "zAccel" value and the app runs in landscape mode, with the home button on the right side of the android device.
The following image shows the blocks I've used so far, without much success, as the "Warning" is visible all the time:
Any help with a block or a clue in the logic used, will be much appreciated. Thank you all in advance for your time and answers.
回答1:
let me provide my given comments as answer now:
You should use >30
or <-30
instead, because else the if
statement always is true
.
Also I would add an else
statement to set the warning back to false
again. If you do not do this, once the warning is visible, it will stay visible.
来源:https://stackoverflow.com/questions/29268426/event-driven-sign-with-pitch-in-app-inventor-2