关于Blinker蓝牙接入的问题-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1260|回复: 4

[已解答] 关于Blinker蓝牙接入的问题

[复制链接]
发表于 2020-3-16 14:16 | 显示全部楼层 |阅读模式
开发文档上写着:// 在Arduino UNO上使用软串口通信Blinker.begin(); // 默认设置: 数字IO 2(RX) 3(TX), 波特率 9600 bps  Blinker.begin(4, 5); // 设置数字IO 4(RX) 5(TX), 默认波特率 9600 bps  Blinker.begin(4, 5, 115200); // 设置数字IO 4(RX) 5(TX) 及波特率 115200 bps  // 在Arduino Mega/Due上使用硬串口通信Blinker.begin(15, 14, 9600);   //使用Serial3  Blinker.begin(17, 16, 115200); //使用Serial2  Blinker.begin(19, 20, 115200); //使用Serial

我用的是WEMOS D1 R1的板子,WIFI接入已经成功,又想用它来试试蓝牙接入(连接了JDY18模块),于是打开了Blinker蓝牙实例,由于WEMOS D1 R1开发板的RX,TX分别为D0,D1
我将Blinker.begin(); 改为Blinker.begin(D0,D1,9600);
编译时显示:
Arduino:1.8.3 (Windows 10), 开发板:"WeMos D1 R1, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:25:0,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_464883\Hello_BLE.ino:48:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerial.h: In member function 'virtual char* BlinkerSerial::lastRead()':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerial.h:36:75: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         char * lastRead()   { if (isFresh) return streamData; else return ""; }

                                                                           ^

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:83:0,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:26,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_464883\Hello_BLE.ino:48:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::dataParse()':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:234:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         char* dataParse()       { if (canParse) return conn->lastRead(); else return ""; }

                                                                                      ^

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:26:0,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_464883\Hello_BLE.ino:48:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:777:97: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);

                                                                                                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_str(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7012:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_joy(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7019:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         else return "";

                     ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_rgb(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7026:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_int(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7032:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_tab(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7038:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21:0,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_464883\Hello_BLE.ino:48:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h: In member function 'void BlinkerSerialBLE::begin(uint8_t, uint8_t, uint32_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:93:30: error: 'RX' was not declared in this scope

             if (ss_rx_pin == RX && ss_tx_pin == TX) {

                              ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:93:49: error: 'TX' was not declared in this scope

             if (ss_rx_pin == RX && ss_tx_pin == TX) {

                                                 ^

C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_464883\Hello_BLE.ino: At global scope:

C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_464883\Hello_BLE.ino:50:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerButton Button1("btn-abc");

                                ^

C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_464883\Hello_BLE.ino:51:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerNumber Number1("num-abc");

                                ^

exit status 1
为开发板 WeMos D1 R1 编译时出错。

在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。



Blinker蓝牙接入不能用WEMOS D1 R1吗

发表于 2020-3-16 14:58 | 显示全部楼层
可以,请使用软串口
 楼主| 发表于 2020-3-16 17:42 | 显示全部楼层
奈何col 发表于 2020-3-16 14:58
可以,请使用软串口

我设置了软串口
#include <SoftwareSerial.h>
SoftwareSerial mySerial(D3,D4);
Blinker.begin(D3,D4,115200);
还是编译不出来呢


Arduino:1.8.3 (Windows 10), 开发板:"WeMos D1 R1, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:25:0,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_909967\Hello_BLE.ino:50:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerial.h: In member function 'virtual char* BlinkerSerial::lastRead()':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerSerial.h:36:75: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         char * lastRead()   { if (isFresh) return streamData; else return ""; }

                                                                           ^

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:83:0,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:26,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_909967\Hello_BLE.ino:50:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::dataParse()':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:234:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         char* dataParse()       { if (canParse) return conn->lastRead(); else return ""; }

                                                                                      ^

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:26:0,

                 from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_909967\Hello_BLE.ino:50:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:777:97: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);

                                                                                                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_str(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7012:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_joy(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7019:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         else return "";

                     ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_rgb(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7026:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_int(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7032:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_tab(uint8_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:7038:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

In file included from C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:21:0,

                 from C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_909967\Hello_BLE.ino:50:

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h: In member function 'void BlinkerSerialBLE::begin(uint8_t, uint8_t, uint32_t)':

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:93:30: error: 'RX' was not declared in this scope

             if (ss_rx_pin == RX && ss_tx_pin == TX) {

                              ^

C:\Users\MSI\Documents\Arduino\libraries\blinker-library-master\src/BlinkerSerialBLE.h:93:49: error: 'TX' was not declared in this scope

             if (ss_rx_pin == RX && ss_tx_pin == TX) {

                                                 ^

C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_909967\Hello_BLE.ino: At global scope:

C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_909967\Hello_BLE.ino:52:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerButton Button1("btn-abc");

                                ^

C:\Users\MSI\AppData\Local\Temp\arduino_modified_sketch_909967\Hello_BLE.ino:53:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerNumber Number1("num-abc");

                                ^

exit status 1
为开发板 WeMos D1 R1 编译时出错。

在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
发表于 2020-3-16 19:06 | 显示全部楼层
我这边测试了,使用hello ble例程编译正常。
不需要你添加软串口语句

 楼主| 发表于 2020-3-16 20:24 | 显示全部楼层
奈何col 发表于 2020-3-16 19:06
我这边测试了,使用hello ble例程编译正常。
不需要你添加软串口语句

Blinker.begin();这句改成什么呢
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 07:27 , Processed in 0.099943 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表