gpt4 book ai didi

c - Spark 核心 wifi 凭据更改

转载 作者:太空宇宙 更新时间:2023-11-04 03:42:06 24 4
gpt4 key购买 nike

我正在使用我的 spark 核心研究一个小产品创意,并为客户设置一个串行接口(interface),以便将他们的产品设置到他们的 wifi 上:

String newssid = wifissid(3);
String newpw = wifipw(3);
WiFi.setCredentials(newssid, newpw);

如您所见,我创建了 2 个函数,它们通过与 pc 的串行连接返回 ssid 和密码。当我在代码中设置凭据时,我已经设法让 setCredentials 工作:

WiFi.setCredentials("D-link7853", "thisismypassword");

但是当我用字符串运行它时,如上所述,它不想编译。给出的错误是:

serial_wifi_cred_change_3.cpp:49:39: error: no matching function for call to 'WiFiClass::setCredentials(String&, String&)' }
serial_wifi_cred_change_3.cpp:49:39: note: candidates are: In file included from ../inc/spark_wiring.h:37:0, from ../inc/application.h:29, from serial_wifi_cred_change_3.cpp:2: ../inc/spark_wiring_wifi.h:61:21: note: static void WiFiClass::setCredentials(const char*) static void setCredentials(const char ssid); ^ ../inc/spark_wiring_wifi.h:61:21: note: candidate expects 1 argument, 2 provided ../inc/spark_wiring_wifi.h:62:21: note: static void WiFiClass::setCredentials(const char, const char*) static void setCredentials(const char *ssid, const char password); ^ ../inc/spark_wiring_wifi.h:62:21: note: no known conversion for argument 1 from 'String' to 'const char' ../inc/spark_wiring_wifi.h:63:21: note: static void WiFiClass::setCredentials(const char*, const char*, long unsigned int) static void setCredentials(const char *ssid, const char *password, unsigned long security); ^

最佳答案

错误表明它不需要字符串,而是指向 const char 数组的指针。该网站上的文档似乎具有误导性。

关于c - Spark 核心 wifi 凭据更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27646849/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com