When I tried to compare the x, y and z to know if x is smaller, the blocks are not working,
Will it work if we make the x, y, z as global variables and then try to know which value is smaller? Il get time at night, will expeiment it at that time. Will try by including TinyDB as well.
This possibly will work for you.
accelerratorAlarm.aia (48.7 KB)
The simple acceleration example app recognizes Tilting up and down and left/right using the x and y accel. No need to use z axis and compare it to any other axis. Plays a sound when acceleration is within specific values.
Experiment with to make it perform as you want.
Okay, may I know
When phone position is LEFT, which value (x or y or z) will raise during movement like forward and backward?
You tried and experimented with the app, so you probably already figured this out.
-
when phone is tilted LEFT (red) x axis acceleration is providing negative values.
-
when phone is tilted RIGHT (green) x axis acceleration is providing positive values
-
when phone top is tilted up (light red) y axis acceleration is providing positive values
-when the phone phone top is tilted down (cyan) y axis acceleration is providing negative values. -
when no markers are shown the phone is probably resting on a table top (the triggering acceleration is not in the range programed).
-
both Right and Tilt Up or down and Left and Tilt Up or down display simultaneously when the accelerometer recognizes both x and y acceleration positive or negative values at the same time. Notice that the two sound files play together when this happens.
Can we introduce clock within this app?. ie, If the phone stays in LEFT for 10 seconds, then play music (or do any given task).
Can we merge orientation sensor as well, so it may be possible to distinguish the movement value of accelerometer from tilt value.
ie, If 'orientation sensor & Accelerometer sensor' = LEFT, then the exceeded accelerometer value is Movement value/acceleration value. ie, both sensors may match in showing the position/tilt of the phone but accelerometer shows extra value, that is what 'Acceleration Value'. I am speaking in imagination but it may be possible?.
So, HOW CAN WE MODIFY THE SAME APP (AccelerometerAlarm) to say left, right etc. for orientation sensor as well.
...by adding an Orientation sensor
and adding labels 5,6 and 7 to l handle roll (left/right tilting).
you can code pitch and sounds yourself.
When I tried this, the 'Not Shaking' block is not working. Can you guide me?
Did you start the clock timer ?
start means enabling it, am I right?
Okay, now it is working.
Which sensor will be helpful to know if the phone is kept within pocket (Shirt or Pant)?
This app is working fine only if these two blocks (related to pedometer) are disabled, may I know why? But, I need these two blocks as well.
The Pedometer component uses the accelerator hardware in your phone.
Pedometer
This component keeps count of steps using the accelerometer.
so it is probable BOTH a Pedometer and Accelerometer component cannot be use simultaneously in an App Inventor app.
But, here both sensors are working together without error/faults. So, is there any possibility to solve the error of the above app.
deleted
Probably because you do not use the components simultaneously in your example. Your Clock allows your app to share accelerator hardware use evidently by enabling/disabling the Clock.. My guess is this works but not very well. If it works for your app, rejoice.
Okay, I am trying to solve this in other possible ways as well.