2017년 4월 19일 수요일

pedometer


I would like to build a pedometer app in app inventor. I am not quite sure
how to do this. I'm new to AI and not sure where to start. I thought I could use an Accelerometer
Sensor but I don't know if it is possible or not. If possible how would I
calibrate it to count the steps accurately? Any info/help will be
appreciated. Thanks

--
Here is where the accelerator is described.  http://ai2.appinventor.mit.edu/reference/components/sensors.html  You might also look at the orientation.sensor.

The acceleratorSensor has all these features:

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 perpindicular 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 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.

It seems very likely that all the functions you might need are there.   As to "If possible how would I calibrate it to count the steps accurately?", what I would do is to program what you think should happen when the phone/tabled detects a shock.   Experiment with the Sensitivity   1, 2, 3 are your choices... what weak means, I have no Idea, it might be the slightest movement/shock or the strongest.... so I would try 1 or 2 first .... set Accelormeter.Sensitivity to    1  or   3.

You got plenty of parameters to deal with.  Read the documentation and experiment with settings.

How a pedometer works is it counts the shocks if 'feels.'     You can program the app and walk with it and see if it increments a value .. counts the shocks as you walk.
Some people use only the number of steps taken to calibrate a pedometer.  In that case, if you count the steps and it counts on each shock, you are done.

If you need to measure distance,   do this.... lay out a course on a side walk.... 100 feet, 100 meters, whatever.  then you walk it, without the pedometer.  Count the number of paces you take.     paces/100 feet  is your stride... you calibrated for your stride.      Have your little sister or daughter or son, walk the same course.  He/she will have a different value.    Make a chart on paper and record the values.   Each of these is a conversion value for a different stride length.    Once you know several values you can use a listpicker to list various strides, then when you select them, the app will know how to convert the number of steps for that person into feet or meters or whatever.

Did you follow that?     Next step (terrible pun), is to show us some blocks.   Did this work for you?

Here are some links that might help.... how other people approached this problem    https://www.google.com/search?q=pedometer+with+app+inventor&oq=pedometer+with+app+inventor&aqs=chrome..69i57.5472j0j4&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

If you need ideas, it is frequently prudent to use a search engine , you may be surprised what you find to help you..   search for   pedometer app inventor   ....amazing tool.

--

댓글 없음:

댓글 쓰기