0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(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)該寫出要觸發(fā)事件的距離。您將根據(jù)自己的回答在LED燈條上收到通知。最后,您需要編寫與您在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 。現(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燈條。現(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)前面的代碼)。在以下代碼中,您需要編寫您自己的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)容及配圖由入駐作者撰寫或者入駐合作網(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)注

    189

    文章

    6492

    瀏覽量

    190133
  • NODEMCU
    +關(guān)注

    關(guān)注

    13

    文章

    289

    瀏覽量

    22224
收藏 人收藏

    評(píng)論

    相關(guān)推薦
    熱點(diǎn)推薦

    用于 SPI 絕對(duì)編碼器的 Arduino 示例代碼

    : [Arduino 板] [AMT22 編碼器] [AMT-06C-1-036 電纜] ,或帶有相應(yīng)連接器的類似電纜 [Arduino IDE] [下載 AMT22 單圈樣例代碼]
    的頭像 發(fā)表于 01-26 21:35 ?736次閱讀
    用于 SPI 絕對(duì)編碼器的 <b class='flag-5'>Arduino</b> 示例代碼

    基于Arduino的串口通信項(xiàng)目

    Arduino開(kāi)發(fā)板的TX和RX引腳連接起來(lái)。 二、軟件準(zhǔn)備 Arduino IDE :從Arduino官方網(wǎng)站下載并安裝Arduino
    的頭像 發(fā)表于 11-22 09:24 ?1958次閱讀

    Turbo模式1.0設(shè)置步驟

    電子發(fā)燒友網(wǎng)站提供《Turbo模式1.0設(shè)置步驟.pdf》資料免費(fèi)下載
    發(fā)表于 10-15 10:11 ?0次下載
    Turbo模式<b class='flag-5'>1.0</b><b class='flag-5'>設(shè)置</b>步驟

    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 ?1921次閱讀
    <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

    將ESP12與Arduino IDE一起使用,WIFI在哪里被激活?

    我正在將 ESP12 與 Arduino IDE 一起使用。 當(dāng) init() 被調(diào)用時(shí),WIFI 已經(jīng)處于活動(dòng)狀態(tài)。 WIFI是否在RTOS級(jí)別激活?還是在Arduino代碼級(jí)別? 誰(shuí)能告訴我WIFI在哪里被激活?
    發(fā)表于 07-12 06:31

    能將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)看門狗超時(shí)的情況怎么解決?

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

    如何確保GPIO即使在重置ESP8266期間仍保持在給定狀態(tài)的信息?

    你好 我希望這是發(fā)布此查詢的正確位置。 我正在尋找有關(guān)如何確保GPIO即使在重置ESP8266期間仍保持在給定狀態(tài)的信息 硬件:nodeMCU V1.0 上的 ESP-12E。通過(guò)Arduino
    發(fā)表于 07-10 07:02

    如何使用Arduino IDE構(gòu)建的ELF映像?

    我有一個(gè)要求,我需要使用使用 Arduino IDE 構(gòu)建的ELF映像,但 NonOS SDK 中提供了boot_v1.6.bin。我執(zhí)行了以下步驟 背景: 1. Arduino 構(gòu)建 2 個(gè)
    發(fā)表于 07-09 07:13

    esp32在Arduino IDE中可以實(shí)現(xiàn)調(diào)用百度智能云接口嗎?

    esp32在Arduino IDE中可以實(shí)現(xiàn)調(diào)用百度智能云接口嗎?涉及到http協(xié)議,想知道能不能不用esp-idf
    發(fā)表于 06-28 06:52

    請(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

    idf-arduino component組件怎么設(shè)置 ?

    idf -arduino component組件該怎么設(shè)置 ,。 CMake Warning at E:/COMPILE/Othert/IDF4.4/esp-idf-v4.4/tools
    發(fā)表于 06-12 07:27

    電子發(fā)燒友

    中國(guó)電子工程師最喜歡的網(wǎng)站

    • 2931785位工程師會(huì)員交流學(xué)習(xí)
    • 獲取您個(gè)性化的科技前沿技術(shù)信息
    • 參加活動(dòng)獲取豐厚的禮品