{"id":5472,"date":"2024-12-31T15:29:01","date_gmt":"2024-12-31T15:29:01","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=5472"},"modified":"2024-12-31T15:29:02","modified_gmt":"2024-12-31T15:29:02","slug":"mit-app-inventor-pedometer-mit-app-inventor-step-counter-step-tracker-app-inventor","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/mit-app-inventor-pedometer-mit-app-inventor-step-counter-step-tracker-app-inventor\/","title":{"rendered":"MIT App Inventor Pedometer | MIT App Inventor Step Counter | Step Tracker App Inventor"},"content":{"rendered":"\n<p>Hello friends,<\/p>\n\n\n\n<p>Welcome to Obsidian Soft. In this tutorial, I will show you how to make a simple step counter app in MIT App Inventor. I will also show the approximate distance covered in this app. You can expand on this MIT App Inventor Pedometer app, and ask the user to enter his\/her weight, height, and gender and calculate calories burned too.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/snake20game2025.png\" alt=\"\"\/><\/figure>\n<\/div>\n\n\n<p>So, let\u2019s begin. Open MIT App Inventor and start a new project. Call it StepCounter.<\/p>\n\n\n\n<p>In screen 1 \u2018s properties, make align horizontal and align vertical both center and the background color: gray. Change the title to Step Counter. And make the screen orientation: portrait.<\/p>\n\n\n\n<p>Drag and drop a&nbsp;<strong>button<\/strong>&nbsp;from the&nbsp;<strong>User Interface<\/strong>&nbsp;onto the Viewer. Rename to startStopBtn. Make the background color: green. Make the font: bold and font size: 22. Make the height 10% and width 30%. Also, make the shape rounded and change the text to \u201cStart\u201d.<\/p>\n\n\n\n<p>Select the button and duplicate it by pressing&nbsp;<strong>Ctrl + C and Ctrl + V<\/strong>&nbsp;for Windows and&nbsp;<strong>Command + C and Command + V<\/strong>&nbsp;for MacOS.<\/p>\n\n\n\n<p>Rename to resetBtn, make the background color: orange and change the text on it to \u201cReset\u201d.<\/p>\n\n\n\n<p>Drag and drop a&nbsp;<strong>label<\/strong>&nbsp;from&nbsp;<strong>User Interface<\/strong>&nbsp;below this resetBtn.<\/p>\n\n\n\n<p>Rename to stepsLbl. In its properties, make font: bold and font size: 30. Change textColor to white and change the text to \u201c0 steps\u201d.<\/p>\n\n\n\n<p>Select this stepsLbl. Again duplicate it. Rename to distanceLbl. Change textColor to orange and change the text to \u201cYou walked 0 m\u201d.<\/p>\n\n\n\n<p>Drag and drop a&nbsp;<strong>pedometer<\/strong>&nbsp;from the&nbsp;<strong>Sensors<\/strong>. This is a non-visible component. In its properties, change its&nbsp;<strong>stopDetectionTimeout<\/strong>&nbsp;to 1000 ms to make it more responsive. I will also optionally change the&nbsp;<strong>strideLength<\/strong>&nbsp;to 0.5 m as I felt that it was more accurate for me this way.<\/p>\n\n\n\n<p>Lastly, I will also add an empty label between the buttons for spacing. Remove text from it and make height: 2%.<\/p>\n\n\n\n<p>Our screen design for MIT App Inventor Pedometer app is done so go to the blocks section.<\/p>\n\n\n\n<p>You might be wondering, where the stop button is. Our startStop button is basically a toggle button and we will switch between the two states of start and stop.<\/p>\n\n\n\n<p>So, get the startStopBtn\u2019s click event, plug in the if\/else block from&nbsp;<strong>Control<\/strong>&nbsp;in it, and use a&nbsp;<strong>logic<\/strong>&nbsp;green block to check in the if condition if startStopBtn\u2019s text is equal to the text block \u201cStart\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/8JLKh2ECsN31p8UYEG5gqblzAmlskAHqbPTFwYg5m53m7E8F_thgOCUF8n6X7gxhbvfiPu37WMA4fgEoU_8X3M965BQzE3jbdHRvGYD6HFdRFxMb1hYd_ROV_cl69Rz0HafnA6VX1JvKPfuQhSdmfoY.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>In case the button\u2019s text is equal to Start and the if condition is true, then this means that the button was in the start state when it was pressed so we have to start the pedometer. So, first of all, start the pedometer by plugging in its start block. Next, we have to change the button state to the Stop state. So, change the text to \u201cStop\u201d and change the background color of the button to red.&nbsp;<\/p>\n\n\n\n<p>In the other scenario, we don\u2019t have to specifically check for the Stop state as our button can only have two states: Start and Stop. So, if start is not true then this means that the button was in a stop state when its click event was triggered. So, now we have to stop the pedometer. So, use the pedometer\u2019s stop block. And in the end, change the button state to start by changing its color and text accordingly.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/EypkoTXdOSCPtbtEAMq4ya68RZdtRuhcYvQwQ5hyDhWNP50Mpk5zD7kq-1tqgKgR-Ne8RtZSwftB23Xk0OUGaWtQdgaZ7Mn5QFiXq7Tc8ii2U3XB9p-Yd3ct8uxV8BklR09jlSGEpkXGSFcPfnifoE.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Be careful with the spelling of Start. It should be the same as what you used in the designer for startStopBtn\u2019s properties.<\/p>\n\n\n\n<p>Next, get the pedometer.WalkStep event. I will not use the simple step event as according to the MIT App Inventor documents, WalkStep is a much more accurate counter of walking as it also evaluates whether the step is accompanied by a forward motion and that is what an actual walking step should be. So, you can see that the pedometer sensor component of MIT App Inventor has made making a&nbsp; step counter app super simple.<\/p>\n\n\n\n<p>Now, get the walk steps and distance from the event and show them to the user by using join blocks.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/B5O5vgVJNwDARcrcjlsLA5qVBjxEcrJVIIDYlGbV1H7xbCxSpyVHtmXEppD68YyWvTrJiwFyR60TRKcfHdzzA79dwOFImrqiQ6IvDPgeK8-SvuniSBpIiSXrM9cgGFyU0YSs0N60p8Ab2mp9s9HzP7I.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>In the case of resetBtn\u2019s click event, just reset the pedometer and reset the stepsLbl and distanceLbl to zero values.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/Et_LFF3bREF3f83bpS-McvxKJ_ox75OZvv3_XuQZp2qsacmF2fx0gwlHwaBlJTJJ85dalyyf4ssx8To-5Ivi3wmvPpqsXM2eDtkEJSYsfuTlYAgB9hxsWkYzyO4PaYlP0Bk1nz5dr_QST1be-eBhF84.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>The step counter app using&nbsp;MIT App Inventor pedometer&nbsp;is done and it was super easy making this fun step counter app using the pedometer sensor component of MIT App Inventor.<\/p>\n\n\n\n<p><strong>You can download the project file from the link below:<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1-9GSXrKcJi3b9YVeWBXD8MFneyctYjwm\/view?usp=sharing\" target=\"_blank\" rel=\"noopener\"><strong>Step Counter AIA File<\/strong><\/a><\/p>\n\n\n\n<p>Thank you for reading this tutorial. I hope you liked this tutorial. Please like and share it.<\/p>\n\n\n\n<p>If you like my tutorials, consider supporting me:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><a href=\"https:\/\/obsidiansoft.gumroad.com\/l\/cxdft\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"196\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png\" alt=\"\" class=\"wp-image-5381\" style=\"width:198px;height:auto\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png 372w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1-300x158.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>You can also have a look at the video here:<a href=\"https:\/\/youtu.be\/9Ur1YRCAesA\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"MIT App Inventor Pedometer | MIT App Inventor  Step Counter | Step Tracker App Inventor\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/9Ur1YRCAesA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p><a href=\"https:\/\/youtu.be\/9Ur1YRCAesA\" target=\"_blank\" rel=\"noopener\"><\/a>Please like my videos and share them with your friends and family. Also, subscribe to my channel and press the bell icon so you don\u2019t miss any of the great projects I have planned for you.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p>Please like my social media pages for more educational resources and tips.<\/p>\n\n\n\n<p>Facebook:<a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/p>\n\n\n\n<p>Instagram:<a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.instagram.com\/obsidiansoftapps\/<\/a><\/p>\n\n\n\n<p>Pinterest:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.pinterest.co.uk\/obsidiansoft\/_created\" target=\"_blank\" rel=\"noopener\">https:\/\/www.pinterest.co.uk\/obsidiansoft\/_created<\/a><\/p>\n\n\n\n<p>For links to free educational apps, have a look at the\u00a0<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\">educational apps page<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends, Welcome to Obsidian Soft. In this tutorial, I will show you how to make a simple step counter app in MIT App Inventor. I will also show the approximate distance covered in this app. You can expand on this MIT App Inventor Pedometer app, and ask the user to enter his\/her weight, height, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5472","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=5472"}],"version-history":[{"count":1,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5472\/revisions"}],"predecessor-version":[{"id":5474,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5472\/revisions\/5474"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=5472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}