{"id":3769,"date":"2013-11-21T23:18:48","date_gmt":"2013-11-22T06:18:48","guid":{"rendered":"http:\/\/www.apolonio.com\/blog\/?p=3769"},"modified":"2013-11-21T23:18:48","modified_gmt":"2013-11-22T06:18:48","slug":"finally-got-arduino-to-talk-to-linux","status":"publish","type":"post","link":"https:\/\/www.apolonio.com\/blog\/?p=3769","title":{"rendered":"Finally Got Arduino to Talk To Linux"},"content":{"rendered":"<p>FINALLY, I been working on this for a while.<\/p>\n<p>I been trying to get Linux to talk to arduino via serial port.<\/p>\n<p>Basically the read is what I am trying to do.<\/p>\n<p>The huge breakthrough was finding a someone that did the source code in C:<\/p>\n<p>Found it here<\/p>\n<p><a href=\"http:\/\/todbot.com\/blog\/2013\/04\/29\/arduino-serial-updated\/\">http:\/\/todbot.com\/blog\/2013\/04\/29\/arduino-serial-updated\/<\/a><\/p>\n<p>You can download the source with git using the following command<\/p>\n<pre>git clone https:\/\/github.com\/todbot\/arduino-serial\/<\/pre>\n<p>Then go into\u00a0arduino-serial and run make<\/p>\n<p>Then you got\u00a0arduino-serial to play with<\/p>\n<p>Here is how I used it in a bash script<\/p>\n<pre>#!\/bin\/bash\r\nCOUNTER=1\r\nwhile [ $COUNTER -eq 1 ]; do\r\n SERIALCOMMAND=`\/home\/larry\/bin\/arduino-serial -b 115200 -p \/dev\/ttyUSB0 -r | dos2unix | grep \"read string\" | cut -d\\: -f2`\r\n echo \"$SERIALCOMMAND\"\r\n if [ \"$SERIALCOMMAND\" == \"TV\" ]; then\r\n COUNTER=0\r\n fi\r\n echo $COUNTER\r\ndone<\/pre>\n<p>Note the dos2unix command. \u00a0It was the cause of major frustration for my script cause of the hidden strings.<\/p>\n<p>Its all good though, it works, now I can run read values into bash on my Linux box.<\/p>\n<p>Triumph<\/p>\n<p>Earned right to be lazy doing pushups and situps then bed.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FINALLY, I been working on this for a while. I been trying to get Linux to talk to arduino via serial port. Basically the read is what I am trying to do. The huge breakthrough was finding a someone that &hellip; <a href=\"https:\/\/www.apolonio.com\/blog\/?p=3769\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3769","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3769"}],"version-history":[{"count":1,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3769\/revisions"}],"predecessor-version":[{"id":3770,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3769\/revisions\/3770"}],"wp:attachment":[{"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.apolonio.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}