{"id":828,"date":"2017-12-03T18:58:04","date_gmt":"2017-12-03T18:58:04","guid":{"rendered":"https:\/\/zhutarduino.wordpress.com\/?page_id=828"},"modified":"2019-03-26T22:17:31","modified_gmt":"2019-03-26T22:17:31","slug":"learning-arduino-for-beginners-ep13-wired-serial-communication-between-two-arduino-boards","status":"publish","type":"page","link":"https:\/\/thezhut.com\/?page_id=828","title":{"rendered":"Learning Arduino for beginners EP#13 wired serial communication between two Arduino boards"},"content":{"rendered":"<h1>In this tutorial we will take a look at how you can make two Arduino boards communicate with each other via wired serial connection.<\/h1>\n<p><iframe loading=\"lazy\" title=\"Learning Arduino for beginners EP#13 wired serial communication between two Arduino boards\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/FUSiV4yBNF0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h1><a href=\"https:\/\/www.facebook.com\/zarduino\/\"><strong>Check us out on Facebook!<\/strong><\/a><\/h1>\n<h2>ARDUINO CODE:<\/h2>\n<h2>transmitter:<\/h2>\n<p>#define button 13<\/p>\n<p>void setup() {<br \/>\nSerial.begin(9600);<br \/>\npinMode(button, INPUT_PULLUP);<\/p>\n<p>}<\/p>\n<p>void loop() {<\/p>\n<p>if (digitalRead(button) == LOW)<br \/>\n{<br \/>\nSerial.write(100);<br \/>\ndelay(500);<br \/>\n}<br \/>\ndelay(100);<br \/>\n}<\/p>\n<h2>receiver:<\/h2>\n<p>#define led 13<br \/>\nint val;<br \/>\nint state;<\/p>\n<p>void setup() {<br \/>\nSerial.begin(9600);<br \/>\npinMode(led, OUTPUT);<br \/>\ndigitalWrite(led, LOW);<\/p>\n<p>}<\/p>\n<p>void loop() {<br \/>\nif (Serial.available() &gt; 0)<br \/>\n{<br \/>\nval = Serial.read();<\/p>\n<p>if (val == 100 &amp;&amp; state == 0)<br \/>\n{<br \/>\ndigitalWrite(led, HIGH);<br \/>\nstate = 1;<br \/>\ndelay(250);<br \/>\n}<br \/>\nelse if (val == 100 &amp;&amp; state == 1)<br \/>\n{<br \/>\ndigitalWrite(led,LOW);<br \/>\nstate = 0;<br \/>\ndelay(250);<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial we will take a look at how you can make two Arduino boards communicate with each other via wired serial connection. Check us out on Facebook! ARDUINO CODE: transmitter: #define button 13 void setup() { Serial.begin(9600); pinMode(button, &hellip; <a href=\"https:\/\/thezhut.com\/?page_id=828\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":809,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-828","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/828","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=828"}],"version-history":[{"count":1,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/828\/revisions"}],"predecessor-version":[{"id":1272,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/828\/revisions\/1272"}],"up":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/809"}],"wp:attachment":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}