{"id":2852,"date":"2021-04-15T10:00:00","date_gmt":"2021-04-15T08:00:00","guid":{"rendered":"https:\/\/www.albertopasca.it\/whiletrue\/?p=2852"},"modified":"2023-06-26T00:58:10","modified_gmt":"2023-06-25T22:58:10","slug":"debug-and-control-your-robotic-arm-with-ios","status":"publish","type":"post","link":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/","title":{"rendered":"Debug (and control) your Robotic Arm with iOS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This is my work in progress ~50cm <em>Robotic Arm<\/em> with <strong>6 AXIS Servo motors<\/strong>, an Arduino and a RaspberryPi (<em>for image recognition in phase 2<\/em>):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-rounded\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278-1024x1024.png?resize=1024%2C1024&#038;ssl=1\" alt=\"Arduino Robotic Arm 6AXIS iOS controlled\" class=\"wp-image-2876\" srcset=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?resize=1024%2C1024&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?resize=768%2C768&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?resize=1536%2C1536&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?resize=2048%2C2048&amp;ssl=1 2048w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?resize=100%2C100&amp;ssl=1 100w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?w=3000 3000w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">While writing the C++ code in Arduino I found I needed a way to send easily and fast commands to Arduino with my iPhone using Bluetooth.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Basically I need to control my robotic arm using an external device instead of running and running again the code on the Arduino board.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For this reason: I&#8217;ve attached a BLE board to Arduino and I have created a simple app (completely written in <strong>SwiftUI<\/strong> &#x1f60d;&#x1f60e;) that use BLE connection to connect to Arduino BLE board and send string commands that are parsed and executed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Commands sended are like:<\/p>\n\n\n\n<!--more-->\n\n\n\n<pre class=\"wp-block-preformatted\">2350<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Where:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2<\/strong> -&gt; is the command type (in my case is the single movement action)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3<\/strong> -&gt; is the servo index<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>50<\/strong> -&gt; are the degree<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">and so on&#8230;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-vivid-red-color has-css-opacity has-vivid-red-background-color has-background\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>iOS<\/strong> RoboticArm Controller<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s talk about Swift.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Bluetooth pairing<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve used on Arduino the <strong>SH-HC-08<\/strong> Board for bluetooth communication.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This board has a service-id and a characteristic-id, named: <strong>FFE0<\/strong> and <strong>FFE1<\/strong>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Read more on Apple reference if you need:<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.apple.com\/documentation\/corebluetooth\/cbcharacteristic\" target=\"_blank\" rel=\"noreferrer noopener\">BLE Characteristic<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/developer.apple.com\/documentation\/corebluetooth\/cbservice\" target=\"_blank\" rel=\"noreferrer noopener\">BLE Service<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve prepared a simple bluetooth helper that connect automatically to the <em>SH-HC-08 board<\/em> and helps you to send data:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/gist.github.com\/elpsk\/7eaf10e056e516220be847910079cf7e\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/gist.github.com\/elpsk\/7eaf10e056e516220be847910079cf7e#file-arduinobluetoothhelper-swift<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In particular the <strong>func sendDataToDevice( _ data: String ) {}<\/strong> that helps you to send a string to Arduino with a &#8216;<strong>#<\/strong>&#8216; as end-of-line character.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now in your app you should be able to send commands like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">DataSender.send(command: .power(on: data == \"ON\"))\nDataSender.send(command: .move(servo: 2, position: 45))\nDataSender.send(command: .step(steps: stepsArray))\nDataSender.send(command: .macro(steps: stepsArray))\n[...]<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-vivid-red-color has-css-opacity has-vivid-red-background-color has-background\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>DataSender<\/strong> class is explained below.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Steps:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Create a <strong>Step<\/strong> class with the values needed to move the servo.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">struct Step {\n    var servoIndex: Int\n    var servoPosition: Int\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now write the <strong>ArduinoCommands<\/strong> enum that contains the &#8220;commands&#8221;.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">enum ArduinoCommands {                      \/\/ Arduino parser:\n    case power(on: Bool)                    \/\/ 1\n    case move(servo: Int, position: Int)    \/\/ 2\n    case step(steps: [Step])                \/\/ 3\n    case macro(steps: [Step])               \/\/ 4\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And at last, the <strong>DataSender<\/strong> class<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">class DataSender {\n\n    class func send( command: ArduinoCommands ) {\n        var stringToSend = \"\"\n\n        switch command {\n        case .power(on: let on):\n            stringToSend = \"1\\(on ? \"1\":\"0\")\"\n        case .move(servo: let servo, position: let position):\n            stringToSend = \"2\\(servo)\\(position)\"\n        case .step(steps: let steps):\n            stringToSend = \"3\"\n            steps.forEach {\n                let currentStep = \"\\($0.servoIndex)\\($0.servoPosition)\"\n                stringToSend = \"\\(stringToSend)\\(currentStep)_\"\n            }\n            stringToSend.removeLast()\n        case .macro(steps: let steps):\n            stringToSend = \"4\"\n            steps.forEach {\n                let currentStep = \"\\($0.servoIndex)\\($0.servoPosition)\"\n                stringToSend = \"\\(stringToSend)\\(currentStep)_\"\n            }\n            stringToSend.removeLast()\n        }\n        \n        BluetoothHelper.sharedBluetooth.sendDataToDevice(stringToSend)\n    }\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;and send data!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-vivid-red-color has-css-opacity has-vivid-red-background-color has-background\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">This is my internal application used to debug the arm (<em>source code will be uploaded soon<\/em>). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The most interesting section of the app is the &#8220;<strong>Macro<\/strong>&#8221; section, that allow you to &#8220;record&#8221; a set of movements and loop infinitely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Best for repetitive tasks, like take an object, move in another place and start again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"1024\" data-id=\"2869\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279-473x1024.png?resize=473%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-2869\" srcset=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279.png?resize=473%2C1024&amp;ssl=1 473w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279.png?resize=139%2C300&amp;ssl=1 139w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279.png?resize=768%2C1663&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279.png?resize=709%2C1536&amp;ssl=1 709w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279.png?resize=946%2C2048&amp;ssl=1 946w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6279.png?w=1125&amp;ssl=1 1125w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/a><figcaption class=\"wp-element-caption\">Single movement<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"1024\" data-id=\"2870\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280-473x1024.png?resize=473%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-2870\" srcset=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280.png?resize=473%2C1024&amp;ssl=1 473w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280.png?resize=139%2C300&amp;ssl=1 139w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280.png?resize=768%2C1663&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280.png?resize=709%2C1536&amp;ssl=1 709w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280.png?resize=946%2C2048&amp;ssl=1 946w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6280.png?w=1125&amp;ssl=1 1125w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/a><figcaption class=\"wp-element-caption\">Set servo to start position<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"1024\" data-id=\"2871\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281-473x1024.png?resize=473%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-2871\" srcset=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281.png?resize=473%2C1024&amp;ssl=1 473w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281.png?resize=139%2C300&amp;ssl=1 139w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281.png?resize=768%2C1663&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281.png?resize=709%2C1536&amp;ssl=1 709w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281.png?resize=946%2C2048&amp;ssl=1 946w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6281.png?w=1125&amp;ssl=1 1125w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/a><figcaption class=\"wp-element-caption\">Record a macro with slider<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"1024\" data-id=\"2872\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282-473x1024.png?resize=473%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-2872\" srcset=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282.png?resize=473%2C1024&amp;ssl=1 473w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282.png?resize=139%2C300&amp;ssl=1 139w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282.png?resize=768%2C1663&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282.png?resize=709%2C1536&amp;ssl=1 709w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282.png?resize=946%2C2048&amp;ssl=1 946w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6282.png?w=1125&amp;ssl=1 1125w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/a><figcaption class=\"wp-element-caption\">Record a macro with text and comments<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"1024\" data-id=\"2873\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283-473x1024.png?resize=473%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-2873\" srcset=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283.png?resize=473%2C1024&amp;ssl=1 473w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283.png?resize=139%2C300&amp;ssl=1 139w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283.png?resize=768%2C1663&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283.png?resize=709%2C1536&amp;ssl=1 709w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283.png?resize=946%2C2048&amp;ssl=1 946w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6283.png?w=1125&amp;ssl=1 1125w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/a><figcaption class=\"wp-element-caption\">Manage BLE status<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"1024\" data-id=\"2874\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284-473x1024.png?resize=473%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-2874\" srcset=\"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284.png?resize=473%2C1024&amp;ssl=1 473w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284.png?resize=139%2C300&amp;ssl=1 139w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284.png?resize=768%2C1663&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284.png?resize=709%2C1536&amp;ssl=1 709w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284.png?resize=946%2C2048&amp;ssl=1 946w, https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6284.png?w=1125&amp;ssl=1 1125w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/a><figcaption class=\"wp-element-caption\">Configure BLE settings<\/figcaption><\/figure>\n<\/figure>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-vivid-red-color has-css-opacity has-vivid-red-background-color has-background\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Arduino<\/strong> RoboticArm Controller<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For Arduino coding, I prefer to use <em>Visual Studio Code<\/em> for macOS instead of the built-in IDE, that works better.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">The plugin used is called &#8220;<strong>Platform.io<\/strong>&#8220;, downloadable from here: <a href=\"https:\/\/platformio.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/platformio.org\/<\/a> .<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Bluetooth board<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To use the BLE board you need to import the <strong>SoftwareSerial.h <\/strong>built-in library:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">#include &lt;SoftwareSerial.h&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and initialize the serial port with your pins, like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">void BluetoothManager::begin(uint8_t txPin, uint8_t rxPin) {\n    _bleSerial = SoftwareSerial(rxPin, txPin);\n    _bleSerial.begin(9600);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once configured you can read the commands sended through the iOS App using two methods (depends on your implementation):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">String BluetoothManager::readCommandUntil(char separator) {\n    return _bleSerial.readStringUntil(separator);\n}\n\nString BluetoothManager::readCommand() {\n    return _bleSerial.readString();\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also read a data-stream, of course depends on what you need. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In my case <strong>readStringUntil(&#8216;#&#8217;)<\/strong> is enough.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-vivid-red-color has-css-opacity has-vivid-red-background-color has-background\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Parse strings using Arduino<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">First of all you need a data model, I&#8217;ve created the BLEStep in C++:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">struct BLEStep {\n  byte servoIndex;\n  uint8_t servoPosition;\n};<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;that is the corrispective of &#8220;<strong>Step<\/strong>&#8221; on Swift code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In your <strong>loop() <\/strong>function or on-demand like buttons etc&#8230; call the <strong>readAndParseData()<\/strong> and execute or set data to servos with dedicated functions.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">The string that you receive from bluetooth is now something like this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Power control<\/em>: <strong>11#<\/strong> or <strong>10#<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Single move<\/em>: <strong>2222#<\/strong> or <strong>2345#<\/strong>, etc&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Steps<\/em>: <strong>3090_140_220_365_4105_50#<\/strong> (<em>like step screenshot<\/em>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Macro<\/em>: <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>400_50_2120_3135_10_4112_5180_290_390_180_2150_090_2115_3130_150_50#<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">And as explained before how to read, and can be parsed using this simple snippet of code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">void BluetoothParser::readAndParseData() {\n    String data = _bleManager.readCommandUntil(COMMAND_TERMINATOR); \/\/ COMMAND_TERMINATOR = '#'\n    if ( !dataValid(data) ) { \/\/ do some checks on the received string\n        return;\n    }\n\n    byte command = data[0] - '0'; \/\/ your command type\n    data.remove(0, 1); \/\/ remove command digit\n    [...]\n\n    if ( command == 1 ) { \/\/ status\n        \/\/ sendStatus(data[0] == '1'); \/\/ power on\/off the servos\n        Serial.println(data[0]);\n    }\n    else if ( command == 2 ) { \/\/ single move\n        byte servo = data[0] - '0';\n        data.remove(0, 1);\n        uint8_t position = data.toInt();\n\n        sendMove(servo, position); \/\/ send values to servos\n    }\n    else if ( command == 3 ) { \/\/ defined steps\n        char buffer[30];\n        char *p = buffer;\n        char *str;\n        data.toCharArray(buffer, 30);\n\n        while ((str = strtok_r(p, COMMAND_ITEMS_SEPARATOR, &amp;p)) != NULL) { \/\/ COMMAND_ITEMS_SEPARATOR = '_'\n            byte servo = str[0] - '0';\n            String step(str);\n            step.remove(0, 1);\n            uint8_t position = step.toInt();\n\n            sendSteps([...])\n        }\n        free(p);\n        free(str);\n    }\n    else if ( command == 4 ) { \/\/ macro\n        char buffer[100];\n        char *p = buffer;\n        char *str;\n        data.toCharArray(buffer, 100);\n\n        uint8_t idx = 0;\n        while ((str = strtok_r(p, COMMAND_ITEMS_SEPARATOR, &amp;p)) != NULL) {\n            byte servo = str[0] - '0';\n            String step(str);\n            step.remove(0, 1);\n            uint8_t position = step.toInt();\n\n            sendMacro([...]) \/\/ like steps, but more\n            idx++;\n        }\n        free(p);\n        free(str);\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I prefer to not explain &#8220;<strong>sendMove<\/strong>&#8220;, &#8220;<strong>sendStatus<\/strong>&#8220;, &#8220;<strong>sendMacro<\/strong>&#8220;, etc&#8230; because are strictly related to your servo implementation and cannot be useful for this tutorial.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Hint<\/strong>: prefer the use of <strong>byte<\/strong> and <strong>uint8_t<\/strong>, etc&#8230; types instead of <strong>int<\/strong> to dramatically reduce memory usage and consumption. On Arduino Uno is very limited.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">To check the status and to execute the servo commands you can do something like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">void loop() {\n  bleParser.readAndParseData();\n\n  if (bleParser.dataStatus.powered) {\n    executeArmMovements();\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Where <strong>executeArmMovements()<\/strong> is your handle to the data struct filled with the parser data.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-vivid-red-color has-css-opacity has-vivid-red-background-color has-background\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Now your Robotic Arm is (<strong>not<\/strong>) ready. You are (not) able to control your robot using iOS! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Of course you need to write your code better than these snippets&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You need to manage the ranges, the speed, the various delay, all the exceptions, the memory consumption etc.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Stay tuned for the phase 2\/3 of the project<\/strong>: take the objects recognized with the camera of the <em>RaspberryPI<\/em>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But this is a little bit more complex that moving a servo using recorded step&#8230; I&#8217;m working on in the spare time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the meantime please take a look around this blog for <a href=\"https:\/\/www.albertopasca.it\/whiletrue\/tag\/arduino\/\">Arduino posts<\/a> or <a href=\"https:\/\/www.albertopasca.it\/whiletrue\/tag\/swift\/\">Swift coding<\/a> posts. Or if you prefer browse <a href=\"https:\/\/www.albertopasca.it\/whiletrue\/\">the entire site<\/a>!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enjoy moving.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is my work in progress ~50cm Robotic Arm with 6 AXIS Servo motors, an Arduino and a RaspberryPi (for image recognition in phase 2): While writing the C++ code in Arduino I found I needed a way to send easily and fast commands to Arduino with my iPhone using Bluetooth. Basically I need to <a class=\"read-more\" href=\"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":2876,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Debug (and control) your #Arduino Robotic Arm with #iOS","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7,5,217,67,1,763,12,11,3],"tags":[998,679,617,218,372,1003,1004,1000,1005,1006,999,996,316,997,1002,1007,1001],"class_list":["post-2852","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-c-2","category-development","category-funny","category-generic","category-ios","category-macos","category-mobile","category-swift","tag-6axis","tag-ble","tag-bluetooth","tag-c","tag-cpp","tag-ffe0","tag-ffe1","tag-image-recognition","tag-macro","tag-platformio","tag-raspberrypi","tag-robotic-arm","tag-servo","tag-servomotor","tag-sh-hc-08","tag-softwareserial","tag-swiftui"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Debug (and control) your Robotic Arm with iOS - while (true) {\u00a0}<\/title>\n<meta name=\"description\" content=\"In this simple tutorial you&#039;ll learn on how to send and parse data to your Arduino via the Bluetooth board through a SwiftUI IOS Application.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Debug (and control) your Robotic Arm with iOS - while (true) {\u00a0}\" \/>\n<meta property=\"og:description\" content=\"In this simple tutorial you&#039;ll learn on how to send and parse data to your Arduino via the Bluetooth board through a SwiftUI IOS Application.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/\" \/>\n<meta property=\"og:site_name\" content=\"while (true) {\u00a0}\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-15T08:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-25T22:58:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278-1024x1024.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Alberto Pasca\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@lupasca\" \/>\n<meta name=\"twitter:site\" content=\"@lupasca\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alberto Pasca\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/\"},\"author\":{\"name\":\"Alberto Pasca\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"headline\":\"Debug (and control) your Robotic Arm with iOS\",\"datePublished\":\"2021-04-15T08:00:00+00:00\",\"dateModified\":\"2023-06-25T22:58:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/\"},\"wordCount\":775,\"publisher\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"image\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.albertopasca.it\\\/whiletrue\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_6278.png?fit=3024%2C3024&ssl=1\",\"keywords\":[\"6axis\",\"ble\",\"bluetooth\",\"c++\",\"cpp\",\"ffe0\",\"ffe1\",\"image recognition\",\"macro\",\"platformio\",\"raspberrypi\",\"robotic arm\",\"servo\",\"servomotor\",\"sh-hc-08\",\"SoftwareSerial\",\"swiftui\"],\"articleSection\":[\"arduino\",\"c++\",\"development\",\"funny\",\"generic\",\"ios\",\"macOS\",\"mobile\",\"swift\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/\",\"url\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/\",\"name\":\"Debug (and control) your Robotic Arm with iOS - while (true) {\u00a0}\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.albertopasca.it\\\/whiletrue\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_6278.png?fit=3024%2C3024&ssl=1\",\"datePublished\":\"2021-04-15T08:00:00+00:00\",\"dateModified\":\"2023-06-25T22:58:10+00:00\",\"description\":\"In this simple tutorial you'll learn on how to send and parse data to your Arduino via the Bluetooth board through a SwiftUI IOS Application.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.albertopasca.it\\\/whiletrue\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_6278.png?fit=3024%2C3024&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.albertopasca.it\\\/whiletrue\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/IMG_6278.png?fit=3024%2C3024&ssl=1\",\"width\":3024,\"height\":3024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/debug-and-control-your-robotic-arm-with-ios\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Debug (and control) your Robotic Arm with iOS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#website\",\"url\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/\",\"name\":\"while (true) {\u00a0}\",\"description\":\"notes from a developer, tutorials, how-to, ideas\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\",\"name\":\"Alberto Pasca\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"caption\":\"Alberto Pasca\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\"},\"description\":\"Software engineer @ Pirelli &amp; C. S.p.A. with a strong passion for mobile \uf8ff development, security, and connected things.\",\"sameAs\":[\"https:\\\/\\\/www.albertopasca.it\",\"albertopasca\",\"https:\\\/\\\/x.com\\\/lupasca\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Debug (and control) your Robotic Arm with iOS - while (true) {\u00a0}","description":"In this simple tutorial you'll learn on how to send and parse data to your Arduino via the Bluetooth board through a SwiftUI IOS Application.","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:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/","og_locale":"en_US","og_type":"article","og_title":"Debug (and control) your Robotic Arm with iOS - while (true) {\u00a0}","og_description":"In this simple tutorial you'll learn on how to send and parse data to your Arduino via the Bluetooth board through a SwiftUI IOS Application.","og_url":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/","og_site_name":"while (true) {\u00a0}","article_published_time":"2021-04-15T08:00:00+00:00","article_modified_time":"2023-06-25T22:58:10+00:00","og_image":[{"width":1024,"height":1024,"url":"https:\/\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278-1024x1024.png","type":"image\/png"}],"author":"Alberto Pasca","twitter_card":"summary_large_image","twitter_creator":"@lupasca","twitter_site":"@lupasca","twitter_misc":{"Written by":"Alberto Pasca","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/#article","isPartOf":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/"},"author":{"name":"Alberto Pasca","@id":"https:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"headline":"Debug (and control) your Robotic Arm with iOS","datePublished":"2021-04-15T08:00:00+00:00","dateModified":"2023-06-25T22:58:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/"},"wordCount":775,"publisher":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"image":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?fit=3024%2C3024&ssl=1","keywords":["6axis","ble","bluetooth","c++","cpp","ffe0","ffe1","image recognition","macro","platformio","raspberrypi","robotic arm","servo","servomotor","sh-hc-08","SoftwareSerial","swiftui"],"articleSection":["arduino","c++","development","funny","generic","ios","macOS","mobile","swift"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/","url":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/","name":"Debug (and control) your Robotic Arm with iOS - while (true) {\u00a0}","isPartOf":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/#primaryimage"},"image":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?fit=3024%2C3024&ssl=1","datePublished":"2021-04-15T08:00:00+00:00","dateModified":"2023-06-25T22:58:10+00:00","description":"In this simple tutorial you'll learn on how to send and parse data to your Arduino via the Bluetooth board through a SwiftUI IOS Application.","breadcrumb":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/#primaryimage","url":"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?fit=3024%2C3024&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?fit=3024%2C3024&ssl=1","width":3024,"height":3024},{"@type":"BreadcrumbList","@id":"https:\/\/www.albertopasca.it\/whiletrue\/debug-and-control-your-robotic-arm-with-ios\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.albertopasca.it\/whiletrue\/"},{"@type":"ListItem","position":2,"name":"Debug (and control) your Robotic Arm with iOS"}]},{"@type":"WebSite","@id":"https:\/\/www.albertopasca.it\/whiletrue\/#website","url":"https:\/\/www.albertopasca.it\/whiletrue\/","name":"while (true) {\u00a0}","description":"notes from a developer, tutorials, how-to, ideas","publisher":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.albertopasca.it\/whiletrue\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac","name":"Alberto Pasca","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","caption":"Alberto Pasca"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g"},"description":"Software engineer @ Pirelli &amp; C. S.p.A. with a strong passion for mobile \uf8ff development, security, and connected things.","sameAs":["https:\/\/www.albertopasca.it","albertopasca","https:\/\/x.com\/lupasca"]}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.albertopasca.it\/whiletrue\/wp-content\/uploads\/2021\/04\/IMG_6278.png?fit=3024%2C3024&ssl=1","_links":{"self":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/2852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/comments?post=2852"}],"version-history":[{"count":77,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/2852\/revisions"}],"predecessor-version":[{"id":3216,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/2852\/revisions\/3216"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/media\/2876"}],"wp:attachment":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/media?parent=2852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/categories?post=2852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/tags?post=2852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}