{"id":4474,"date":"2019-11-05T16:36:03","date_gmt":"2019-11-06T00:36:03","guid":{"rendered":""},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T07:00:00","slug":"4474","status":"publish","type":"post","link":"https:\/\/www.vernier.com\/til\/4474","title":{"rendered":"Can I program my mBot via Bluetooth with mBlock 5 software?"},"content":{"rendered":"<p>Yes. There are two distinct methods for programming your mBot with the mBlock 5 software via Bluetooth. In both cases we recommend using the <a href=\"\/product\/makeblock-bluetooth-dongle\/\">Makeblock<sup>&reg;<\/sup> Bluetooth<sup>&reg;<\/sup> Dongle<\/a> (<nobr>MB-BLE<\/nobr>), which makes it easy to pair mBot to your computer or Chromebook.<\/p>\n<p><b>Pair the Makeblock Bluetooth Dongle to your mBot<\/b><\/p>\n<p>1. Turn on your mBot.<br \/>\n2. Connect the Makeblock Bluetooth Dongle to a USB port on your computer or Chromebook. The Bluetooth LED will flash slowly.<br \/>\n3. On the Dongle, press and hold the Bluetooth button (button with the Bluetooth symbol) to pair the mBot. The LED will flash quickly and then stay lit (without flashing).<\/p>\n<p>Once you have paired the Bluetooth Dongle to an mBot, it stays paired; you do not need to re-pair the Dongle every time you need to connect to mBot.<\/p>\n<p>Next, choose one of the following upload methods; follow the steps to connect the mBlock 5 software to mBot and upload your program:<\/p>\n<p><B>Method 1 Using the &#8220;Upload&#8221; mode and the Bluetooth Dongle<\/B><\/p>\n<p>1. In mBlock 5, click &#8220;Connect&#8221; in the Devices tab. mBlock 5 will identify the port. Click Connect. (Verify that &#8220;USB&#8221; and not &#8220;Bluetooth 4.0&#8221; is selected. This is required when using the Bluetooth Dongle.)<br \/>\n2. Set the Mode Switch to &#8220;Upload&#8221;.<br \/>\n3. Verify that your code begins with the &#8220;when mBot(mcore) starts up&#8221; hat block.<br \/>\n3. Click the &#8220;Upload&#8221; button, and the program will be loaded onto your mBot. mBot will then disconnect itself from the software and immediately run the program.  <b>Note<\/b>: When you upload a new program to mBot, any program currently on the mBot will be replaced with your new program.<br \/>\n4. If you want to change\/tweak\/replace the mBot&#8217;s program, reconnect (step 1), and repeat this process.<\/p>\n<p>Notes:<br \/>\n* This method uploads complete programs all at once. Any program that is installed on the mBot will be deleted and replaced with the uploaded program.<br \/>\n* If you wish to restore the mBot&#8217;s Default Program to mBot, see <a href=\"\/til\/4153\/\">How do I reset my mBot back to the Default Program?<\/a>.<br \/>\n* Our mBot e-book, <a href=\"\/product\/coding-with-mbot-self-driving-vehicles\/\"><i>Coding with mBot: Self-Driving Vehicles<\/i><\/a> (<nobr>MBOT-MSDV-E<\/nobr>), is written with the assumption that students use this upload method.<\/p>\n<p><B>Method 2 Using the &#8220;Live&#8221; mode and the Bluetooth Dongle<\/B><\/p>\n<p><B>mBot must have the Default Program installed to use Live mode.<\/B> If you want to restore the Default Program to mBot, see <a href=\"\/til\/4153\/\">How do I reset my mBot back to the Default Program?<\/a>.<\/p>\n<p>1. In mBlock 5, click &#8220;Connect&#8221; in the Devices tab. mBlock 5 will identify the port. Click Connect. (Verify that &#8220;USB&#8221; and not &#8220;Bluetooth 4.0&#8221; is selected. This is required when using the Bluetooth Dongle.)<br \/>\n2. Set the Mode Switch to &#8220;Live&#8221;, if it is not already.<br \/>\n3. mBot will run the program when triggered by the appropriate event. For example, if your program begins with the &#8220;when green flag&#8221; hat block, mBot will not run the program until the green flag button in the mBlock 5 window is clicked.<br \/>\n4. mBot will stay connected to the mBlock software after it has run the program. You can change\/tweak\/replace code, as necessary, without having to reconnect (step 1).<\/p>\n<p>Notes:<br \/>\n* This method runs the program through active communication. Code is streamed to and from the mBot one block at a time.<br \/>\n* This upload method can involve some delay due to the active communication between the computer\/Chromebook and the mBot. This method is not advised for programs such as line-following which requires quick response.<\/p>\n<p>Related TILs:<br \/>\n<a href=\"\/til\/4140\/\">Can I program my mBot via Bluetooth with mBlock 3 software?<\/a><br \/>\n<a href=\"\/til\/4136\/\">mBot Troubleshooting and FAQs<\/a><br \/>\n<a href=\"\/product\/makeblock-bluetooth-dongle\/\">Makeblock<sup>&reg;<\/sup> Bluetooth<sup>&reg;<\/sup> Dongle<\/a> (<nobr>MB-BLE<\/nobr>)<br \/>\n<a href=\"\/product\/mbot-and-stem-activities-module\/\">mBot and STEM Activities Module<\/a> (<nobr>MBOT-P<\/nobr>)<br \/>\nmBot (Blue) and STEM Activities Module (MBOT-B, <em>discontinued<\/em>)<br \/>\nmBot STEM Classroom Kit (MBOT-KIT, <em>discontinued<\/em>)<\/p>","protected":false},"excerpt":{"rendered":"<p>Yes. There are two distinct methods for programming your mBot with the mBlock 5 software via Bluetooth. In both cases we recommend using the ,&#8230;<\/p>\n","protected":false},"author":86433,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[],"tags":[1252,2122,2603,6917,6969,7413,6916,7412],"class_list":["post-4474","post","type-post","status-publish","format-standard","hentry","tag-adapter","tag-bluetooth","tag-dongle","tag-makeblock","tag-mb-ble","tag-mblock-upload","tag-mbot","tag-mbot-p-mbot-b-mbot-kit"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/posts\/4474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/users\/86433"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/comments?post=4474"}],"version-history":[{"count":0,"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/posts\/4474\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/media?parent=4474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/categories?post=4474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vernier.com\/til\/wp-json\/wp\/v2\/tags?post=4474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}