gpt4 book ai didi

linux - 在 Ubuntu 上的 Arduino IDE 上编译 NodeMCU 时出错

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:02:47 24 4
gpt4 key购买 nike

我一直在尝试使用 NodeMCU 将一段代码与 Blynk 应用程序链接,我正在 Ubuntu 上的 Arduino IDE 上编译代码。以下是我的代码:

#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "myAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "myWifi";
char pass[] = "myPassword";
BlynkTimer timer;
void setup()
{
// Debug console
Serial.begin(9600);
timer.setInterval(1000L, function);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void loop()
{
Blynk.run();
timer.run();
}
void function()
{
int ldrValue=analogRead(A0);
Blynk.virtualWrite(V1, ldrValue);
}

每当我尝试编译它时,它都会向我显示错误。以下是错误信息:

Arduino: 1.8.5 (Linux), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

fork/exec /home/enlightened/snap/arduino-mhall119/5/.arduino15/packages/esp8266/tools/python/3.7.2-post1/python: no such file or directory
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

最佳答案

您需要安装 Python,或修复(重新链接)Arduino IDE 中指向 Python 二进制文件的文件。

打开一个终端(ctrl+alt+T),在提示符下输入python,按< kbd>输入:

~$ python

如果终端建议安装 Python,这样做可能会解决问题:

~$ sudo apt-get install python

否则,如果你看到这个:

~$ python
Python 2.7.16 (default, Apr 6 2019, 01:42:57)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

这意味着 Python 已安装,但您需要修复此文件中的符号链接(symbolic link):

/home/enlightened/snap/arduino-mhall119/5/.arduino15/packages/esp8266/tools/python/3.7.2-post1/python

指向已安装的 Python 二进制文件,如下所示:

~$ ln -s /usr/bin/python /home/enlightened/snap/arduino-mhall119/5/.arduino15/packages/esp8266/tools/python/3.7.2-post1/python

关于linux - 在 Ubuntu 上的 Arduino IDE 上编译 NodeMCU 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56797497/

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