{"id":188,"date":"2017-03-04T18:55:15","date_gmt":"2017-03-04T18:55:15","guid":{"rendered":"http:\/\/ulm.taddug.com\/?p=188"},"modified":"2017-03-13T20:36:20","modified_gmt":"2017-03-13T20:36:20","slug":"arduino-sketches","status":"publish","type":"post","link":"https:\/\/ulm.taddug.com\/index.php\/2017\/03\/04\/arduino-sketches\/","title":{"rendered":"Arduino Sketch for BT"},"content":{"rendered":"<p>serial communication via bluetooth<\/p>\n<p>#include &lt;SoftwareSerial.h&gt; \u00a0\/\/downloaded library<br \/>\nSoftwareSerial BTserial(2, 3); \/\/ RX | TX \u00a0 \/\/ appropriate pins to transmit and then receive from<br \/>\n\/\/ Connect the HC-05 TX to the Arduino RX on pin 2.<br \/>\n\/\/ Connect the HC-05 RX to the Arduino TX on pin 3 through a voltage divider.<br \/>\n\/\/ for exmample \u00a0we can use \u00a047k and 68k resistors<br \/>\n\/\/when sending from serial be sure both NL and CR are on and baud rate matches<br \/>\n\/\/ I have not used a voltage divider&#8230;until now<\/p>\n<p>void setup()<br \/>\n{<br \/>\nSerial.begin(9600);<br \/>\n\/\/ HC-06 default serial speed is 9600<br \/>\nBTserial.begin(9600);<br \/>\n}<\/p>\n<p>void loop()<br \/>\n{<br \/>\n\/\/ Keep reading from HC-05 and send to Arduino Serial Monitor<br \/>\nif (BTserial.available())<br \/>\n{<br \/>\nSerial.write(BTserial.read());<br \/>\n}<\/p>\n<p>\/\/ Keep reading from Arduino Serial Monitor and send to HC-05<br \/>\nif (Serial.available())<br \/>\nBTserial.write(Serial.read());<\/p>\n<p>}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>serial communication via bluetooth #include &lt;SoftwareSerial.h&gt; \u00a0\/\/downloaded library SoftwareSerial BTserial(2, 3); \/\/ RX [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":262,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-188","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/posts\/188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/comments?post=188"}],"version-history":[{"count":2,"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/posts\/188\/revisions\/207"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/media\/262"}],"wp:attachment":[{"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ulm.taddug.com\/index.php\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}