[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)

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

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

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

3 Likes

Now everything is clear :). Good job.

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

1 Like

He must have clicked on "Show Warnings".

1 Like

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.

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

3 Likes