zoukankan      html  css  js  c++  java
  • Arduino与NodeMCU——联网

    我们现在要使用Arduino IDE来配置您的ESP8266芯片。这是使用该芯片的好方法,因为您可以使用着名的Arduino IDE对其进行编程,并重复使用几个现有的Arduino库。
    如果尚未完成,请安装最新版本的Arduino IDE。您可以从http://www.arduino.cc/en/main/software获取它。
    现在,您需要执行以下步骤才能使用Arduino IDE配置ESP8266:
    1.启动Arduino IDE并打开“首选项”窗口。
    2.在其他Board Manager URL中输入以下URL:http://arduino.esp8266.com/stable/package_esp8266com_index.json
    3.从Tools |中打开Boards Manager Board菜单并安装esp8266平台,如下所示:

    将模块连接到Wi-Fi网络
    现在,我们将检查ESP8266和Arduino IDE是否正常工作,并将芯片连接到本地Wi-Fi网络。
    为此,让我们执行以下步骤:
    1.首先,我们需要编写代码然后将其上传到电路板。 代码很简单; 我们只想连接到本地Wi-Fi网络并打印电路板的IP地址。这是连接到网络的代码:

    #include <ESP8266WiFi.h>
    void setup() {
    // put your setup code here, to run once:
    const char* ssid = "203";
    const char* password = "203forever";
    // Start Serial
    Serial.begin(115200);
    // Connect to WiFi
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    }
    Serial.println("");
    Serial.println("WiFi connected");
    // Print the IP address
    Serial.println(WiFi.localIP(http://www.my516.com));
    }
    void loop() {
    // put your main code here, to run repeatedly:

    }

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    1

    ---------------------

  • 相关阅读:
    实验-继承&super.doc
    Python库
    Github高级搜索
    代码报错记录
    编程问题解决
    百科
    【Android】添加依赖包
    【Android】导航栏(加图片icon)和不同页面的实现(viewpager+tablayout)
    【Android】Android Studio真机调试的问题统整
    【AD】自己画板的备忘
  • 原文地址:https://www.cnblogs.com/ly570/p/11102762.html
Copyright © 2011-2022 走看看