{"id":1020,"date":"2018-10-16T10:49:08","date_gmt":"2018-10-16T08:49:08","guid":{"rendered":"https:\/\/fanbotica-redesign.local\/?post_type=jetpack-portfolio&#038;p=1020"},"modified":"2026-08-23T16:32:39","modified_gmt":"2026-08-23T14:32:39","slug":"stazione-di-controllo-per-rocker-tubie","status":"publish","type":"jetpack-portfolio","link":"https:\/\/www.fanbotica.com\/en\/portfolio\/stazione-di-controllo-per-rocker-tubie\/","title":{"rendered":"Rocker Tubie Control Station"},"content":{"rendered":"<div class=\"fanbotica-emphasis-box\">\n<h2>Based on the Logitech Force 3D Pro digital controller<\/h2>\n<p>La stazione di controllo per <a href=\"https:\/\/www.fanbotica.com\/en\/portfolio\/rocker-tubie-robot-costruito-con-tubi-pvc\/\" target=\"_blank\" rel=\"noopener noreferrer\">Rocker Tubie<\/a> di cui tratta questo articolo fa parte del progetto che ho presentato in occasione del Maker Faire Europe che si \u00e8 appena chiuso a Roma.<\/p>\n<p>The control station's components are:<\/p>\n<ol>\n<li><a href=\"https:\/\/www.fanbotica.com\/en\/product\/geekcreit-mega-2560-r3-atmega2560-16au-cavo-usb\/\" target=\"_blank\" rel=\"noopener noreferrer\">Controller Arduino Mega 2560 R3<\/a>,<\/li>\n<li>Uno schield\u00a0<a href=\"https:\/\/www.fanbotica.com\/en\/product\/usb-host-shield-2-per-arduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">USB Host Shield 2.0<\/a> di Oleg Mazurov,<\/li>\n<li>Un controller <a href=\"https:\/\/www.fanbotica.com\/en\/product\/logitech-extreme-3d-pro\/\" target=\"_blank\" rel=\"noopener noreferrer\">Joystick Logitech Extreme 3D Pro<\/a>,<\/li>\n<li>Un <a href=\"https:\/\/www.fanbotica.com\/en\/product\/5a-xl4005-convertitore-di-alimentazione-step-down-regolabile-cc-cc\/\" target=\"_blank\" rel=\"noopener noreferrer\">5A XL4015 DC-DC Step Down Adjustable Power Supply<\/a>,<\/li>\n<li>Un <a href=\"https:\/\/www.fanbotica.com\/en\/product\/modulo-wireless-nrf24l01-pa-lna-a-distanza-lunga-da-1100-metri-con-antenna\/\" target=\"_blank\" rel=\"noopener noreferrer\">modulo wireless con ANTENNA 2,4 Ghz NRF24L01+ PA + LNA<\/a> (range fino a 1 Km in spazi aperti),<\/li>\n<li>Un <a href=\"https:\/\/www.fanbotica.com\/en\/product\/modulo-adattatore-per-nrf24l01\/\" target=\"_blank\" rel=\"noopener noreferrer\">modulo di potenza per il modulo wireless NRF24L01<\/a>,<\/li>\n<li>Un <a href=\"https:\/\/www.fanbotica.com\/en\/product\/modulo-led-rgb-full-color-da-10-mm\/\" target=\"_blank\" rel=\"noopener noreferrer\">modulo Full Color LED 10mm Bright RGB<\/a>.<\/li>\n<li>Un <a href=\"https:\/\/www.fanbotica.com\/en\/product\/zop-power-batteria-lipo-11-1v-5000mah-75c-3s-xt60\/\" target=\"_blank\" rel=\"noopener noreferrer\">accumulatore Lipo 3S (11,1V) da almeno 1300<\/a><i>mA.<\/i><\/li>\n<li><a href=\"https:\/\/www.fanbotica.com\/en\/portfolio\/enclosure-nrf24l01-da-stampare-in-3d\/\" target=\"_blank\" rel=\"noopener noreferrer\">Box stampato in 3D con filamento PLA da 1,75mm.<\/a><\/li>\n<li>1 <a href=\"https:\/\/www.fanbotica.com\/en\/product\/120-ponticelli-dupont-10-cm-m-f-f-f-m-m-per-arduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">set di ponticelli Dupont da Maschio a Femmina da 10cm<\/a>.<\/li>\n<\/ol>\n<p>I software da caricare sull&#8217;Arduino Mega 2560 R3 della stazione di controllo sono:<\/p>\n<ol>\n<li>Library for the USB Host Shield 2.0 + Logitech Force 3D Pro joystick + Arduino Mega 2560 R3.<\/li>\n<li>Sketch for running the 2.4GHz WiFi control station.<\/li>\n<\/ol>\n<p>Puoi scaricarli da <a href=\"https:\/\/github.com\/Fanbotica\/RockerTubie\">Rocker Tubie Fanbotica su Github<\/a>.<\/p>\n<p>Per i software da caricare sull&#8217;Arduino Mega 2560 R3 del rover Rocker Tubie trovi qui il link alla pagina del progetto:<\/p>\n<p><a href=\"https:\/\/www.fanbotica.com\/en\/portfolio\/rocker-tubie-robot-costruito-con-tubi-pvc\/\" target=\"_blank\" rel=\"noopener noreferrer\">Rocker Tubie project page.<\/a><\/p>\n<h2>The Rocker Tubie control station is a real gem!<\/h2>\n<p>As I explained to the many curious visitors to our Fanbotica stand at Maker Faire Europe in Rome, which just wrapped up, the Rocker Tubie control station I built is truly something special.<\/p>\n<p>That's because I put a huge amount of work into it, rewriting Oleg Mazurov's original library from scratch to support digital peripherals such as the Logitech Force 3D Pro controller, which \u2014 besides being very precise \u2014 also has a third, twist (Z) axis.<\/p>\n<p>In addition to digital control, my library also has other important features.<\/p>\n<p>For instance, one that lets it send the 10-bit data stream coming from the Logitech peripheral as-is, without forcing the control station's microcontroller into lengthy processing.<\/p>\n<p>This means that with my library, those annoying lags or delays between sending commands and the robot actually carrying them out don't occur, even at a distance of 1 km.<\/p>\n<h2>Wiring diagram to the Arduino Mega 2560 R3<\/h2>\n<p>Note: As you can see from both the diagram and the photos, the adapter module has six connection pins \u2014 CE (orange), CSN (yellow), SCK (green), MOSI (blue), MISO (purple), IRQ (gray) \u2014 all in a row along the same imaginary line, with VCC (red) and GND (brown) set apart lower down on the right.<br \/> So the connections to make are as follows:<\/p>\n<p><em>NRF24L01+ 5V-to-3.3V adapter module \u2013&gt; Arduino Mega 2560 R3<\/em><\/p>\n<p><em>CE (orange) \u2013&gt; PIN 48<\/em><br \/> <em>CSN (Giallo) &#8211;&gt; PIN 53<\/em><br \/> <em>SCK (Verde) &#8211;&gt; PIN 52<\/em><br \/> <em>MOSI(Blu) &#8211;&gt; PIN 51<\/em><br \/> <em>MISO(Viola) &#8211;&gt; PIN 50<\/em><br \/> <em>IRQ (Grigio) &#8211;&gt; Non utilizzato<\/em><\/p>\n<p><em>VCC (red) \u2013&gt; 5V<\/em><br \/> <em>GND(Marrone) &#8211;&gt; GND<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1882 size-full\" src=\"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4.png\" alt=\"NRF24L01 Wireless Module + Arduino Mega 2560 R3_bb + RGB LED Module\" width=\"2122\" height=\"2299\" srcset=\"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4.png 2122w, https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4-1418x1536.png 1418w, https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4-1890x2048.png 1890w, https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4-277x300.png 277w, https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4-768x832.png 768w, https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4-945x1024.png 945w, https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/NRF24L01-Wireless-Module-Arduino-Mega-2560-R3_bb-RGB-LED-Module.fw_-4-416x451.png 416w\" sizes=\"auto, (max-width: 2122px) 100vw, 2122px\" \/> NRF24L01 Wireless Module + Arduino Mega 2560 R3_bb + RGB LED Module<img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1852 size-full\" src=\"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2018\/10\/nrf24l01-wiring.jpg\" alt=\"nRF24L01 cablaggio modulo di alimentazione\" width=\"3456\" height=\"4608\" \/> nRF24L01 power module wiring<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1840 size-full\" src=\"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2017\/09\/20170915_130449_HDR.jpg\" alt=\"nRF24L01+ box case\" width=\"5312\" height=\"2988\" \/> nRF24L01+ box case<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1847\" src=\"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2017\/09\/IMG_20190103_152152.jpg\" alt=\"nRF24L01 e Mega 2560 R3 wiring\" width=\"2976\" height=\"3968\" \/> Collegamenti dei ponticelli Dupont tra nRF24L01, Mega 2560 R3 con <a href=\"https:\/\/www.fanbotica.com\/en\/product\/usb-host-shield-2-per-arduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">USB Host Shield 2.0<\/a> e LED RGB.<\/p>\n<h2>Library for USB Host Shield 2.0 + Logitech Force 3D Pro joystick + Arduino Mega 2560 R3.<\/h2>\n<p><span style=\"color: #0c71c3; font-size: 33px; font-weight: bold;\">File le3dp_rptparser.<\/span><\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#if !defined(__HIDJOYSTICKRPTPARSER_H__)\n#define __HIDJOYSTICKRPTPARSER_H__\n#include &lt;usbhid.h&gt;\nstruct GamePadEventData\n{\n  union { \/\/axes and hut switch\n    uint32_t axes;\n    struct {\n      uint32_t x : 10;\n      uint32_t y : 10;\n      uint32_t hat : 4;\n      uint32_t twist : 8;      \n    };\n  };\n  uint8_t buttons_a;\n  uint8_t slider;\n  uint8_t buttons_b;\n};\n\nclass JoystickEvents\n{\npublic:\n\tvirtual void OnGamePadChanged(const GamePadEventData *evt);\n};\n\n#define RPT_GAMEPAD_LEN\tsizeof(GamePadEventData)\/sizeof(uint8_t)\nclass InitPin\n{\nprivate:\npublic:\n\n  int ValX();\n  int ValY();\n  int ValH();\n  int ValT();\n  int ValS();\n  int ValA();\n  int ValB();             \n};\n\n\nclass JoystickReportParser : public HIDReportParser\n{\n\tJoystickEvents\t\t*joyEvents;\n\n  uint8_t oldPad&#x5B;RPT_GAMEPAD_LEN];\n  \npublic:\n\tJoystickReportParser(JoystickEvents *evt);\n\n\tvirtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);\n\n};\n\n#endif \/\/ __HIDJOYSTICKRPTPARSER_H__\n<\/pre>\n<h3>File le3dp_rptparser.cpp<\/h3>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &quot;le3dp_rptparser.h&quot;\n\/\/#include &lt;Servo.h&gt;\n#define rad2grad 57.295779513\n\/\/Servo servox, servoy, servoh, servot, servos;\nint srvxval = 512;\nint srvyval = 512;\nint srvhval = 10;\nint srvtval = 512;\nint srvsval = 512;\nint actaval = 0;\nint actbval = 0;\ndouble sen   = 0;\nfloat grado  = 0;\n\nJoystickReportParser::JoystickReportParser(JoystickEvents *evt) :\n\tjoyEvents(evt)\n{}\n\nvoid JoystickReportParser::Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)\n{\n\tbool match = true;\n\n\t\/\/ Checking if there are changes in report since the method was last called\n\tfor (uint8_t i=0; i&lt;RPT_GAMEPAD_LEN; i++) {\n\t\tif( buf&amp;#91;i&amp;#93; != oldPad&amp;#91;i&amp;#93; ) {\n\t\t\tmatch = false;\n\t\t\tbreak;\n\t\t}\n  }\n  \t\/\/ Calling Game Pad event handler\n\tif (!match &amp;&amp; joyEvents) {\n\t\tjoyEvents-&gt;OnGamePadChanged((const GamePadEventData*)buf);\n\n\t\tfor (uint8_t i=0; i&lt;RPT_GAMEPAD_LEN; i++) oldPad&amp;#91;i&amp;#93; = buf&amp;#91;i&amp;#93;;\n\t}\n}\n\nvoid JoystickEvents::OnGamePadChanged(const GamePadEventData *evt)\n{\n\n        uint16_t myX = evt-&gt;x;\n          srvxval = myX;\n\/\/        Serial.print(&quot;X: &quot;);\n\/\/        Serial.println(srvxval);         \n\n        uint16_t myY = evt-&gt;y;\n          srvyval = myY;\n\/\/        Serial.print(&quot;Y: &quot;);\n\/\/        Serial.println(srvyval);         \n\n        uint16_t myH = evt-&gt;hat;\n        int srvH = map(myH, 0, 7, 10, 170);\n        srvhval = srvH;\n\/\/        Serial.print(&quot;Hat: &quot;);\n\/\/        Serial.println(srvhval);        \n        \n        uint16_t myT = evt-&gt;twist;\n          srvtval = myT;\n\/\/        Serial.print(&quot;Twist: &quot;);\n\/\/        Serial.println(srvtval);         \n\/\/        sen = sin( (srvtval\/rad2grad) );\n\/\/        grado = (( sen * 80 ) + 90 );\n        \n        \n        uint16_t myS = evt-&gt;slider;\n          srvsval = myS;\n\/\/        Serial.print(&quot;Slider: &quot;);\n\/\/        Serial.println(srvsval);        \n\n        uint16_t myBA = evt-&gt;buttons_a;\n        actaval = myBA;\n\/\/        Serial.print(&quot;Buttons A: &quot;);\n\/\/        Serial.println(actaval);                \n\n        uint16_t myBB = evt-&gt;buttons_b;\n        actbval = myBB;\n\/\/        Serial.print(&quot;Buttons B: &quot;);\n\/\/        Serial.println(actbval);\n        \n\n\/*        Serial.print(&quot;X: &quot;);\n\tPrintHex&lt;uint16_t&gt;(evt-&gt;x, 0x80);\n\tSerial.print(&quot; Y: &quot;);\n\tPrintHex&lt;uint16_t&gt;(evt-&gt;y, 0x80);\n\tSerial.print(&quot; Hat Switch: &quot;);\n\tPrintHex&lt;uint8_t&gt;(evt-&gt;hat, 0x80);\n\tSerial.print(&quot; Twist: &quot;);\n\tPrintHex&lt;uint8_t&gt;(evt-&gt;twist, 0x80);\n\tSerial.print(&quot; Slider: &quot;);\n\tPrintHex&lt;uint8_t&gt;(evt-&gt;slider, 0x80);\n  Serial.print(&quot; Buttons A: &quot;);\n\tPrintHex&lt;uint8_t&gt;(evt-&gt;buttons_a, 0x80);\n\tSerial.print(&quot; Buttons B: &quot;);\n\tPrintHex&lt;uint8_t&gt;(evt-&gt;buttons_b, 0x80);\n\tSerial.println(&quot;&quot;); *\/\n}\n\nint InitPin::ValX()\n{\nreturn(srvxval);\n}\n\nint InitPin::ValY()\n{\nreturn(srvyval);\n}\n\nint InitPin::ValH()\n{\nreturn(srvhval);\n}\n\nint InitPin::ValT()\n{\nreturn(srvtval);\n}\n\nint InitPin::ValS()\n{\nreturn(srvsval);\n}\n\nint InitPin::ValA()\n{\nreturn(actaval);\n}\n\nint InitPin::ValB()\n{\nreturn(actbval);\n}\n\n<\/pre>\n<h3>Control station sketch USBHOSTWIFI_16_MAR_2018<\/h3>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n\/* Simplified Logitech Force 3D Pro Joystick Report Parser by Francesco Onorati www.fanbotica.com*\/\n\n#include &lt;usbhid.h&gt;\n#include &lt;hiduniversal.h&gt;\n#include &lt;usbhub.h&gt;\n\n\/\/#include &quot;DigitalIO.h&quot;\n#include &quot;le3dp_rptparser.h&quot;\n#include &quot;RF24.h&quot;  \/\/ Download and Install (See above)\n#include &quot;printf.h&quot; \/\/ Needed for &quot;printDetails&quot; Takes up some memory\n\/*-----( Declare Constants and Pin Numbers )-----*\/\n#define CE_PIN  48   \/\/ The pins to be used for CE and SN\n#define CSN_PIN 53\n#define redPin 4\n#define greenPin 5\n#define bluePin 6\n#define COMMON_ANODE \/\/uncomment this line if using a Common Anode LED\n\n\/\/ Satisfy the IDE, which needs to see the include statment in the ino too.\n#ifdef dobogusinclude\n#include &lt;spi4teensy3.h&gt;\n#include &lt;SPI.h&gt;\n#endif\n\nUSB                                             Usb;\nUSBHub                                          Hub(&amp;Usb);\nHIDUniversal                                    Hid(&amp;Usb);\nJoystickEvents                                  JoyEvents;\nJoystickReportParser                            Joy(&amp;JoyEvents);\nInitPin                                    inpx;\nInitPin                                    inpy;\nInitPin                                    inph;\nInitPin                                    inpt;\nInitPin                                    inps;\nInitPin                                    inpa;\nInitPin                                    inpb;\n\n\/\/int servoX;\n\n\/*-----( Declare objects )-----*\/\n\/* Hardware configuration: Set up nRF24L01 radio on SPI bus plus (usually) pins 7 &amp; 8 (Can be changed) *\/\nRF24 radio(CE_PIN, CSN_PIN);\n\n\/*-----( Declare Variables )-----*\/\nbyte addresses&#x5B;]&#x5B;6] = {&quot;1Node&quot;, &quot;2Node&quot;}; \/\/ These will be the names of the &quot;Pipes&quot;\n\nunsigned long timeNow;  \/\/ Used to grab the current time, calculate delays\nunsigned long started_waiting_at;\nboolean timeout;       \/\/ Timeout? True or False\n\n\/\/ Allows testing of radios and code without Joystick hardware. Set &#039;true&#039; when joystick connected\n\/\/boolean hasHardware = false;\nboolean hasHardware = true;\n\n\/**\n  Create a data structure for transmitting and receiving data\n  This allows many variables to be easily sent and received in a single transmission\n  See http:\/\/www.cplusplus.com\/doc\/tutorial\/structures\/\n*\/\nstruct dataStruct {\n  unsigned long _micros;  \/\/ to save response times\n  int Xposition;          \/\/ The Joystick position values\n  int Yposition;\n  int Hposition;          \/\/ The Joystick position values\n  int Tposition;\n  int Sposition;          \/\/ The Joystick position values\n  int Abutton;\n  int Bbutton;          \/\/ The Joystick push-down switch\n} myData;                 \/\/ This can be accessed in the form:  myData.Xposition  etc.\n\n\nvoid setup()\n{\n  pinMode(redPin, OUTPUT);\n  pinMode(greenPin, OUTPUT);\n  pinMode(bluePin, OUTPUT);\n    \n  Serial.begin( 115200 );\n#if !defined(__MIPSEL__)\n  while (!Serial); \/\/ Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection\n#endif\n  Serial.println(&quot;Start&quot;);\n\n  if (Usb.Init() == -1)\n      Serial.println(&quot;OSC did not start.&quot;);\n\n  delay( 5 );\n\n  if (!Hid.SetReportParser(0, &amp;Joy))\n      ErrorMessage&lt;uint8_t&gt;(PSTR(&quot;SetReportParser&quot;), 1  );\n  \/\/ NOTE: The &quot;F&quot; in the print statements means &quot;unchangable data; save in Flash Memory to conserve SRAM&quot;\n  Serial.println(F(&quot;Fanbotica.com Example: Send joystick data by nRF24L01 radio to Rocker Tubie&quot;));\n  printf_begin(); \/\/ Needed for &quot;printDetails&quot; Takes up some memory\n\n  radio.begin();          \/\/ Initialize the nRF24L01 Radio\n  radio.setChannel(108);  \/\/ Above most WiFi frequencies\n  radio.setDataRate(RF24_250KBPS); \/\/ Fast enough.. Better range\n\n  \/\/ Set the Power Amplifier Level low to prevent power supply related issues since this is a\n  \/\/ getting_started sketch, and the likelihood of close proximity of the devices. RF24_PA_MAX is default.\n  \/\/ PALevelcan be one of four levels: RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX\n  radio.setPALevel(RF24_PA_LOW);\n  \/\/ radio.setPALevel(RF24_PA_HIGH);\n\n  \/\/ Open a writing and reading pipe on each radio, with opposite addresses\n  radio.openWritingPipe(addresses&#x5B;0]);\n  radio.openReadingPipe(1, addresses&#x5B;1]);\n\n  \/\/ Start the radio listening for data\n  radio.startListening();\n  \/\/setColor(255, 0, 0);\/\/ red\n  radio.printDetails(); \/\/Uncomment to show LOTS of debugging information\n}\/\/--(end setup )---\n\nvoid loop()\n{\n  radio.stopListening();                                    \/\/ First, stop listening so we can talk.\n  \/\/setColor(255, 0, 0);  \/\/ red\n      if (hasHardware)  \/\/ Set in variables at top\n  {\n    \/*********************( Read the Joystick positions )*************************\/\n    \/\/myData.switchOn  = !digitalRead(JOYSTICK_SW);  \/\/ Invert the pulldown switch   \n\n    Usb.Task();\n    myData.Xposition = inpx.ValX();\n    myData.Yposition = inpy.ValY();\n    myData.Hposition = inph.ValH();\n    myData.Tposition = inpt.ValT();\n    myData.Sposition = inps.ValS();\n    myData.Abutton = inpa.ValA();\n    myData.Bbutton = inpb.ValB();       \n  }\n  else\n  {\n    myData.Xposition = 512;  \/\/ Send some known fake data\n    myData.Yposition = 512;\n    myData.Hposition = 90;\n    myData.Tposition = 512;\n    myData.Sposition = 90;\n    myData.Abutton = 256;\n    myData.Bbutton = 256;\n  }\n\n  myData._micros = micros();  \/\/ Send back for timing\n\n\n\/\/  Serial.print(F(&quot;Now sending  -  &quot;));\n    setColor(0, 0, 255);  \/\/ blue\n  if (!radio.write( &amp;myData, sizeof(myData) )) {            \/\/ Send data, checking for error (&quot;!&quot; means NOT)\n    Serial.println(F(&quot;Transmit failed &quot;));\n    setColor(255, 0, 0);  \/\/ red    \n  }\n\n  radio.startListening();                                    \/\/ Now, continue listening\n  \/\/setColor(0, 255, 0);\/\/ green\n  started_waiting_at = micros();               \/\/ timeout period, get the current microseconds\n  timeout = false;                            \/\/  variable to indicate if a response was received or not\n\n  while ( ! radio.available() ) {                            \/\/ While nothing is received\n    if (micros() - started_waiting_at &gt; 200000 ) {           \/\/ If waited longer than 200ms, indicate timeout and exit while loop\n      timeout = true;\n      break;\n    }\n  }\n\n  if ( timeout )\n  { \/\/ Describe the results\n\/\/    Serial.println(F(&quot;Response timed out -  no Acknowledge.&quot;));\n  setColor(255, 0, 0);  \/\/ red\n  }\n  else\n  {\n    \/\/ Grab the response, compare, and send to Serial Monitor\n    radio.read( &amp;myData, sizeof(myData) );\n    timeNow = micros();\n    \/\/setColor(255, 0, 0);\/\/ red\n   \/\/ Show it\n\/\/    Serial.print(F(&quot;Sent &quot;));\n\/\/    Serial.print(timeNow);\n\/\/    Serial.print(F(&quot;, Got response &quot;));\n\/\/    Serial.print(myData._micros);\n\/\/    Serial.print(F(&quot;, Round-trip delay &quot;));\n\/\/    Serial.print(timeNow - myData._micros);\n\/\/    Serial.println(F(&quot; microseconds &quot;));\n\n  }\n\n  \/\/ Send again after delay. When working OK, change to something like 100\n  delay(5);\n}\/\/--(end main loop )---\n\n\/*-----( Declare User-written Functions )-----*\/\nvoid setColor(int red, int green, int blue)\n{\n  #ifdef COMMON_ANODE\n    red = 255 - red;\n    green = 255 - green;\n    blue = 255 - blue;\n  #endif\n  analogWrite(redPin, red);\n  analogWrite(greenPin, green);\n  analogWrite(bluePin, blue);  \n}\n\/\/ NONE YET\n\/\/*********( THE END )***********\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/github.com\/Fanbotica\/RockerTubie\" target=\"_blank\" rel=\"noopener noreferrer\">Download all the files and libraries for Rocker Tubie and the Control Station here.<\/a><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Basata su controller digitale Logitech Force 3d Pro La stazione di controllo per Rocker Tubie di cui tratta questo articolo fa parte del progetto che ho presentato in occasione del Maker Faire Europe che si \u00e8 appena chiuso a Roma. I componenti della stazione di controllo sono: Controller Arduino Mega 2560 R3, Uno schield\u00a0USB Host [&hellip;]<\/p>\n","protected":false},"featured_media":1941,"template":"","class_list":["post-1020","jetpack-portfolio","type-jetpack-portfolio","status-publish","has-post-thumbnail","hentry","jetpack-portfolio-type-robot-e-componenti-in-3d","jetpack-portfolio-tag-controller","jetpack-portfolio-tag-rocker-tubie","jetpack-portfolio-tag-stazione-di-controllo"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Stazione di controllo per Rocker Tubie - Fanbotica<\/title>\n<meta name=\"description\" content=\"La stazione di controllo per Rocker Tubie fa parte del progetto open source che ho presentato al Maker Faire Europe di Roma 2018.\" \/>\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.fanbotica.com\/en\/portfolio\/stazione-di-controllo-per-rocker-tubie\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stazione di controllo per Rocker Tubie - Fanbotica\" \/>\n<meta property=\"og:description\" content=\"La stazione di controllo per Rocker Tubie fa parte del progetto open source che ho presentato al Maker Faire Europe di Roma 2018.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fanbotica.com\/en\/portfolio\/stazione-di-controllo-per-rocker-tubie\/\" \/>\n<meta property=\"og:site_name\" content=\"Fanbotica\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fanbotica\/\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-23T14:32:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/www.fanbotica.com\/wp-content\/uploads\/2019\/01\/stazione-di-controllo-per-rocker-tubie.jpg?fit=1959%2C1469&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1959\" \/>\n\t<meta property=\"og:image:height\" content=\"1469\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@Fanbotwitt\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/\",\"url\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/\",\"name\":\"Stazione di controllo per Rocker Tubie - Fanbotica\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.fanbotica.com\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/stazione-di-controllo-per-rocker-tubie.jpg\",\"datePublished\":\"2018-10-16T08:49:08+00:00\",\"dateModified\":\"2026-08-23T14:32:39+00:00\",\"description\":\"La stazione di controllo per Rocker Tubie fa parte del progetto open source che ho presentato al Maker Faire Europe di Roma 2018.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.fanbotica.com\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/stazione-di-controllo-per-rocker-tubie.jpg\",\"contentUrl\":\"https:\\\/\\\/www.fanbotica.com\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/stazione-di-controllo-per-rocker-tubie.jpg\",\"width\":1959,\"height\":1469,\"caption\":\"Stazione di Controllo per Rocker Tubie Kit Base\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/stazione-di-controllo-per-rocker-tubie\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.fanbotica.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Progetti\",\"item\":\"https:\\\/\\\/www.fanbotica.com\\\/portfolio\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Stazione di controllo per Rocker Tubie\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/#website\",\"url\":\"https:\\\/\\\/www.fanbotica.com\\\/\",\"name\":\"Fanbotica\",\"description\":\"Per i fan della robotica.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.fanbotica.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/#organization\",\"name\":\"Fanbotica\",\"url\":\"https:\\\/\\\/www.fanbotica.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.fanbotica.com\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/FB_IMG_1537194787952.jpg?fit=512%2C512&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.fanbotica.com\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/FB_IMG_1537194787952.jpg?fit=512%2C512&ssl=1\",\"width\":512,\"height\":512,\"caption\":\"Fanbotica\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fanbotica.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fanbotica\\\/\",\"https:\\\/\\\/x.com\\\/Fanbotwitt\",\"https:\\\/\\\/www.instagram.com\\\/fanbotica\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fanbotica\\\/\",\"https:\\\/\\\/www.pinterest.it\\\/fanbotica\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCEys5L0zVCzcgJY9j2c3wPg\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stazione di controllo per Rocker Tubie - Fanbotica","description":"La stazione di controllo per Rocker Tubie fa parte del progetto open source che ho presentato al Maker Faire Europe di Roma 2018.","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.fanbotica.com\/en\/portfolio\/stazione-di-controllo-per-rocker-tubie\/","og_locale":"en_GB","og_type":"article","og_title":"Stazione di controllo per Rocker Tubie - Fanbotica","og_description":"La stazione di controllo per Rocker Tubie fa parte del progetto open source che ho presentato al Maker Faire Europe di Roma 2018.","og_url":"https:\/\/www.fanbotica.com\/en\/portfolio\/stazione-di-controllo-per-rocker-tubie\/","og_site_name":"Fanbotica","article_publisher":"https:\/\/www.facebook.com\/fanbotica\/","article_modified_time":"2026-08-23T14:32:39+00:00","og_image":[{"width":1959,"height":1469,"url":"https:\/\/i0.wp.com\/www.fanbotica.com\/wp-content\/uploads\/2019\/01\/stazione-di-controllo-per-rocker-tubie.jpg?fit=1959%2C1469&ssl=1","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@Fanbotwitt","twitter_misc":{"Estimated reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/","url":"https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/","name":"Stazione di controllo per Rocker Tubie - Fanbotica","isPartOf":{"@id":"https:\/\/www.fanbotica.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/#primaryimage"},"image":{"@id":"https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2019\/01\/stazione-di-controllo-per-rocker-tubie.jpg","datePublished":"2018-10-16T08:49:08+00:00","dateModified":"2026-08-23T14:32:39+00:00","description":"La stazione di controllo per Rocker Tubie fa parte del progetto open source che ho presentato al Maker Faire Europe di Roma 2018.","breadcrumb":{"@id":"https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/#primaryimage","url":"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2019\/01\/stazione-di-controllo-per-rocker-tubie.jpg","contentUrl":"https:\/\/www.fanbotica.com\/wp-content\/uploads\/2019\/01\/stazione-di-controllo-per-rocker-tubie.jpg","width":1959,"height":1469,"caption":"Stazione di Controllo per Rocker Tubie Kit Base"},{"@type":"BreadcrumbList","@id":"https:\/\/www.fanbotica.com\/portfolio\/stazione-di-controllo-per-rocker-tubie\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fanbotica.com\/"},{"@type":"ListItem","position":2,"name":"Progetti","item":"https:\/\/www.fanbotica.com\/portfolio\/"},{"@type":"ListItem","position":3,"name":"Stazione di controllo per Rocker Tubie"}]},{"@type":"WebSite","@id":"https:\/\/www.fanbotica.com\/#website","url":"https:\/\/www.fanbotica.com\/","name":"Fanbotica","description":"Per i fan della robotica.","publisher":{"@id":"https:\/\/www.fanbotica.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fanbotica.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/www.fanbotica.com\/#organization","name":"Fanbotica","url":"https:\/\/www.fanbotica.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.fanbotica.com\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/www.fanbotica.com\/wp-content\/uploads\/2018\/09\/FB_IMG_1537194787952.jpg?fit=512%2C512&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.fanbotica.com\/wp-content\/uploads\/2018\/09\/FB_IMG_1537194787952.jpg?fit=512%2C512&ssl=1","width":512,"height":512,"caption":"Fanbotica"},"image":{"@id":"https:\/\/www.fanbotica.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fanbotica\/","https:\/\/x.com\/Fanbotwitt","https:\/\/www.instagram.com\/fanbotica\/","https:\/\/www.linkedin.com\/in\/fanbotica\/","https:\/\/www.pinterest.it\/fanbotica\/","https:\/\/www.youtube.com\/channel\/UCEys5L0zVCzcgJY9j2c3wPg"]}]}},"_links":{"self":[{"href":"https:\/\/www.fanbotica.com\/en\/wp-json\/wp\/v2\/jetpack-portfolio\/1020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fanbotica.com\/en\/wp-json\/wp\/v2\/jetpack-portfolio"}],"about":[{"href":"https:\/\/www.fanbotica.com\/en\/wp-json\/wp\/v2\/types\/jetpack-portfolio"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fanbotica.com\/en\/wp-json\/wp\/v2\/media\/1941"}],"wp:attachment":[{"href":"https:\/\/www.fanbotica.com\/en\/wp-json\/wp\/v2\/media?parent=1020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}