Skip to first unread message

Pascal Rousset

unread,
Jun 5, 2017, 8:11:29 PM6/5/17
to MIT App Inventor Forum
The orientation sensor does not work on all smartphones. It works for example on a Sony but not on a Samsung

SteveJG

unread,
Jun 5, 2017, 9:01:35 PM6/5/17
to MIT App Inventor Forum
Does the phone actually have an orientation sensor?  Some phones do not.

Did you check if the sensor is available?
Available
Indicates whether the orientation sensor is present on the Android device.



I have a Samsung Tab II tablet; the orientation sensor works well.

Code the blocks to find out if your Samsung phone has an orientation sensor .. if you test and it is false; your device does not have a sensor.

If it tests true, please tell us what model of phone and what operating system it is using.  Also tell us why you think the sensor is not working.

Regards,
Steve


Pascal Rousset

unread,
Jun 6, 2017, 8:09:39 PM6/6/17
to MIT App Inventor Forum
Thank you for your reply. AppInventor tells me there is no orientation sensor on my SAMSUNG J5; But when I type * # 0 * #, the accelerometer gives me not only the acceleration in the 3 directions but also the angles! How to recover the angles yet available on appinventor?
cordially

SteveJG

unread,
Jun 6, 2017, 8:37:39 PM6/6/17
to MIT App Inventor Forum
Your Samsung phone does not have an orientation sensor so you cannot use it to make a compass.  You cannot use the accelerometer  object in App Inventor to make it work as a compass.


What you can do with  the accelerometer  is in the object's document:

AccelerometerSensor

Non-visible component that can detect shaking and measure acceleration approximately in three dimensions using SI units (m/s2). The components are:

  • xAccel: 0 when the phone is at rest on a flat surface, positive when the phone is tilted to the right (i.e., its left side is raised), and negative when the phone is tilted to the left (i.e., its right size is raised).
  • yAccel: 0 when the phone is at rest on a flat surface, positive when its bottom is raised, and negative when its top is raised.
  • zAccel: Equal to -9.8 (earth's gravity in meters per second per second when the device is at rest parallel to the ground with the display facing up, 0 when perpendicular to the ground, and +9.8 when facing down. The value can also be affected by accelerating it with or against gravity.

Properties

Available
Enabled
MinimumInterval
The minimum interval, in milliseconds, between phone shakes
Sensitivity
A number that encodes how sensitive the accelerometer is. The choices are: 1 = weak, 2 = moderate, 3 = strong.
XAccel
YAccel
ZAccel

Events

AccelerationChanged(number xAccel, number yAccel, number zAccel)
Indicates the acceleration changed in the X, Y, and/or Z dimensions.
Shaking()
Indicates the device started being shaken or continues to be shaken.

Methods

none



Regarding " But when I type * # 0 * #, the accelerometer gives me not only the acceleration in the 3 directions but also the angles! How to recover the angles yet available on appinventor?", I do not understand what you are talking about Pascal. Could you please explain?

Regards,
Steve





Abraham Getzler

unread,
Jun 7, 2017, 1:02:56 PM6/7/17
to MIT App Inventor Forum
Is * # 0 * # an Easter egg for that phone model?

ABG

Evan Patton

unread,
Jun 7, 2017, 6:44:36 PM6/7/17
to MIT App Inventor Forum
Hi Pascal,

Likely the other three angles you receive are not orientation from an orientation sensor but rather angular velocity from a gyroscope. Do you see the same/similar values if you try to read them from the gyro?

Evan

Pascal Rousset

unread,
Jun 7, 2017, 7:26:57 PM6/7/17
to MIT App Inventor Forum
Hi
My SAMSUNG J5 will only have a STM K2HH accelerometer with an LMS303D chip that measures the orientation. In any case, the phone test gives me the angles! Is it possible to retrieve these angles on AppInventor?

Pascal Rousset

unread,
Jun 7, 2017, 7:34:10 PM6/7/17
to MIT App Inventor Forum
Hi
My SAMSUNG J5 will only have a STM K2HH accelerometer with an LMS303D chip that measures the orientation. In any case, the phone test gives me the angles! Is it possible to retrieve these angles on AppInventor? Cordialy
Reply all
Reply to author
Forward
0 new messages