Event driven sign with “pitch” in App Inventor 2

跟風遠走 提交于 2019-12-25 01:55:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!