78146

Event driven sign with “pitch” in App Inventor 2

Question:

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:

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/H7qgy.png" data-original="https://i.stack.imgur.com/H7qgy.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

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.

Answer1:

let me provide my given comments as answer now:

You should use >30 or <-30 instead, because else the if statement always is true.<br /> 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.

Recommend

  • Distribute images evenly to columns in gallery
  • UIActionSheet orientation
  • How can I rotate a UIViewController to its supported interface orientation when navigating to it?
  • How to get phone heading for augmented reality?
  • Add the % on tab when working with HAML on vim
  • Data Type of Columns in a List - R
  • Valums Ajax file Upload handle the up. file?
  • Slow performance in hybrid AngularJS and Angular application in Safari
  • How to resize image if the image is bigger than Textbox.But it not increase scale if smaller
  • Return null in boolean to checkbox state converter in XAML
  • Checking a play current mode makes an error occur
  • Fat binaries in iOS
  • Building jamvm 1.5.4 on OS X Lion
  • runtime error when linking ffmpeg libraries in qt creator
  • Getting media player state in windows phone 7
  • How to make R's read_csv2() recognise the text characters properly
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • ViewController With Transparent Background Entering Current ViewController With Push Transition
  • How do I get HTML corresponding to current DOM tree?
  • OpenGL ES texture problem, 4 duplicate columns and horizontal lines (Android)
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • CSS Linear-gradient formatting issue accross different browsers
  • Android screen density dpi vs ppi
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • req.body is undefined - nodejs
  • Sony Xperia Z Tablet not found by adb
  • How would I use PHP exceptions to define a redirect?
  • How to extract text from Word files using C#?
  • Perl system calls when running as another user using sudo
  • Can I make an Android app that runs a web view in Chrome 39?
  • Symfony2: How to get request parameter
  • How to show dropdown in excel using jrxml (jasper api)?
  • Release, debug version and Authorization Google?
  • How can I estimate amount of memory left with calling System.gc()?
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • need help with bizarre java.net.HttpURLConnection behavior