Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Pedometer

70 views
Skip to first unread message

Jennifer K. Nielsen

unread,
May 26, 2019, 9:26:33 PM5/26/19
to MIT App Inventor Forum
My name is Jennifer Nielsen. I`m trying to create an app that uses the pedometer, but I dont think ti`s working, or if it is, it`s not showing me the distance. what can I do to fix that?

ABG

unread,
May 27, 2019, 10:14:50 AM5/27/19
to MIT App Inventor Forum
Post your Downloaded Blocks Image?
ABG

Jennifer K. Nielsen

unread,
May 27, 2019, 10:31:20 AM5/27/19
to MIT App Inventor Forum
I`m submitting my .aia file
Distance (1).aia

SteveJG

unread,
May 27, 2019, 10:35:59 AM5/27/19
to mitappinv...@googlegroups.com
Either post an image of your Blocks Jennifer or look at the pedometer examples in the MIT gallery.

pedometer2.PNG




How the pedometer works is discussed here Pedometer

Not showing the distance?   Are you converting the number of steps taken into distance?    


StrideLength
Set the average stride length in meters.
WalkSteps
the number of walk steps taken since the pedometer has started.

Events

SimpleStep(number simpleSteps, number distance)
This event is run when a raw step is detected
WalkStep(number walkSteps, number distance)
This event is run when a walking step is detected. A walking step is a step t

Be aware, the distance reported is in meters.   If you want feet, you will have to use some Blocks to convert    One meter is 3.28 feet.



Does that help Jennifer?

Regards,
Steve

ABG

unread,
May 27, 2019, 10:48:53 AM5/27/19
to MIT App Inventor Forum
You don't have any Event blocks yet for
the Pedometer.

ABG



blocks.png

Jennifer K. Nielsen

unread,
May 27, 2019, 10:55:00 AM5/27/19
to MIT App Inventor Forum
Is there how I can do that in the gallery?

SteveJG

unread,
May 27, 2019, 11:52:00 AM5/27/19
to mitappinv...@googlegroups.com
The Gallery apps probably work,There is probably an example aia in the Gallery that will work for your pedometer.   You have to look and find an example you are happy with.

However, you are attempting to use the pedometer along with the Maps component and LocationSensor.

You have many errors unfortunately.   Nice ideas, not well executed.

pedometerIssues.PNG

I marked some.    You are not using the ActivityStarter correctly.  Using your methodology  you won't get the results you expect

Your Map procedure is incorrect.  You can not assign the Map1.Location sensor to anything other than  the standard LocationSensor ordinarily.   FeatureCollection.Visible can only be true or false.

The Gallery examples will help you work with the pedometer.

Here is a way to work with the ActivityStarter to display your location on a google Map .https://groups.google.com/forum/#!category-topic/mitappinventortest/mXaTXbxwGUg  It shows how to find things using the ActivityStarter...not exactly what you want but it could be adapted.

. Here is a simple AS example showing how you can use the AS to post a map of your current location using the LocationSensor: 

activitystarterMap.PNG




Here is a way to use the Map component to display a map instead of the ActivityStarter  .and the Map component

simpleMapcomponentBlocks.PNG





Perhaps someone could provide more specific advice if you describe what your entire Project is supposed to do. Consider learning  how to do one thing at a time and then, after you have the parts working, put them together.

You have multiple programming issues.  Here are some resources to help you learn to use the AI2 tools  A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  

How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .



Try some things, if you still have issues, return here and ask again.  Someone will help. You will have an interesting Project.

-- Steve

Jennifer K. Nielsen

unread,
May 27, 2019, 12:59:49 PM5/27/19
to MIT App Inventor Forum
Hi Steve, thank you for your answer. I'll try to work with that.
My project is an app that will be used in small airplanes such as Cessna 170 series. I want it to show the distance that the pilot already ran before the take off, and since he already know how long is the runaway, he know how much has left before taking off or aborting the flight

SteveJG

unread,
May 27, 2019, 1:34:09 PM5/27/19
to mitappinv...@googlegroups.com
Stall speed 50 knots
length of run way perhaps 1000 to 2000 feet.

Do you really want to depend on the LocationSensor which may have an Accuracy of reasonably 2 to 50 meters, depending on conditions.
50 mph translates to 73 feet per second.  That means the aircraft will be at the end of the runway within  14 to 28   seconds after releasing the brakes.

The LocationSensor requires about 10 seconds to achieve a satellite fix (even if someone chooses to sample once every one second and conditions are ideal) and update it'd location coordinates.  Consider how the LocationSensor and GPS receiver works Using the Location Sensor .  There are two tutorials there that demonstrates how your GPS receiver in your tablet or cell phone work.  It yalks about how reliable values reported are.

Can you make an app to do this?   Sure.  I wouldn't fly with you if you depended on it. :(   

Here is how you could build the app:

When you set your brakes; get a GPS satellite fix.    Experiment with the TimeInterval (10000 ms might work (10 seconds)... smaller intervals get iffy).  Save the latitude/longitude 
in a variable... previousLocation 

When the LocationChanged event fires, calculate the distance traveled so far.   Compare previousLocation with current location.  There are several ways to do this.  You might use either Math blocks or the built in routines in the Maps component.   The calculation will tell you how far the pilot 'ran' before that new location .

I would look down the runway and say' ok, I got 5 more seconds to wheels up or I'll crash instead.    However have fun with your app.

You do not need the pedometer component.  This app can be made with the LocationSensor alone   or using the Map component + LocationSensor. and should include a warning to the aviator.

Good luck.  Please consider the issues before you attempt to make your life exciting.This would be great if the gps receiver was more accurate and could update faster but the technology available in a cell phone isn't going to be safe.  Show us your progress and ask questions if you get stuck.

ABG

unread,
May 27, 2019, 2:33:41 PM5/27/19
to MIT App Inventor Forum
I can't get the runway pedometer implementation idea out of my mind ...
ABG

Jennifer K. Nielsen

unread,
May 29, 2019, 4:41:51 PM5/29/19
to MIT App Inventor Forum
Hello,

I got stuck again. I`ve changed pretty much everything in it and still unable to make it work.
Distance.aia

Jennifer K. Nielsen

unread,
May 30, 2019, 11:28:33 AM5/30/19
to MIT App Inventor Forum
Just want to say that i managed to finish it and its good to go now
Reply all
Reply to author
Forward
0 new messages