0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫(xiě)文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

如何設(shè)置帶有Arduino IDE的NodeMCU 1.0

454398 ? 來(lái)源:網(wǎng)絡(luò)整理 ? 作者:網(wǎng)絡(luò)整理 ? 2019-12-09 15:12 ? 次閱讀

步驟1:您需要什么

要遵循本教程,您需要以下組件:

Micro USB電纜

NodeMCU 1.0(ESP-12E模塊)

LEDstrip

此外,您將需要:

Adafruit IO帳戶

Google日歷

Zapier帳戶

Arduino IDE 1.8.2

步驟2:Google日歷

如何設(shè)置帶有Arduino IDE的NodeMCU 1.0

因?yàn)槟嵝涯?,您?yīng)該在Google Calender中進(jìn)行活動(dòng)。

轉(zhuǎn)到以下網(wǎng)站并進(jìn)行活動(dòng):

https://www.google.com/calendar

步驟3:連接帶有Zapier的Google日歷

創(chuàng)建一個(gè)Zapier帳戶(如果尚未執(zhí)行此操作)。單擊“制作一個(gè)zap”(右上角的橙色按鈕),然后將您的Google Calender與Zapier連接。為此,您需要在搜索字段中輸入Google Calender并單擊它。這樣,您可以將壓延機(jī)與Zapier連接。

步驟4:觸發(fā)器

選擇事件開(kāi)始作為觸發(fā)器并選擇您的Google帳戶。接下來(lái),在“編輯選項(xiàng)”部分中,您應(yīng)該寫(xiě)出要觸發(fā)事件的距離。您將根據(jù)自己的回答在LED燈條上收到通知。最后,您需要編寫(xiě)與您在Google日歷中命名活動(dòng)的方式完全匹配的搜索詞。立即保存您的Zap。

第5步:將Zapier與Adafruit IO連接

觸發(fā)觸發(fā)器之后,執(zhí)行此操作。要將Adafruit IO與Zapier連接,您需要轉(zhuǎn)到以下鏈接:https://zapier.com/developer/invite/25310/e5b57f6e084ed73db02db095986ead31/不要?jiǎng)?chuàng)建新的Zap,請(qǐng)進(jìn)一步處理已經(jīng)制作的Zap ?,F(xiàn)在選擇Adafruit作為動(dòng)作。

步驟6:Adafruit數(shù)據(jù)和值

添加您的Adafruit帳戶并粘貼您的AIO密鑰。設(shè)置為值“ 1”。我們需要它來(lái)觸發(fā)事件。稍后,您還將在代碼中看到該值。轉(zhuǎn)到Adafruit并進(jìn)行一個(gè)名為“測(cè)試”的提要。在Zapier中輸入此內(nèi)容。您可以測(cè)試Zap是否有效。您應(yīng)該在Adafruit Feed中看到該值。

步驟7:添加代碼以連接到Adafruit

使用MicroUSB電纜將NodeMCU連接到PC。您還應(yīng)該將LED燈帶也連接到NodeMCU的D5,G和3V中。確保以這種方式連接LED燈條?,F(xiàn)在將以下代碼添加到Arduino草圖中。

// Adafruit IO Digital Output Example

// Tutorial Link: https://learn.adafruit.com/adafruit-io-basics-digital-output

//

// Adafruit invests time and resources providing this open source code.

// Please support Adafruit and open source hardware by purchasing

// products from Adafruit!

//

// Written by Todd Treece for Adafruit Industries

// Copyright (c) 2016 Adafruit Industries

// Licensed under the MIT license.

//

// All text above must be included in any redistribution.

/************************** Configuration ***********************************

/ edit the config.h tab and enter your Adafruit IO credentials

// and any additional configuration needed for WiFi, cellular,

// or ethernet clients.

#include “config.h”

#include “Adafruit_NeoPixel.h”

/************************ Example Starts Here *******************************

/ digital pin 5

#define PIXEL_PIN D5

#define PIXEL_COUNT 24

#define PIXEL_TYPE NEO_GRB + NEO_KHZ800

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

// set up the ‘digital’ feed

AdafruitIO_Feed *Test = io.feed(“Test”);

void setup() {

// start the serial connection

Serial.begin(115200);

// wait for serial monitor to open

while(! Serial);

// connect to io.adafruit.com

Serial.print(“Connecting to Adafruit IO”);

io.connect();

// set up a message handler for the ‘digital’ feed.

// the handleMessage function (defined below)

// will be called whenever a message is

// received from adafruit io.

Test-》onMessage(handleMessage);

// wait for a connection

while(io.status() 《 AIO_CONNECTED) {

Serial.print(“?!保?

delay(500);

}

// we are connected

Serial.println();

Serial.println(io.statusText());

pinMode(D5, OUTPUT);

}

void loop() {

// io.run(); is required for all sketches.

// it should always be present at the top of your loop

// function. it keeps the client connected to

// io.adafruit.com, and processes any incoming data.

io.run();

}

步驟8:Arduino中的新標(biāo)簽頁(yè)

新建一個(gè)標(biāo)簽頁(yè)并將其命名“config.h中”。您實(shí)際上需要包含config.h(請(qǐng)參見(jiàn)前面的代碼)。在以下代碼中,您需要編寫(xiě)您自己的Adafruit用戶名和您自己的密鑰。如果您還不知道密鑰,請(qǐng)轉(zhuǎn)到Adafruit IO,然后單擊“查看AIO密鑰”。將其粘貼到Arduino中。確保已安裝Arduino Neopixel庫(kù),否則代碼將無(wú)法正常工作。

/************************ Adafruit IO Config *******************************/

