跳转到内容
彼岸论坛
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[问与答] 请教下 V 社大神,关于 esp32 的相关问题(付费寻找技术支持)


小天管理

已推荐帖子

我用的是 esp32 S3 的芯片,使用下方展示的代码,扫不到任何 i2c 设备,而且会卡在 Wire.begin(31,30),然后无限 setup 。不传引脚则正常运行,提示"No I2C devices foundn"。

1724893004556-6432cd4e-e0c6-40d2-aee5-51
#include <Wire.h>

void setup() {
    Wire.begin(31,30);
    Serial.begin(115200);
    Serial.println("nI2C Scanner");
    byte error, address;
    int nDevices;
    Serial.println("Scanning...");
    nDevices = 0;
    for(address = 1; address < 127; address++ ) {
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
        if (error == 0) {
            Serial.print("I2C device found at address 0x");
            if (address<16) {
                Serial.print("0");
            }
            Serial.println(address,HEX);
            nDevices++;
        }
        else if (error==4) {
            Serial.print("Unknown error at address 0x");
            if (address<16) {
                Serial.print("0");
            }
            Serial.println(address,HEX);
        }    
    }
    if (nDevices == 0) {
        Serial.println("No I2C devices foundn");
    }
    else {
        Serial.println("donen");
    }
    delay(5000);  
    Serial.print("i2c devices found:");
    Serial.println(nDevices); 
}

void loop() {

}

因为电路图是外包公司画的(我再也不找外包了😭),现在做了几个样板,用起来有一些问题,电路图我看不太懂,现在在找靠谱的大神,付费请教一些问题。有相关经验的可以V:Taxze2019

意见的链接
分享到其他网站

加入讨论

您现在可以发表并稍后注册. 如果您是会员,请现在登录来参与讨论.

游客
回复主题...

×   粘贴为富文本.   粘贴为纯文本来代替

  只允许使用75个表情符号.

×   您的链接已自动嵌入.   显示为链接来代替

×   您之前的内容已恢复.   清除编辑器

×   您无法直接粘贴图片.要从网址上传或插入图片.

  • 游客注册

    游客注册

  • 会员

  • 最新的状态更新

    没有最新的状态更新
  • 最近查看

    • 没有会员查看此页面.
×
×
  • 创建新的...