[FREE] Pedometer Sensor (not accelerometer)

First excuse me, my English is not my native language, I use the google translator.

This is my first extension, it is a pedometer that uses the device's step sensor (not the accelerometer) Sensor.TYPE_STEP_COUNTER

Not all devices have it, so there is a Boolean block that will tell us if the sensor exists in the device.

ispresent

The sensor counts all the steps since the device is turned on and we start the sensor, if we restart the device the sensor will start with a value of 0

What the Start and Stop blocks do is start or stop the Listener to listen to the sensor and obtain the steps.

start

stop

If the Listener is on, an event will occur that will return the steps performed so far (WalkStep)

walkstep

In order not to lose data from the steps performed when the device is restarted in the .aia file, there is a procedure that solves this problem.

The pedometer works very well and the battery consumption is low, if you do not kill the application through the block closeapp or with the device's task cleaner, the pedometer continues counting steps even if it is asleep.

If you use the stop block it will also stop counting steps

stop

SensorPedometer.aia (99.9 KB)

com.mariosoft.SensorPedometer.aix (8.4 KB)

9 Likes

Very well presented intro to your Extension Mario. English is fine. I'm sure a number of people will have a use for this Extension.

1 Like

What improvements does this extension bring to the built-in component of appinventor?

1 Like

The Pedometer component of AppInventor, uses the accelerometer to count steps (through software programming), this extension does not use the accelerometer but the hardware sensor that many Sensor.TYPE_STEP_COUNTER devices carry, with less battery use and better reliability

6 Likes

Now everything is clear :). Good job.

1 Like

why is there a yellow warning triangle in all your screenshots?
Taifun

2 Likes

He must have clicked on "Show Warnings".

2 Likes

Cool extension @Mario1. And your English is fine. Coming from a native English speaker who failed grammar class twice (but I passed all my other languages with A's :laughing: ), it is fine.

2 Likes

I have activated "Show warnings" and the blocks are outside their container to be able to capture the block individually

3 Likes

pedometer reset button missing

2 Likes

please add the reset block

2 Likes

May someone explain me the difference between SingleStep and WalkStep please?

Thanks in advance

I just searched about the difference, but didn't find a clear answer. But since you haven't received a better reply yet, here's my guess:
It seems to me that "SingleStep" counts all the steps you do, while "WalkSteps" only counts them when the app assumes you are actually walking, for instance, doesn't count isolated steps. I tried moving casually around a fixed spot without going nowhere, and noticed that the "walk steps" didn't count all my steps.

Hello and Happy New Year

After some comments such as that the extension was missing some functions such as the "Reset", I attached an .aia in which it is indicated how to include this function and others more only with the components included in app inventor.
What the extension facilitates is access to the TYPE_STEP_COUNTER sensor and the detection of a step through it.
As I indicated in the initial post: "The sensor counts all the steps since the device is turned on and we start the sensor, if we restart the device the sensor will start with a value of 0"
This means that without any type of service, it will always count the steps we have taken without losing any.
In .aia, you will find a way to control all this and create a true exercise control app.

All the best

StepsCounter.aia (124.0 KB)

2 Likes

Thankyou, let me check it. May I know if this extension can function in all devices?

It would work on any device that has the step detector sensor

1 Like

thank you so much, But i couldn't use it in my device, it said the activity can't start

What happens, if you use the IsPresent method?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Thanks for sharing it.
Can the steps be reset to zero for counting on another day?

Screenshot_1
Screenshot_2
I want to put a reset button on the pedometer, I've tried but haven't found the way yet.
Can anyone help me find him?

I find the second pedometer very good, much better, but there it needs a lot more knowledge to make it work the way I want it to.
Well done Mario1

The second one, which is much richer, I will try outside on a walk in the countryside to see it better.
I just tried it, but I think it counts half the steps.
E.g. I take 20 steps and that makes 10