如何解决arduino TFT 屏蔽干扰 BNO055 (I2C)
我的设置:
arduino uno R3
||
种子工作室基地 SHIELD
||
hiletgo ILI9341 TFT 显示屏屏蔽
基础屏蔽上的 I2C 连接器 Adafruit BNO055
我正在编译我的代码而没有 #define USE_ADAFRUIT_SHIELD_PINOUT;这意味着它将使用示例标题中的引脚:
// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
// When using the BREAKOUT BOARD only,use these 8 data lines to the LCD:
// For the Arduino Uno,Duemilanove,Diecimila,etc.:
// D0 connects to digital pin 8 (Notice these are
// D1 connects to digital pin 9 NOT in order!)
// D2 connects to digital pin 2
// D3 connects to digital pin 3
// D4 connects to digital pin 4
// D5 connects to digital pin 5
// D6 connects to digital pin 6
// D7 connects to digital pin 7
// For the Arduino Mega,use digital pins 22 through 29
请注意,A4 和 A5 未使用,因此它们应该可用于 I2C 协议。
基本上我想从 BNO 读取一些内容并显示在屏幕上。
屏幕亮起,BNO 亮起。
但在 LCD 变为空白后不久。我能够将问题追溯到 Adafruit_BNO055.cpp 中的以下行:
bool Adafruit_BNO055::readLen(adafruit_bno055_reg_t reg,byte *buffer,uint8_t len)
正在使用 _wire 调用。
如果我清空此函数(注释掉所有内容),则屏幕保持活动状态(但显然没有从 BNO055 读取任何内容。
问题:
-
我为什么要处理这种干扰?
-
假设我能够编译它并使用 #define USE_ADAFRUIT_SHIELD_PINOUT 运行它,这是否意味着屏幕也将使用 I2C,而让我的所有数字和 A0-A3 可用于其他用途?
-
为什么我的兼容 ILI9341 的屏幕使用 #define USE_ADAFRUIT_SHIELD_PINOUT 声明无法正常运行? HiLetgo 与 Adafruit 不兼容吗?不同的 I2C 地址?
忽略连接到 I2C 连接以外的电路板的插头。我在运行这个程序之前删除了那些。
谢谢!
解决方法
使用专用数据接口解决了问题,使 A0--A5 端口可用于 I2c。那就不再干涉了
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。