{"id":520,"date":"2016-04-25T08:55:53","date_gmt":"2016-04-25T06:55:53","guid":{"rendered":"http:\/\/home.et.utwente.nl\/slootenvanf\/?p=520"},"modified":"2016-04-25T12:46:10","modified_gmt":"2016-04-25T10:46:10","slug":"control-catapult-app","status":"publish","type":"post","link":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/","title":{"rendered":"Remote control a catapult with an App build with App Inventor"},"content":{"rendered":"<p><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/19\/control-lego-mindstorms-phone-app-inventor\/\">In this previous article<\/a> we learned how to build an App with App Inventor and connect it to a Lego Mindstorms NXT. Now we will extend that App to control a Catapult robot. If you have not done so already, first build the Catapult.<\/p>\n<p>Now that you are able to connect your phone to the NXT, it is time to make the firing system work. After the following steps, you will be able to fire your Catapult from a distance with just one push of a button!<\/p>\n<h2>Step 1 \u2013 Edit the user interface<\/h2>\n<p><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_ui.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-525 alignright\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_ui.png\" alt=\"catapult_app_ui\" width=\"275\" height=\"374\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_ui.png 575w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_ui-221x300.png 221w\" sizes=\"auto, (max-width: 275px) 100vw, 275px\" \/><\/a>In order to fire the Catapult, you will need a firing button. Switch back to the Designer. Drag a Button to the Viewer. Label it \u201cFire\u201d and rename it to \u201cFire\u201d. You can change the font size, as well as the width and height of the button in the Properties window if you like. For this example, we changed the <em>FontSize<\/em> to 20, the <em>Height<\/em> to 80 pixels and set <em>Width<\/em> to \u201cFill parent\u201d, this means the button will span the full width of the screen.<br \/>\nThe firing mechanism is operated by a motor. Motors are controlled by the \u201cNxtDrive\u201d block, drag it onto the viewer like you did with the \u201cNxtDirectCommands\u201d block. In the Properties Window, set the <em>BluetoothClient<\/em> to BluetoothClient1. Set <em>DriveMotors<\/em> to C (as the motor operating the firing mechanism should be connected to port C on your NXT brick), leave <em>StopBeforeDisconnect<\/em> on and set <em>WheelDiameter<\/em> to 10.<\/p>\n<h2>Step 2 \u2013 Program the firing mechanism<\/h2>\n<p><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_block2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-524 alignright\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_block2.png\" alt=\"catapult_app_block2\" width=\"407\" height=\"155\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_block2.png 407w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/catapult_app_block2-300x114.png 300w\" sizes=\"auto, (max-width: 407px) 100vw, 407px\" \/><\/a>All that has to be done now, is to let the motor move when the fire button is pressed. Switch back to Blocks. You may have noticed that Fire and NxtDrive1 have been added to the list of blocks. Select \u201cFire\u201d and click on the block \u201cWhen Fire.Click\u201d. This block will work as an event-handler for when the firing button is pressed.<br \/>\nUnder Blocks, select NxtDrive1 and find the block \u201ccall NxtDrive1.MoveForward\u201d. This block will power the engine in the forward direction. Add two value blocks, one for power and one for distance. Set the power to 60 and the distance to 10.<\/p>\n<h2>Step 3 \u2013 Fire!<\/h2>\n<p>Connect your phone to the NXT brick again, and check whether the firing mechanism works.<\/p>\n<p>Contributed\u00a0by\u00a0Yanick Brezet.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this previous article we learned how to build an App with App Inventor and connect it to a Lego Mindstorms NXT. Now we will extend that App to control a Catapult robot. If you have not done so already, first build the Catapult. Now that you are able to connect your phone to the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[3],"tags":[108,116,109,102,114],"class_list":["post-520","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-education","tag-app","tag-catapult","tag-inventor","tag-lego","tag-remote"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Remote control a catapult with an App build with App Inventor - vanslooten.com<\/title>\n<meta name=\"description\" content=\"Remote control a catapult with an App build with App Inventor\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Remote control a catapult with an App build with App Inventor - vanslooten.com\" \/>\n<meta property=\"og:description\" content=\"Remote control a catapult with an App build with App Inventor\" \/>\n<meta property=\"og:url\" content=\"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/\" \/>\n<meta property=\"og:site_name\" content=\"vanslooten.com\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-25T06:55:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-04-25T10:46:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/Catapult.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"582\" \/>\n\t<meta property=\"og:image:height\" content=\"503\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Fjodor van Slooten\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fjodorvs\" \/>\n<meta name=\"twitter:site\" content=\"@fjodorvs\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fjodor van Slooten\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/\"},\"author\":{\"name\":\"Fjodor van Slooten\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\"},\"headline\":\"Remote control a catapult with an App build with App Inventor\",\"datePublished\":\"2016-04-25T06:55:53+00:00\",\"dateModified\":\"2016-04-25T10:46:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/\"},\"wordCount\":380,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\"},\"image\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/Catapult.jpg\",\"keywords\":[\"app\",\"catapult\",\"inventor\",\"lego\",\"remote\"],\"articleSection\":[\"Education\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/\",\"name\":\"Remote control a catapult with an App build with App Inventor - vanslooten.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/Catapult.jpg\",\"datePublished\":\"2016-04-25T06:55:53+00:00\",\"dateModified\":\"2016-04-25T10:46:10+00:00\",\"description\":\"Remote control a catapult with an App build with App Inventor\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/#primaryimage\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/Catapult.jpg\",\"contentUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/Catapult.jpg\",\"width\":582,\"height\":503},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2016\\\/04\\\/25\\\/control-catapult-app\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Remote control a catapult with an App build with App Inventor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#website\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/\",\"name\":\"vanslooten.com\",\"description\":\"Personal website of Fjodor van Slooten\",\"publisher\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\",\"name\":\"Fjodor van Slooten\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\",\"contentUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\",\"width\":300,\"height\":214,\"caption\":\"Fjodor van Slooten\"},\"logo\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\"},\"sameAs\":[\"http:\\\/\\\/vanslooten.com\",\"https:\\\/\\\/x.com\\\/fjodorvs\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Remote control a catapult with an App build with App Inventor - vanslooten.com","description":"Remote control a catapult with an App build with App Inventor","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/","og_locale":"en_US","og_type":"article","og_title":"Remote control a catapult with an App build with App Inventor - vanslooten.com","og_description":"Remote control a catapult with an App build with App Inventor","og_url":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/","og_site_name":"vanslooten.com","article_published_time":"2016-04-25T06:55:53+00:00","article_modified_time":"2016-04-25T10:46:10+00:00","og_image":[{"width":582,"height":503,"url":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/Catapult.jpg","type":"image\/jpeg"}],"author":"Fjodor van Slooten","twitter_card":"summary_large_image","twitter_creator":"@fjodorvs","twitter_site":"@fjodorvs","twitter_misc":{"Written by":"Fjodor van Slooten","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/#article","isPartOf":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/"},"author":{"name":"Fjodor van Slooten","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd"},"headline":"Remote control a catapult with an App build with App Inventor","datePublished":"2016-04-25T06:55:53+00:00","dateModified":"2016-04-25T10:46:10+00:00","mainEntityOfPage":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/"},"wordCount":380,"commentCount":0,"publisher":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd"},"image":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/#primaryimage"},"thumbnailUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/Catapult.jpg","keywords":["app","catapult","inventor","lego","remote"],"articleSection":["Education"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/","name":"Remote control a catapult with an App build with App Inventor - vanslooten.com","isPartOf":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#website"},"primaryImageOfPage":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/#primaryimage"},"image":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/#primaryimage"},"thumbnailUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/Catapult.jpg","datePublished":"2016-04-25T06:55:53+00:00","dateModified":"2016-04-25T10:46:10+00:00","description":"Remote control a catapult with an App build with App Inventor","breadcrumb":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/#primaryimage","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/Catapult.jpg","contentUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2016\/04\/Catapult.jpg","width":582,"height":503},{"@type":"BreadcrumbList","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2016\/04\/25\/control-catapult-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/home.et.utwente.nl\/slootenvanf\/"},{"@type":"ListItem","position":2,"name":"Remote control a catapult with an App build with App Inventor"}]},{"@type":"WebSite","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#website","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/","name":"vanslooten.com","description":"Personal website of Fjodor van Slooten","publisher":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/home.et.utwente.nl\/slootenvanf\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd","name":"Fjodor van Slooten","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg","contentUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg","width":300,"height":214,"caption":"Fjodor van Slooten"},"logo":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg"},"sameAs":["http:\/\/vanslooten.com","https:\/\/x.com\/fjodorvs"]}]}},"_links":{"self":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/posts\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/comments?post=520"}],"version-history":[{"count":0,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/posts\/520\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/media\/522"}],"wp:attachment":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/media?parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/categories?post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/tags?post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}