简体   繁体   English

使用I2c协议从Raspberry pi向Arduino发送2Dimensional Listarray

[英]send 2Dimensional Listarray From Raspberry pi to the Arduino with I2c protocol

im working on Computer vision (opencv )python and i had a result from the image , so this results is 2D List-arrays that should go to the Arduino by i2c buffer , so i realized that there is a library called smbus that interfacing the Raspberry pi with i2c ports so send and receive data , So i searched on References pages that give me some explanation about this Library but i didn't found eny thing useful...and all what i found is this sites which is not enough information 我正在计算机视觉(opencv)python上工作,我从图像中得到了一个结果,所以这个结果是应该通过i2c缓冲区进入Arduino的2D List-arrays,所以我意识到有一个名为smbus的库与Raspberry接口带有i2c端口的pi可以发送和接收数据,所以我在“参考”页面上进行了搜索,这些页面为我提供了有关此库的一些解释,但是我发现eny没什么用处...而我所发现的只是该站点,这是不够的信息

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/i2c/smbus-protocol http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/i2c/smbus-protocol

http://wiki.erazor-zone.de/wiki:linux:python:smbus:doc http://wiki.erazor-zone.de/wiki:linux:python:smbus:doc

so im indeed need eny explanation how to send 2D Arrays Like (x,y) Coordinates from Pi to Arduino with i2c buffer 所以我确实需要解释一下如何使用i2c缓冲区将Pi(x,y)二维数组从Pi发送到Arduino

thanks in advance 提前致谢

Check this repository . 检查此存储库 We connected a NTC CHIP to a Adafruit Trinket using I2C, but connecting the PI with the an Arduino should be very much the same. 我们使用I2C将NTC CHIP连接到Adafruit Trinket,但是将PI与Arduino连接应该几乎相同。

The key file is the I2C.py file, which uses SMBus. 密钥文件是I2C.py文件,它使用SMBus。

To talk to the Trinket Pro (ATMega328) we used the trinket.py file. 为了与Trinket Pro(ATMega328)通话,我们使用了trinket.py文件。

And the corresponding client code in the ATMega328, using the Arduino library, specially the Wire.h is located in the hwthontrinket.ino file. 以及使用Arduino库(尤其是Wire.h)的ATMega328中的相应客户端代码位于hwthontrinket.ino文件中。

Finally, you can check how to use the classes in the test files . 最后,您可以检查如何使用测试文件中的类。 You basically need to pass the bus number and the address of the device. 基本上,您需要传递总线号和设备地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM