新手上路!痛苦几天都解决不了,求助。-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2516|回复: 8

[已解答] 新手上路!痛苦几天都解决不了,求助。

[复制链接]
发表于 2020-3-1 13:36 | 显示全部楼层 |阅读模式
用的是ESP8266-01S开始按照教程下载了点灯科技的blinker第三方库,安装好ESP8266的扩展,通过blinke-Holle-wifi已经在点灯科技APP点亮8266上的小蓝灯。
由于那个blinke-Holle-wifi的代码是没有小爱同学控制的代码,我就从别人那里下载回来用,结果烧录到8266之后,能在点灯APP上看到在线,
但是就是不能点亮小蓝灯,编译也没有报错,就是很多红色字。
arduino软件是安装在D盘的

这是下载别人的代码,我放在F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai

#define BLINKER_WIFI
#define BLINKER_MIOT_OUTLET   //小爱同学

#include <Blinker.h>

char auth[] = "5e40e3e3619f";  //设备key
char ssid[] = "LOCO";  //路由器wifi ssid
char pswd[] = "1688816888";  //路由器wifi 密码
BlinkerButton Button1("btn-abc");     //定义按钮键名
bool oState = false;
int counter = 0;
void miotPowerState(const String & state)
{
    BLINKER_LOG("need set power state: ", state);

    if (state == BLINKER_CMD_ON) {     //小爱同学控制开命令 此处修改为点动模式,适合按钮操作,
        digitalWrite(0, LOW);
        delay(200);
        digitalWrite(0, HIGH);
        BlinkerMIOT.powerState("on");

        BlinkerMIOT.print();

        oState = true;
    }
    else if (state == BLINKER_CMD_OFF) {   //小爱同学控制关命令 此处修改为点动模式,适合按钮操作,
        digitalWrite(0,LOW);
        delay(200);
        digitalWrite(0, HIGH);
        BlinkerMIOT.powerState("off");

        BlinkerMIOT.print();

        oState = false;
    }
}

void miotQuery(int32_t queryCode)      //小爱同学控制
{
    BLINKER_LOG("MIOT Query codes: ", queryCode);

    switch (queryCode)
    {
        case BLINKER_CMD_QUERY_ALL_NUMBER :
            BLINKER_LOG("MIOT Query All");
            BlinkerMIOT.powerState(oState ? "on" : "off");
            BlinkerMIOT.print();
            break;
        case BLINKER_CMD_QUERY_POWERSTATE_NUMBER :
            BLINKER_LOG("MIOT Query Power State");
            BlinkerMIOT.powerState(oState ? "on" : "off");
            BlinkerMIOT.print();
            break;
        default :
            BlinkerMIOT.powerState(oState ? "on" : "off");
            BlinkerMIOT.print();
            break;
    }
}

void dataRead(const String & data)      // 如果未绑定的组件被触发,则会执行其中内容
{
    BLINKER_LOG("Blinker readString: ", data);

    Blinker.vibrate();

    uint32_t BlinkerTime = millis();

    Blinker.print("millis", BlinkerTime);
}

void button1_callback(const String & state)     //点灯app内控制按键触发
{
    BLINKER_LOG("get button state: ", state);
    digitalWrite(0,LOW);
    delay(200);
    digitalWrite(0, HIGH);
}

void setup()
{
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);

    pinMode(0, OUTPUT);              //定义io口为输出
    digitalWrite(0, HIGH);           //定义io默认为高电平

    Blinker.begin(auth, ssid, pswd);
    Blinker.attachData(dataRead);

    BlinkerMIOT.attachPowerState(miotPowerState);
    BlinkerMIOT.attachQuery(miotQuery);
    Button1.attach(button1_callback);      
}

void loop()
{
    Blinker.run();
}



------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
In file included from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:10:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h: In member function 'virtual char* BlinkerMQTT::lastRead()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h:683:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

In file included from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:82:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h: In member function 'char* BlinkerBridge_key::getName()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h:194:29: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

                 else return "false";

                             ^

In file included from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:83:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::deviceName()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:97:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             char * deviceName() { if (isInit) return conn->deviceName(); else return ""; }

                                                                                      ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::authKey()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:98:83: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             char * authKey()    { if (isInit) return conn->authKey(); else return "";  }

                                                                                   ^

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

F:\360MoveData\Users\Administrator\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 F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:

F:\360MoveData\Users\Administrator\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);

                                                                                                 ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeKey(uint8_t)':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6380:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         else return "";

                     ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeName(uint8_t)':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6387:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         else return "false";

                     ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino: At global scope:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:9:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerButton Button1("btn-abc");     //定义按钮键名

                                ^

Executable segment sizes:


IROM   : 495608          - code in flash         (default or ICACHE_FLASH_ATTR)


IRAM   : 28024   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...)


DATA   : 1388  )         - initialized variables (global, static) in RAM/HEAP


RODATA : 5468  ) / 81920 - constants             (global, static) in RAM/HEAP


BSS    : 30064 )         - zeroed variables      (global, static) in RAM/HEAP


项目使用了 530488 字节,占用了 (55%) 程序存储空间。最大为 958448 字节。
全局变量使用了36920字节,(45%)的动态内存,余留45000字节局部变量。最大为81920字节。
esptool.py v2.8
Serial port COM3
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: dc:4f:22:5a:85:f3
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 534640 bytes to 378854...

Writing at 0x00000000... (4 %)
Writing at 0x00004000... (8 %)
Writing at 0x00008000... (12 %)
Writing at 0x0000c000... (16 %)
Writing at 0x00010000... (20 %)
Writing at 0x00014000... (25 %)
Writing at 0x00018000... (29 %)
Writing at 0x0001c000... (33 %)
Writing at 0x00020000... (37 %)
Writing at 0x00024000... (41 %)
Writing at 0x00028000... (45 %)
Writing at 0x0002c000... (50 %)
Writing at 0x00030000... (54 %)
Writing at 0x00034000... (58 %)
Writing at 0x00038000... (62 %)
Writing at 0x0003c000... (66 %)
Writing at 0x00040000... (70 %)
Writing at 0x00044000... (75 %)
Writing at 0x00048000... (79 %)
Writing at 0x0004c000... (83 %)
Writing at 0x00050000... (87 %)
Writing at 0x00054000... (91 %)
Writing at 0x00058000... (95 %)
Writing at 0x0005c000... (100 %)
Wrote 534640 bytes (378854 compressed) at 0x00000000 in 34.0 seconds (effective 125.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
找到无效库在 D:\arduino\libraries\packages: no headers files (.h) found in D:\arduino\libraries\packages
找到无效库在 F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master: no headers files (.h) found in F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master
找到无效库在 D:\arduino\libraries\packages: no headers files (.h) found in D:\arduino\libraries\packages
找到无效库在 F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master: no headers files (.h) found in F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master


发表于 2020-3-1 13:56 | 显示全部楼层
本帖最后由 Creeper666 于 2020-3-1 14:03 编辑

你这里面还少了按钮的回调函数。在末尾加上:
[mw_shl_code=arduino,false]void button1_callback(const String & state) {
digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN);
}[/mw_shl_code]

那些红字不影响使用
 楼主| 发表于 2020-3-1 14:17 | 显示全部楼层
本帖最后由 415978202 于 2020-3-1 14:20 编辑

F:\360MoveData\Users\Administrator\Desktop
是我放的位置不对吗?
---------------------------------------------------------------------------------------------------------------Arduino:1.8.11 (Windows 7), 开发板:"Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:10:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h: In member function 'virtual char* BlinkerMQTT::lastRead()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h:683:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     else return "";

                 ^

In file included from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:82:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h: In member function 'char* BlinkerBridge_key::getName()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h:194:29: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

                 else return "false";

                             ^

In file included from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:83:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::deviceName()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:97:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             char * deviceName() { if (isInit) return conn->deviceName(); else return ""; }

                                                                                      ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::authKey()':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:98:83: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

             char * authKey()    { if (isInit) return conn->authKey(); else return "";  }

                                                                                   ^

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

F:\360MoveData\Users\Administrator\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 F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11:0,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,

                 from F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:4:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:

F:\360MoveData\Users\Administrator\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);

                                                                                                 ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeKey(uint8_t)':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6380:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         else return "";

                     ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeName(uint8_t)':

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6387:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

         else return "false";

                     ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

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

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

     else return "";

                 ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino: At global scope:

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino:9:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

BlinkerButton Button1("btn-abc");     //定义按钮键名

                                ^

F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master\blinker_app_xiaoai\blinker_app_xiaoai.ino: In function 'void button1_callback(const String&)':

blinker_app_xiaoai:101:6: error: redefinition of 'void button1_callback(const String&)'

void button1_callback(const String & state) {

      ^

blinker_app_xiaoai:72:6: error: 'void button1_callback(const String&)' previously defined here

void button1_callback(const String & state)     //点灯app内控制按键触发

      ^

blinker_app_xiaoai:102:51: error: expected ')' before ';' token

digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN);

                                                   ^

exit status 1
redefinition of 'void button1_callback(const String&)'

找到无效库在 D:\arduino\libraries\packages: no headers files (.h) found in D:\arduino\libraries\packages
找到无效库在 F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master: no headers files (.h) found in F:\360MoveData\Users\Administrator\Documents\Arduino\libraries\blinker_xiaoai-master

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


微信截图_20200301141247.png
 楼主| 发表于 2020-3-1 14:17 | 显示全部楼层
Creeper666 发表于 2020-3-1 13:56
你这里面还少了按钮的回调函数。在末尾加上:
[mw_shl_code=arduino,false]void button1_callback(const St ...

是不是我放的位置不对?
发表于 2020-3-1 14:37 来自手机 | 显示全部楼层
给你看这么多,累不累?
 楼主| 发表于 2020-3-1 15:04 | 显示全部楼层
老张383 发表于 2020-3-1 14:37
给你看这么多,累不累?

对不起,小白一个,不知道哪些有用哪些没用,只能都拿出来
发表于 2020-3-1 15:29 | 显示全部楼层
抱歉,删了我说的代码,我看漏了,以为是你没加上去。
应该这样改:
在 void button1_callback里的这三行:
digitalWrite(0,LOW);
    delay(200);
    digitalWrite(0, HIGH);

改为
if(state == BLINKER_CMD_TAP){
digitalWrite(0,LOW);
    delay(200);
    digitalWrite(0, HIGH);
}
 楼主| 发表于 2020-3-1 16:29 | 显示全部楼层
Creeper666 发表于 2020-3-1 15:29
抱歉,删了我说的代码,我看漏了,以为是你没加上去。
应该这样改:
在 void button1_callback里的这三行: ...

大哥,我是不是太笨了
微信截图_20200301162856.png
发表于 2020-3-1 20:47 来自手机 | 显示全部楼层
本帖最后由 Creeper666 于 2020-3-1 20:49 编辑
415978202 发表于 2020-3-1 16:29
大哥,我是不是太笨了

是我太笨了。。。
本应该是这样的,我打漏了一个BUTTON
BLINKER_CMD_BUTTON_TAP
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-28 05:28 , Processed in 0.078272 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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