Raspberry Pi GPIO Library in Go?

polaris · · 897 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;m looking for a GPIO library to use on a Raspberry Pi B+. The few I&#39;ve found don&#39;t seem to be maintained any more and have breaking issues... </p> <p>Does anyone have any recommendations?</p> <p>EDIT: There seems to be a problem with all libraries importing the <code>syscall</code> package. Whenever I try to build, I get a bunch of errors saying <code>undefined: syscall.FOOBAR</code>. I&#39;m developing on Windows 10 if that makes a difference.</p> <hr/>**评论:**<br/><br/>gmonnerat: <pre><p>I know <a href="https://github.com/kidoman/embd">embd</a> and <a href="http://gobot.io/">gobot.io</a></p></pre>danhardman: <pre><p>Embd looks promising. I hadn&#39;t properly considered it as it seems quite large for what I want to do. Something like <a href="https://github.com/stianeikeland/go-rpio" rel="nofollow">stianeikeland/go-rpio</a> would be great, but I can&#39;t get it to build. </p> <p>EDIT: Same problem with Embd. There&#39;s an issue using the <code>syscall</code> package. I&#39;m developing on Windows 10</p></pre>stillalone: <pre><p>You&#39;re running windows 10 on a raspberry pi and you want to control gpios? Out of curiosity, why are you running windows 10?</p></pre>robvdl: <pre><p>I was afraid of this as soon as they added support for Windows 10 for the Pi 2, a whole lot of young new developers starting to use it because they &#34;know&#34; Windows and think it would be easier to use. Really, they are shooting themselves in the foot. I would say start using Linux now, stop the Windows 10 madness while you still can.</p></pre>danhardman: <pre><p>Replied above. I&#39;m not that silly! :)</p></pre>danhardman: <pre><p>Noooo, I&#39;m developing on Windows 10. It&#39;ll be running on raspbian once I put it on the raspberry pi. </p></pre>stillalone: <pre><p>wtf. what gpios are there to access on a typical Windows PC? You can&#39;t just access gpios on any system willy nilly. Even if they were accessible you wouldn&#39;t know what they are for and you could damage the system.</p></pre>1Gijs: <pre><p>And there is <a href="https://github.com/mrmorphic/hwio" rel="nofollow">https://github.com/mrmorphic/hwio</a></p> <p>Maybe you can also list the onces you tried and did not work (well) ?</p></pre>danhardman: <pre><p>I&#39;ve updated the post. The errors I get are to do with importing the <code>syscall</code> package.</p></pre>qrv3w: <pre><p><a href="https://github.com/stianeikeland/go-rpio" rel="nofollow">stianeikeland/go-rpio</a> is a great one. Btw, I wrote a comparison of using Go vs C (and Python in one case) for read/writing on GPIO pins <a href="http://rpiai.com/benchmarking-gpio-pins-of-raspberry-pi-model-b-plus/index.html" rel="nofollow">here</a>.</p></pre>danhardman: <pre><p>This library is the one I first encountered the error with. It&#39;s due to the use of the <code>syscall</code> package. For some reason though, I&#39;ve just noticed the errors only appear on atom using the <code>go-plus</code> package... </p></pre>dgryski: <pre><p>Hardware packages are generally listed at <a href="https://github.com/rakyll/go-hardware" rel="nofollow">https://github.com/rakyll/go-hardware</a></p></pre>binaryblade: <pre><p>Lol one of those is probably mine.</p></pre>danhardman: <pre><p>Any idea how to fix the issue I&#39;m getting? Is it the OS I&#39;m using or is it up to the library to update?</p></pre>binaryblade: <pre><p>yeah, syscall is no good on win10 it takes a different form. you can look up what the developers have to say about syscall but it&#39;s not good. One way to do it without syscall is just file io in proc.</p></pre>danhardman: <pre><p>I only want to develop on Windows. It&#39;ll be running on raspbian</p></pre>binaryblade: <pre><p>That becomes nearly impossible.</p></pre>bwooce: <pre><p>Go supports architecture dependent code, so compiling on win10 won&#39;t include that code (if you don&#39;t cross compile) and so you&#39;ll get errors. </p> <p>I use Dave Cheneys gpio package and have a similar issue when compiling on Linux/intel, it&#39;s not that I expected the gpio code to work but it won&#39;t compile...</p> <p>If you cross compile then you can&#39;t test on the win10 host, so you might need to comment out the gpio bits if you&#39;re serious about persisting with that approach.</p></pre>awaitsV: <pre><p>I believe <a href="https://github.com/kidoman/embd" rel="nofollow">https://github.com/kidoman/embd</a> has the goal of being cross compilable. They gave a <a href="https://www.youtube.com/watch?v=0bh07LTq-oA" rel="nofollow">talk at the last GopherCon India.</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

897 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传