【发布时间】:2021-08-15 09:23:24
【问题描述】:
所以我需要将 int 值转换为 char* 值。到目前为止,这是我的代码:
void setup(void) {
Serial.begin(115200);
char* host = "esp32";
SerialBT.begin("test");
while (!SerialBT.available()) {
}
char* ssid = SerialBT.read();
while (!SerialBT.available()) {
}
char* password = SerialBT.read();
}
我还没有真正找到解决方案,但这是我得到的错误:
invalid conversion from 'int' to 'char*'
有没有快速的解决方案?谢谢。
【问题讨论】:
-
花点时间了解数组,或阅读this 和示例2。
-
你试图做的是从你的蓝牙端口读取一个字符的内存地址(指针),这当然没有意义。
-
换句话说,您不想将 int 转换为 char *。检查@hcheung 提供的链接。