{"id":49,"date":"2020-02-22T14:08:20","date_gmt":"2020-02-22T13:08:20","guid":{"rendered":"http:\/\/www.w2hp.net\/wp\/?p=49"},"modified":"2020-02-22T14:08:20","modified_gmt":"2020-02-22T13:08:20","slug":"raspberry-drives-stepper","status":"publish","type":"post","link":"https:\/\/wp.w2hp.net\/?p=49","title":{"rendered":"Raspberry drives Stepper"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\">#&nbsp;5 wire Steppermotor  with driver uln2003 and i2c portmultiplexer pcf8574<br># compile with <br># gcc -o go_step  go_step.c<br># pcf8574 p0 -&gt; uln2003 in1 and so on.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;linux\/i2c-dev.h&gt;\n#include &lt;linux\/i2c.h&gt;\n#include &lt;fcntl.h&gt;\n#include &lt;string.h&gt;\n#include &lt;sys\/ioctl.h&gt;\n#include &lt;sys\/types.h&gt;\n#include &lt;sys\/stat.h&gt;\n#include &lt;unistd.h&gt;\n\n\nchar Device[] = \"\/dev\/i2c-1\";\nint fd;\nint res;\nint  address = 0x20;\nchar Buffer[1];\n\n\n\n\nint main(int argc, char** argv)                                                \/\/ Programmstart\n{\nint i;\nint t;\nunsigned char ca[8];\n\nca[0]= 0x08;\nca[1]= 0x12;\nca[2]= 0x04;\nca[3]= 0x06;\nca[4]= 0x02;\nca[5]= 0x03;\nca[6]= 0x01;\nca[7]= 0x09;\n\n\n        fd = open(Device, O_RDWR);\n\n        if (ioctl(fd, I2C_SLAVE, address) &lt; 0)                                 \/\/ Set the port options and set the address of the device we wish to speak to\n        {\n                printf(\"Unable to get bus access to talk to slave\\n\");\n                exit(1);\n        }\n\n        \/\/res = write(fd, argv[1], 1);\n       for(t=0; t&lt;3600;t++)\n      {\n       i=0;\n       while ( i&lt;8)\n       {\n       \/\/     printf(\"%d \\n\", i);\n       \/\/sprintf(Buffer,\"%d\",i);\n       Buffer[0]=ca[i]; \n        res = write(fd, Buffer, 1);\n        i++;\n        usleep(6000);<br>        \/\/not less then 1500\n       }\n       }\n        close(fd);\n        return 0;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#&nbsp;5 wire Steppermotor with driver uln2003 and i2c portmultiplexer pcf8574# compile with # gcc -o go_step go_step.c# pcf8574 p0 -&gt; uln2003 in1 and so on. #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;linux\/i2c-dev.h&gt; #include &lt;linux\/i2c.h&gt; #include &lt;fcntl.h&gt; #include &lt;string.h&gt; #include &lt;sys\/ioctl.h&gt; #include &lt;sys\/types.h&gt; #include &lt;sys\/stat.h&gt; #include &lt;unistd.h&gt; char Device[] = &#8222;\/dev\/i2c-1&#8220;; int fd; int res; int address &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/wp.w2hp.net\/?p=49\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eRaspberry drives Stepper\u201c<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":1,"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":50,"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/50"}],"wp:attachment":[{"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.w2hp.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}