// visit io.adafruit.com if you need to create an account,

// or if you need your Adafruit IO key.

#define IO_USERNAME “Your AIO username”

#define IO_KEY “Your AIO key”

/******************************* WIFI **************************************

/ the AdafruitIO_WiFi client will work with the following boards:

// - HUZZAH ESP8266 Breakout -》 https://www.adafruit.com/products/2471

// - Feather HUZZAH ESP8266 -》 https://www.adafruit.com/products/2821

// - Feather M0 WiFi -》 https://www.adafruit.com/products/3010

// - Feather WICED -》 https://www.adafruit.com/products/3056

#define WIFI_SSID “Your wifi or hotspot name”

#define WIFI_PASS “Your wifi or hotspot password”

// comment out the following two lines if you are using fona or ethernet

#include “AdafruitIO_WiFi.h”

AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);

/******************************* FONA **************************************

/ the AdafruitIO_FONA client will work with the following boards:

// - Feather 32u4 FONA -》 https://www.adafruit.com/product/3027

// uncomment the following two lines for 32u4 FONA,

// and comment out the AdafruitIO_WiFi client in the WIFI section

// #include “AdafruitIO_FONA.h”

// AdafruitIO_FONA io(IO_USERNAME, IO_KEY);

/**************************** ETHERNET ************************************

/ the AdafruitIO_Ethernet client will work with the following boards:

// - Ethernet FeatherWing -》 https://www.adafruit.com/products/3201

// uncomment the following two lines for ethernet,

// and comment out the AdafruitIO_WiFi client in the WIFI section

// #include “AdafruitIO_Ethernet.h”

// AdafruitIO_Ethernet io(IO_USERNAME, IO_KEY);

步驟9:測(cè)試是否已連接到Adafruit

如果復(fù)制正確,則在串行監(jiān)視器中上傳后應(yīng)該會(huì)看到以下內(nèi)容:

Connecting to Adafruit IO.。..

Adafruit IO connected.

步驟10:更新代碼以接收數(shù)據(jù)

在初始選項(xiàng)卡中添加以下代碼,以在LED燈條上接收顏色。如果您的活動(dòng)即將開(kāi)始,您將獲得這些顏色。

if (data-》toPinLevel() == 1) {

for(int i=0; i

pixels.setPixelColor(i, 0, 255, 0);

pixels.show();

}

Serial.println(“Event is about to start!”);

}

digitalWrite(PIXEL_PIN, data-》toPinLevel());

}

}

步驟11:最終通知

如果執(zhí)行了以下步驟正確并且您的事件即將開(kāi)始,您將在串行監(jiān)視器上收到通知。您將看到以下內(nèi)容:

Connecting to Adafruit IO.。.

Adafruit IO connected.

received 《- Event is about to start!

責(zé)任編輯:wv

聲明:本文內(nèi)容及配圖由入駐作者撰寫(xiě)或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • Arduino
    +關(guān)注

    關(guān)注

    187

    文章

    6453

    瀏覽量

    185931
  • NODEMCU
    +關(guān)注

    關(guān)注

    13

    文章

    289

    瀏覽量

    21187
收藏 人收藏

    評(píng)論

    相關(guān)推薦

    Arduino Nano 和 NodeMCU ESP8266 讀取 DHT11 環(huán)境溫濕度數(shù)據(jù)及 OLED顯示

    Arduino Nano 和 NodeMCU ESP8266 讀取 DHT11 環(huán)境溫濕度數(shù)據(jù)及 OLED顯示
    的頭像 發(fā)表于 08-13 18:04 ?617次閱讀
    <b class='flag-5'>Arduino</b> Nano 和 <b class='flag-5'>NodeMCU</b> ESP8266 讀取 DHT11 環(huán)境溫濕度數(shù)據(jù)及 OLED顯示

    請(qǐng)問(wèn)如何在NodeMcu設(shè)置NON-OS SDK?

    如何在 NodeMcu設(shè)置 NON-OS SDK?
    發(fā)表于 07-19 14:51

    為什么無(wú)法在nodemcuarduino mega之間交換數(shù)據(jù)?

    您好,我正在嘗試通過(guò) UART 在 arduino mega 和 nodemcu 之間交換數(shù)據(jù)(使用 arduino IDE 對(duì)兩者進(jìn)行編程)。 我將
    發(fā)表于 07-19 12:15

    如何讓兩個(gè)ESP8266可以連續(xù)地相互通信?

    大家好,我是ESP8266的新手,不懂其他語(yǔ)言,所以我在 Arduino IDE 中使用 Nodemcu1.0 進(jìn)行工作。從那時(shí)起,我首先將ESP8266設(shè)為 AP,它起作用了,然后我將其設(shè)置
    發(fā)表于 07-12 10:12

    能將ESP8266連接到arduino UNO上,使用mesh組網(wǎng)嗎?

    現(xiàn)在已將ESP8266連接到了arduino,并且成功驅(qū)動(dòng),但是有個(gè)問(wèn)題就是組網(wǎng)的問(wèn)題,想使用mesh,但是還有有些疑問(wèn)。1、將帶有mesh的固件燒錄到ESP8266中,就能自動(dòng)尋找節(jié)點(diǎn)了嗎?或者是下載mesh的庫(kù)函數(shù),從arduino
    發(fā)表于 07-11 06:46

    ESP-12E NodeMCU使用SPIFFS來(lái)存儲(chǔ)數(shù)據(jù)出現(xiàn)看門(mén)狗超時(shí)的情況怎么解決?

    ,它報(bào)告了大小不匹配。IDE 大小為 4M,實(shí)際大小為 1M。我使用的是 NodeMCU 1.0(ESP-12E 模塊)的 Adruino IDE 開(kāi)發(fā)板定義,閃存
    發(fā)表于 07-11 06:42

    請(qǐng)問(wèn)如何進(jìn)行ESP32任意管腳設(shè)置成I2C在ARDUINO IDE?

    請(qǐng)問(wèn)如何進(jìn)行 ESP32 任意管腳設(shè)置成 I2C 在 ARDUINO IDE? 謝謝
    發(fā)表于 06-17 07:51

    請(qǐng)問(wèn)ESP32-S3-DEVKITC-1是否支持Arduino IDE 1.8.8編譯及燒錄?

    請(qǐng)問(wèn)ESP32-S3-DEVKITC-1是否支持Arduino IDE 1.8.8編譯及燒錄?使用Arduino IDE 1.8.8成功編譯串口監(jiān)視器例程并顯示上傳成功后,串口監(jiān)視器不
    發(fā)表于 06-05 07:57

    如何設(shè)置Arduino霍爾效應(yīng)傳感器

    在本指南中,您將學(xué)習(xí)如何設(shè)置Arduino霍爾效應(yīng)傳感器,特別是US1881,以檢測(cè)磁場(chǎng)。這對(duì)于需要查找電機(jī)的轉(zhuǎn)速或機(jī)器中其他運(yùn)動(dòng)的項(xiàng)目非常有用。
    的頭像 發(fā)表于 02-11 10:14 ?1161次閱讀
    如何<b class='flag-5'>設(shè)置</b><b class='flag-5'>Arduino</b>霍爾效應(yīng)傳感器

    如何設(shè)置Arduino IR發(fā)射器電路

    在本指南中,您將學(xué)習(xí)如何設(shè)置 Arduino IR發(fā)射器電路。它使您可以控制IR(紅外線)LED,并從Arduino發(fā)送任何遠(yuǎn)程控制代碼。這意味著你可以用它來(lái)控制你的電視或其他任何你喜歡的東西!
    的頭像 發(fā)表于 02-11 09:44 ?701次閱讀
    如何<b class='flag-5'>設(shè)置</b><b class='flag-5'>Arduino</b> IR發(fā)射器電路

    使用Arduino IDE 2.0開(kāi)發(fā)ESP32攝像頭模塊

    本帖最后由 jf_12640084 于 2024-2-7 17:36 編輯 Arduino IDE是創(chuàng)客常用的開(kāi)發(fā)平臺(tái)。通過(guò)安裝擴(kuò)展包,Arduino IDE可以支持不同架構(gòu)的開(kāi)
    發(fā)表于 02-07 17:06

    Arduino IDE打開(kāi)開(kāi)發(fā)板管理器搜索Arduino SAM的開(kāi)發(fā)板不能找到怎么解決?

    Arduino IDE打開(kāi)開(kāi)發(fā)板管理器搜索Arduino SAM的開(kāi)發(fā)板不能找到怎么解決 可能被墻 也沒(méi)有其他源可以替換 或者手動(dòng)安裝這個(gè)開(kāi)發(fā)板庫(kù)的方法
    發(fā)表于 11-10 08:29

    conv2d是Arduino IDE里面的什么庫(kù)?

    conv2d是Arduino IDE里面的什么庫(kù)
    發(fā)表于 11-10 06:04

    請(qǐng)問(wèn)Arduino或者nodeMCU可以點(diǎn)亮手機(jī)屏幕嗎?

    Arduino或者nodeMCU可以點(diǎn)亮手機(jī)屏幕嗎?
    發(fā)表于 10-31 08:08

    使用Arduino IDE搭建AT32 MCU開(kāi)發(fā)環(huán)境

    使用Arduino IDE搭建AT32 MCU開(kāi)發(fā)環(huán)境旨在幫助使用Arduino IDE開(kāi)發(fā)AT32的用戶,快速建立開(kāi)發(fā)環(huán)境并進(jìn)行開(kāi)發(fā)。
    發(fā)表于 10-26 07:48