{"id":3716,"date":"2020-06-07T22:23:11","date_gmt":"2020-06-07T20:23:11","guid":{"rendered":"https:\/\/arduino.net.pl\/?p=3716"},"modified":"2020-06-12T23:25:31","modified_gmt":"2020-06-12T21:25:31","slug":"pjon","status":"publish","type":"post","link":"https:\/\/arduino.net.pl\/index.php\/pjon\/","title":{"rendered":"PJON"},"content":{"rendered":"\n<p><strong>Tw\u00f3rcy biblioteki <a href=\"https:\/\/www.pjon.org\">PJON<\/a> napisali:<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Dzi\u0119ki PJON\u00ae (Padded Jittering Operative Network) z du\u017c\u0105 elastyczno\u015bci\u0105 i bez potrzeby korzystania z us\u0142ug zewn\u0119trznego dostawcy lub us\u0142ugi w chmurze mo\u017cesz bezpiecznie \u0142\u0105czy\u0107 sprz\u0119t i produkty elektroniki u\u017cytkowej. Do\u0142\u0105cz do rewolucji.<\/p><\/blockquote>\n\n\n\n<p>Czy to naprawd\u0119 rewolucja w \u0142\u0105czeniu czujnik\u00f3w z platformami i platform mi\u0119dzy sob\u0105 w r\u00f3\u017cny spos\u00f3b? Zobaczymy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><mark><span style=\"color:#2f6e8e\" class=\"tadv-color\">Spis tre\u015bci<\/span><\/mark><\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li><a href=\"#1\">Wysy\u0142ka przez WiFi. Najprostsza konfiguracja.<\/a><\/li><li><a href=\"#2\">Strategia Medium Wire<\/a><\/li><li><a href=\"#3\">\u0141\u0105czenie ESP32 z ESP8266<\/a><\/li><li><a href=\"#4\">Voltage tester device, czyli PJON w praktyce<\/a><\/li><li><a href=\"#LINK\">Linki<\/a><\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;a href=\"#nazwa_etykiety\">opis odsy\u0142acza&lt;\/a>\n(...)\n&lt;a name=\"nazwa_etykiety\">(opis etykiety)&lt;\/a><\/code><\/pre>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<a name=\"1\"><\/a>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<\/div><\/div>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">1. <mark><span style=\"color:#2f6e8e\" class=\"tadv-color\">Wysy\u0142ka przez WiFi. Najprostsza konfiguracja<\/span><\/mark><\/h3>\n\n\n\n<h5 class=\"wp-block-heading\">Transmitter_v2  <span style=\"color:#666\" class=\"tadv-color\">ESP32 lub ESP8266<\/span><\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n#include &amp;lt;PJON.h&gt;\n#include &amp;lt;credentials.h&gt; \/\/ plik w kt\u00f3rym przechowuj\u0119 m\u00f3j ssid oraz password\n\n\/\/ &amp;lt;Strategy name&gt; bus(selected device id)\nPJON&amp;lt;DualUDP&gt; bus(45);\n\n\/\/const char* ssid     = &quot;MyNetworkSSID&quot;;\n\/\/const char* password = &quot;MyNetworkPassword&quot;;\n\nuint8_t content&#x5B;] = &quot;01234567890123456789&quot;;\n\n\nvoid setup() {\n  Serial.begin(115200);\n  Serial.println(&quot;Transmitter started.&quot;);\n  WiFi.begin(ssid, password);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(&quot;.&quot;);\n  }\n\n  bus.set_communication_mode(PJON_SIMPLEX);\n  bus.begin();\n  bus.send(44, content, 20);\n}\n\nvoid loop() {\n\n    if(!bus.update()) \/\/ If all packets are delivered, send another\n    bus.send(44, content, 20);\n\n\n};\n<\/pre><\/div>\n\n\n<h5 class=\"wp-block-heading\"><strong>Receiver_v2<\/strong>  <span style=\"color:#666\" class=\"tadv-color\">ESP32 lub ESP8266<\/span><\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n#include &amp;lt;PJON.h&gt;\n#include &amp;lt;credentials.h&gt;\n\n\/\/ &amp;lt;Strategy name&gt; bus(selected device id)\nPJON&amp;lt;DualUDP&gt; bus(44);\n\n\/\/const char* ssid     = &quot;MyNetworkSSID&quot;;\n\/\/const char* password = &quot;MyNetworkPassword&quot;;\n\n\nfloat test;\nfloat mistakes;\nint busy;\nint fail;\n\nvoid receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &amp;amp;packet_info) {\n \/\/ Do nothing to avoid affecting speed analysis\n}\n\nvoid setup() {\n  Serial.begin(115200);\n  Serial.println(&quot;Receiver started.&quot;);\n  WiFi.begin(ssid, password);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(&quot;.&quot;);\n  }\n  Serial.printf(&quot;Now listening at IP %s\\n&quot;, WiFi.localIP().toString().c_str());\n\n  bus.set_receiver(receiver_function);\n  bus.set_communication_mode(PJON_SIMPLEX);\n  bus.begin();\n};\n\n\nvoid loop() {\n  Serial.println(&quot;Starting 1 second communication speed test...&quot;);\n  long time = millis();\n  unsigned int response = 0;\n  while(millis() - time &amp;lt; 1000) {\n    response = bus.receive();\n    if(response == PJON_ACK)\n      test++;\n    if(response == PJON_NAK)\n      mistakes++;\n    if(response == PJON_BUSY)\n      busy++;\n    if(response == PJON_FAIL)\n      fail++;\n  }\n\n  Serial.print(&quot;Bandwidth: &quot;);\n  Serial.print(test * (20 + bus.packet_overhead(bus.data&#x5B;1])));\n  Serial.println(&quot;B\/s&quot;);\n  Serial.print(&quot;Data throughput: &quot;);\n  Serial.print(test * 20);\n  Serial.println(&quot;B\/s&quot;);\n  Serial.print(&quot;Packets sent: &quot;);\n  Serial.println(test);\n  Serial.print(&quot;Mistakes (error found with CRC): &quot;);\n  Serial.println(mistakes);\n  Serial.print(&quot;Fail (no data found): &quot;);\n  Serial.println(fail);\n  Serial.print(&quot;Busy (Channel is busy or affected by interference): &quot;);\n  Serial.println(busy);\n  Serial.print(&quot;Accuracy: &quot;);\n  Serial.print(100 - (100 \/ (test \/ mistakes)));\n  Serial.println(&quot; %&quot;);\n  Serial.println(&quot; --------------------- &quot;);\n  \/\/ Avoid Serial interference during test flushing\n  Serial.flush();\n\n  test = 0;\n  mistakes = 0;\n  busy = 0;\n  fail = 0;\n};\n<\/pre><\/div>\n\n\n<a name=\"2\"><\/a>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">2. <mark><span style=\"color:#2f6e8e\" class=\"tadv-color\">Strategia Medium Wire<\/span><\/mark><\/h3>\n\n\n\n<p><code>bus.strategy.set_pin(12);<\/code> <br>strategia: SoftwareBitBang<\/p>\n\n\n\n<p>1.  \u0141\u0105czymy dwie p\u0142ytki Arduino (u mnie UNO z Nano) przez pin 12 <\/p>\n\n\n\n<h5 class=\"wp-block-heading\">device1<\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n\/\/device1\n\n#include &amp;lt;PJON.h&gt;\n\n\/\/ Bus id definition\nuint8_t bus_id&#x5B;] = {0, 0, 0, 2};\n\n\/\/ PJON object\nPJON&amp;lt;SoftwareBitBang&gt; bus(bus_id, 44); \/\/ 1 Strategia Medium Wire, piny w u\u017cyciu: 1 lub 2\n\nvoid receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &amp;amp;packet_info) {\n  \/* Make use of the payload before sending something, the buffer where payload points to is\n     overwritten when a new message is dispatched *\/\n  if ((char)payload&#x5B;0] == &#039;B&#039;) {\n    if (!bus.update()) \/\/ If all packets are delivered, send another\n      bus.reply(&quot;A&quot;, 1);\n    Serial.print(&quot;device1 - &quot;);\n    Serial.println((char)(payload&#x5B;0]));\n    digitalWrite(LED_BUILTIN, HIGH);\n    delay(200);\n    digitalWrite(LED_BUILTIN, LOW);\n    delay(200);\n    \/\/delay(2000);\n\n  }\n};\n\nvoid setup() {\n  pinMode(LED_BUILTIN, OUTPUT);\n  digitalWrite(LED_BUILTIN, LOW); \/\/ Initialize LED 13 to be off\n\n  bus.strategy.set_pin(12);\n  bus.set_receiver(receiver_function);\n  bus.begin();\n  bus.send(45, &quot;B&quot;, 1);\n\n  Serial.begin(115200);\n};\n\nvoid loop() {\n  bus.receive(5000);\n  bus.update();\n};\n<\/pre><\/div>\n\n\n<h5 class=\"wp-block-heading\">device2<\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n\/\/device2\n\n#include &amp;lt;PJON.h&gt;\n\n\/\/ Bus id definition\nuint8_t bus_id&#x5B;] = {0, 0, 0, 2};\n\n\/\/ PJON object\nPJON&amp;lt;SoftwareBitBang&gt; bus(bus_id, 45);\n\nvoid receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &amp;amp;packet_info) {\n  \/* Make use of the payload before sending something, the buffer where payload points to is\n     overwritten when a new message is dispatched *\/\n  if ((char)payload&#x5B;0] == &#039;A&#039;) {\n    if (!bus.update()) \/\/ If all packets are delivered, send another\n      bus.reply(&quot;B&quot;, 1);\n    Serial.print(&quot;device 2 - &quot;);\n    Serial.println((char)(payload&#x5B;0]));\n    digitalWrite(LED_BUILTIN, HIGH);\n    delay(200);\n    digitalWrite(LED_BUILTIN, LOW);\n    delay(200);\n  }\n\n};\n\nvoid setup() {\n  pinMode(LED_BUILTIN, OUTPUT);\n  digitalWrite(LED_BUILTIN, LOW); \/\/ Initialize LED 13 to be off\n\n  bus.strategy.set_pin(12);\n  bus.set_receiver(receiver_function);\n  bus.begin();\n  bus.send(44, &quot;B&quot;, 1);\n\n  Serial.begin(115200);\n};\n\nvoid loop() {\n  bus.receive(5000);\n  bus.update();\n};\n<\/pre><\/div>\n\n\n<p>2. Po\u0142\u0105czy\u0142em te\u017c dwa ESP8266 NodeMCU zmieniaj\u0105c <code>bus.strategy.set_pin(4);<\/code> (D2) &#8211; dzia\u0142a. Na D1 (GPIO5) te\u017c dzia\u0142a. <br><em>Uwaga! Po pod\u0142\u0105czeniu czasem nic si\u0119 nie dzieje. Trzeba zresetowa\u0107 <strong>device2<\/strong>. Reset <strong>device1<\/strong> nie pomaga.<\/em><\/p>\n\n\n\n<p>3. Dwa <strong>ESP32<\/strong> na pinach 17 dzia\u0142aj\u0105. Gdy <strong>device2<\/strong> zmieni\u0142em <code>bus.strategy.set_pin(18);<\/code>  te\u017c by\u0142o OK.<\/p>\n\n\n\n<a name=\"3\"><\/a>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">3. <mark><span style=\"color:#2f6e8e\" class=\"tadv-color\">\u0141\u0105czenie ESP32 z ESP8266<\/span><\/mark><\/h3>\n\n\n\n<p>device 1 ESP8266 <strong>PIN D1(GPIO 5)<\/strong> &lt;-&gt; device 2 ESP32 (D1 R32) <strong>PIN12<\/strong><br>device 1 ESP8266 <strong>PIN D1(GPIO 5)<\/strong> &lt;-&gt; device 2 ESP32 (D1 MINI HW-665) <strong>PIN25<\/strong>, <strong>PIN12<\/strong> (TDI), <strong>PIN04<\/strong><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Device1_ESP8266_mix<\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n \n\/*\n * Device1_ESP8266_mix\n * Komplementarny z Device2_ESP32_mix\n *\/\n\n#include &amp;lt;PJON.h&gt;\n\n\/\/ Bus id definition\nuint8_t bus_id&#x5B;] = {0, 0, 0, 1};\n\n\/\/ PJON object\nPJON&amp;lt;SoftwareBitBang&gt; bus(bus_id, 100); \/\/ 1 Strategia Medium Wire, piny w u\u017cyciu: 1 lub 2\n\nvoid receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &amp;amp;packet_info) {\n  \/* Make use of the payload before sending something, the buffer where payload points to is\n     overwritten when a new message is dispatched *\/\n  if ((char)payload&#x5B;0] == &#039;B&#039;) {\n    if (!bus.update()) \/\/ If all packets are delivered, send another\n      bus.reply(&quot;Aida&quot;, 4);\n    Serial.print(&quot;device1 - &quot;);\n    Serial.println((char)(payload&#x5B;0]));\n    digitalWrite(LED_BUILTIN, LOW);\n    delay(1200);\n    digitalWrite(LED_BUILTIN, HIGH);\n    delay(200);\n    \/\/delay(2000);\n\n  }\n};\n\nvoid setup() {\n  pinMode(LED_BUILTIN, OUTPUT);\n  digitalWrite(LED_BUILTIN, HIGH); \/\/ Initialize LED 13 to be off\n\n  bus.strategy.set_pin(15); \/\/ ESP8266 pin D8\n  bus.set_receiver(receiver_function);\n  bus.begin();\n  bus.send(101, &quot;Biba&quot;, 4);\n\n  Serial.begin(115200);\n};\n\nvoid loop() {\n  bus.receive(5000);\n  bus.update();\n};\n<\/pre><\/div>\n\n\n<h5 class=\"wp-block-heading\">Device2_ESP32_mix<\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n\/*\n * Device2_ESP32_mix\n * Komplementarny z Device1_ESP8266_mix\n *\/\n\n\n#include &amp;lt;PJON.h&gt;\n#define LED 2\n\n\/\/ Bus id definition\nuint8_t bus_id&#x5B;] = {0, 0, 0, 1};\n\n\/\/ PJON object\nPJON&amp;lt;SoftwareBitBang&gt; bus(bus_id, 101);\n\nvoid receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &amp;amp;packet_info) {\n  \/* Make use of the payload before sending something, the buffer where payload points to is\n     overwritten when a new message is dispatched *\/\n  if ((char)payload&#x5B;0] == &#039;A&#039;) {\n    if (!bus.update()) \/\/ If all packets are delivered, send another\n      bus.reply(&quot;Biba&quot;, 4);\n      \n    Serial.print(&quot;device 2 - &quot;);\n    for(int i=0; i&amp;lt;length; i++){\n    Serial.print((char)(payload&#x5B;i]));}\n    Serial.println();\n    \n    digitalWrite(LED, HIGH);\n    delay(1200);\n    digitalWrite(LED, LOW);\n    delay(200);\n  }\n\n};\n\nvoid setup() {\n  pinMode(LED, OUTPUT);\n  digitalWrite(LED, LOW); \/\/ Initialize LED BUILT IN to be off\n\n  bus.strategy.set_pin(4); \/\/ ESP32 PIN IO4\n  bus.set_receiver(receiver_function);\n  bus.begin();\n  bus.send(100, &quot;Biba&quot;, 4);\n\n  Serial.begin(115200);\n};\n\nvoid loop() {\n  bus.receive(5000);\n  bus.update();\n};\n<\/pre><\/div>\n\n\n<h5 class=\"wp-block-heading\">DOKUMENTACJA<\/h5>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/github.com\/gioblu\/PJON\/tree\/master\/examples\/ARDUINO\/Network\/SoftwareBitBang\/SendAndReceive\">https:\/\/github.com\/gioblu\/PJON\/tree\/master\/examples\/ARDUINO\/Network\/SoftwareBitBang\/SendAndReceive<\/a><\/li><li><a href=\"https:\/\/www.pjon.org\/SoftwareBitBang.php\">https:\/\/www.pjon.org\/SoftwareBitBang.php<\/a><\/li><\/ul>\n\n\n\n<a name=\"4\"><\/a>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">4. <mark><span style=\"color:#2f6e8e\" class=\"tadv-color\">Voltage tester device, czyli PJON w praktyce<\/span><\/mark><\/h3>\n\n\n\n<p>\u015awietny przyk\u0142ad wykorzystania PJON w praktyce. Dwa arduino, po\u0142\u0105czone kabelkiem pin-y 12. W pierwszym (u mnie Arduino UNO) sprawdzamy napi\u0119cie na A0, rozbijamy warto\u015b\u0107 <strong>int<\/strong> na dwa <strong>bajty<\/strong>:<br> <code>uint8_t content[3] = {'V', (uint8_t)(voltage &gt;&gt; 8), (uint8_t)(voltage &amp; 0xFF)};<\/code><br>i wysy\u0142amy kabelkiem (pin 12) do drugiego arduino (u mnie Nano) jako trzyelementow\u0105 tablic\u0119 uint8_t z pierwszym elementem typu char 'V&#8217;. <\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Transmitter<\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n#include &lt;PJON.h&gt;\n\/* VOLTAGE TESTER DEVICE\n   This is a basic example to show how PJON can be used practically.\n   Lets print in the Serial monitor the voltage detected by the analog\n   pin (max 5v) of another Arduino compatible device connected to the bus.\n\n   This sketch contains the transmitter side. In the Serial monitor\n   is printed transmitted data, exchange duration and transmission speed\n   for easy benchmarking and nominal functionality assessment. *\/\n\n\/\/ Bus id definition\nuint8_t bus_id&#x5B;] = {0, 0, 0, 1};\nunsigned long time;\nint packet;\nint voltage;\n\n\/\/ PJON object\nPJON&lt;SoftwareBitBang&gt; bus(bus_id, 45);\n\nvoid setup() {\n  bus.strategy.set_pin(12);\n  bus.begin();\n  Serial.begin(115200);\n  time = millis();\n  Serial.print(&quot;PJON - Device id &quot;);\n  Serial.print(bus.device_id());\n  Serial.println(&quot; A0 pin voltage cyclical packet sending...&quot;);\n}\n\n\nvoid loop() {\n  if(millis() - time &gt; 2500) {\n    time = millis();\n    voltage = (float)(5.0 \/ (1023.0 \/ analogRead(A0))) * 1000;\n    Serial.print(&quot;Voltage: &quot;);\n    Serial.print(voltage, DEC);\n    Serial.print(&quot;mV &quot;);\n    \/* Avoid Serial and PJON concurrency *\/\n    Serial.flush();\n\n    \/* Send a &quot;V&quot;, break the int in two bytes *\/\n    uint8_t content&#x5B;3] = {&#039;V&#039;, (uint8_t)(voltage &gt;&gt; 8), (uint8_t)(voltage &amp; 0xFF)};\n    unsigned long send_time = micros();\n    \/* Use a blocking version of send. *\/\n    packet = bus.send_packet_blocking(44, bus_id, content, 3);\n\n    \/* Determine communication result and duration *\/\n    send_time = micros() - send_time;\n    float duration = send_time \/ 1000.0;\n    Serial.print((packet == PJON_ACK) ? &quot; Transmitted&quot; : &quot; Some error occurred&quot;);\n    Serial.print(&quot; - Duration: &quot;);\n    Serial.print(duration);\n    Serial.print(&quot; milliseconds&quot;);\n    Serial.print(&quot; - Communication speed: &quot;);\n    \/\/               1 second \/ (duration \/ (overhead + length + PJON_ACK))\n    Serial.print((int)(1000.0 \/ (duration \/ (bus.packet_overhead() + 3 + 1))));\n    Serial.println(&quot;B\/s&quot;);\n  }\n};\n<\/pre><\/div>\n\n\n<h5 class=\"wp-block-heading\">Receiver<\/h5>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; light: false; title: Kod:; toolbar: true; notranslate\" title=\"Kod:\">\n#include &amp;lt;PJON.h&gt;\n\/* VOLTAGE TESTER DEVICE\n   This is a basic example to show how PJON can be used practically.\n   Lets print in the Serial monitor the voltage detected by the analog\n   pin of another Arduino compatible device connected to the bus.\n\n   This sketch contains the receiver side. In the Serial monitor\n   is printed the voltage detected and transmitted by the other device. *\/\n\n\/\/ Bus id definition\nuint8_t bus_id&#x5B;] = {0, 0, 0, 1};\n\n\/\/ PJON object\nPJON&amp;lt;SoftwareBitBang&gt; bus(bus_id, 44);\n\nvoid receiver_function(uint8_t *payload, uint16_t length, const PJON_Packet_Info &amp;amp;packet_info) {\n  \/* Make use of the payload before sending something, the buffer where payload points to is\n     overwritten when a new message is dispatched *\/\n  Serial.print(&quot;RX:&quot;);\n  Serial.print(&quot; Bus id: &quot;);\n  Serial.print(packet_info.receiver_bus_id&#x5B;0]);\n  Serial.print(packet_info.receiver_bus_id&#x5B;1]);\n  Serial.print(packet_info.receiver_bus_id&#x5B;2]);\n  Serial.print(packet_info.receiver_bus_id&#x5B;3]);\n  Serial.print(&quot; Device id: &quot;);\n  Serial.print(packet_info.receiver_id);\n\n  Serial.print(&quot; | TX: &quot;);\n  Serial.print(&quot;Bus id: &quot;);\n  Serial.print(packet_info.sender_bus_id&#x5B;0]);\n  Serial.print(packet_info.sender_bus_id&#x5B;1]);\n  Serial.print(packet_info.sender_bus_id&#x5B;2]);\n  Serial.print(packet_info.sender_bus_id&#x5B;3]);\n  Serial.print(&quot; Device id: &quot;);\n  Serial.print(packet_info.sender_id);\n\n  if((char)payload&#x5B;0] == &#039;V&#039;) {\n    Serial.print(&quot; | Voltage: &quot;);\n    Serial.print((uint16_t)(payload&#x5B;1] &amp;lt;&amp;lt; 8) | (uint16_t)(payload&#x5B;2] &amp;amp; 0xFF));\n\n    Serial.print(&quot;mV&quot;);\n    \/\/ Get back the original integer from the 2 separate bytes\n  }\n  Serial.println();\n};\n\nvoid setup() {\n  bus.strategy.set_pin(12);\n  bus.begin();\n\n  bus.set_receiver(receiver_function);\n\n  Serial.begin(115200);\n};\n\nvoid loop() {\n  bus.receive(1000);\n};\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\">Dodatkowa dokumentacja<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/forbot.pl\/blog\/konwersja-zmiennych-integer-charbyte-id2860\">Konwersja zmiennych integer na char\/byte<\/a><\/li><\/ul>\n\n\n\n<a name=\"LINK\"><\/a>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><mark><span style=\"color:#2f6e8e\" class=\"tadv-color\">LINKI<\/span><\/mark><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/youtu.be\/yPu45xoAHGg\" target=\"_blank\">PJON Strategies showcase<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.youtube.com\/watch?v=8okhWVkMnng\" target=\"_blank\">First steps with PJON<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.youtube.com\/watch?v=k7kuZIPaL98\" target=\"_blank\">PJON protocol testing &#8211; not recovering after bus disconnection<\/a><\/li><\/ul>\n\n\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"PJON Strategies showcase\" width=\"774\" height=\"435\" src=\"https:\/\/www.youtube.com\/embed\/yPu45xoAHGg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Tw\u00f3rcy biblioteki PJON napisali: Dzi\u0119ki PJON\u00ae (Padded Jittering Operative Network) z du\u017c\u0105 elastyczno\u015bci\u0105 i bez potrzeby korzystania z us\u0142ug zewn\u0119trznego dostawcy lub us\u0142ugi w chmurze mo\u017cesz bezpiecznie \u0142\u0105czy\u0107 sprz\u0119t i&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2,80,5],"tags":[111],"class_list":["post-3716","post","type-post","status-publish","format-standard","hentry","category-arduino","category-esp32","category-esp8266","tag-pjon"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/3716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/comments?post=3716"}],"version-history":[{"count":38,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/3716\/revisions"}],"predecessor-version":[{"id":3796,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/posts\/3716\/revisions\/3796"}],"wp:attachment":[{"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/media?parent=3716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/categories?post=3716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arduino.net.pl\/index.php\/wp-json\/wp\/v2\/tags?post=3716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}