V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
sonders
V2EX  ›  问与答

关于 ESP32--蓝牙问题

  •  
  •   sonders · 2021-10-31 19:27:28 +08:00 · 885 次点击
    这是一个创建于 901 天前的主题,其中的信息可能已经有所发展或是发生改变。

    给 ESP32 通电,烧录程序后,按下 EN 键,串口调试中并没有正常打印文本,手机蓝牙扫描也扫描不出蓝牙,搜索不出问题答案,跑来 V2 试试。
    不太懂这些,就是想玩一下。
    代码部分:

    #include <Arduino.h>
    #include <BluetoothSerial.h>
    
    BluetoothSerial SerialBT;
    void setup() {
      Serial.begin(115200);
      SerialBT.begin("ESP32");
      Serial.printf("satrt 蓝牙 \r\n");
    
      // put your setup code here, to run once:
    }
    
    void loop() {
      if(Serial.available()) {
        SerialBT.write(Serial.read());
      }
      if(SerialBT.available()) {
        Serial.write(SerialBT.read());
      }
      delay(1);
      // put your main code here, to run repeatedly:
    }
    
    15 条回复    2021-11-18 12:10:05 +08:00
    weicoder
        1
    weicoder  
       2021-10-31 19:35:06 +08:00
    波特率设置对了吗
    sonders
        2
    sonders  
    OP
       2021-10-31 19:39:22 +08:00
    @weicoder 波特率是对的,串口调试助手也是 115200
    amwyyyy
        3
    amwyyyy  
       2021-11-01 09:37:44 +08:00
    不至于串口都没打印,正常烧录了吗,跑个 helloworld 试试先。
    sonders
        4
    sonders  
    OP
       2021-11-01 09:45:24 +08:00
    @amwyyyy 我在做这个蓝牙之前写过一个 led 小灯,都是正常打印正常运行的。
    sonders
        5
    sonders  
    OP
       2021-11-01 09:46:47 +08:00
    @amwyyyy 烧录的话,我有看过一个文章,说是在出现 connect...___...的时候按下 en 键,但是我每次按烧录就直接停掉了
    Rapisurazuri
        6
    Rapisurazuri  
       2021-11-01 09:55:26 +08:00 via Android
    @sonders 我记得如果 esp32 带 ch340g 的话,不需要手动 reset ,直接烧录就可以
    amwyyyy
        7
    amwyyyy  
       2021-11-01 09:56:43 +08:00
    @sonders connect 之后会出现百分比进度条,不要按按键。
    sonders
        8
    sonders  
    OP
       2021-11-01 10:06:28 +08:00
    @Rapisurazuri 没有 reset ,都是直接烧录的,但是就是串口没打印,扫描也扫描不到
    sonders
        9
    sonders  
    OP
       2021-11-01 10:07:20 +08:00
    @amwyyyy 我都试了一遍,但是成功烧录之后也没效果
    amwyyyy
        10
    amwyyyy  
       2021-11-01 10:09:43 +08:00
    @sonders 烧录之后,打开串口调试工具,再按一下 en
    sonders
        11
    sonders  
    OP
       2021-11-01 10:33:52 +08:00
    @amwyyyy 没用的,那个打印语句没有输出
    theqiang
        12
    theqiang  
       2021-11-01 15:16:39 +08:00 via Android
    买的哪家的,我买的 tb 上某家的有个技术群,里面大佬挺多。你问问卖家有没有群
    sonders
        13
    sonders  
    OP
       2021-11-01 17:20:01 +08:00
    @theqiang 我也是在淘宝上买的,进了技术群,没人回答问题,我今天退群了
    llkhsfy
        14
    llkhsfy  
       2021-11-18 00:14:21 +08:00 via iPhone
    确定正常烧录完毕吗
    sonders
        15
    sonders  
    OP
       2021-11-18 12:10:05 +08:00
    @llkhsfy 确认的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1488 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 17:10 · PVG 01:10 · LAX 10:10 · JFK 13:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.