久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 9604|回復: 25
打印 上一主題 下一主題
收起左側

【Arduino】108種傳感器模塊系列實驗(125)---WeMos D1開發板

[復制鏈接]
跳轉到指定樓層
樓主
本帖最后由 eagler8 于 2019-9-22 14:26 編輯

37款傳感器與模塊的提法,在網絡上廣泛流傳,其實Arduino能夠兼容的傳感器模塊肯定是不止37種的。鑒于本人手頭積累了一些傳感器和模塊,依照實踐出真知(一定要動手做)的理念,以學習和交流為目的,這里準備逐一動手試試做實驗,不管成功與否,都會記錄下來---小小的進步或是搞不定的問題,希望能夠拋磚引玉。

【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266




分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:513258 發表于 2019-9-25 14:12 | 只看該作者
ESP8266
低功耗、高集成度的 Wi-Fi 芯片
僅需 7 個外圍元器件
超寬工作溫度范圍:-40°C 至 +125°C
ESP8285 - ESP8266 內封 8 Mbit Flash







回復

使用道具 舉報

板凳
ID:513258 發表于 2019-9-25 14:46 | 只看該作者

回復

使用道具 舉報

地板
ID:513258 發表于 2019-9-25 15:05 | 只看該作者
打開Arduino,選擇了“文件/首選項”,http://arduino.esp8266.com/stable/package_esp8266com_index.json
這個json地址鍵入下圖所示開發板網址管理器的位置,點擊“好”




回復

使用道具 舉報

5#
ID:513258 發表于 2019-9-25 15:08 | 只看該作者
到開發板管理器安裝
在開發板管理器搜索8266就能找到要的支持文件了,開始下載......




回復

使用道具 舉報

6#
ID:513258 發表于 2019-9-25 16:25 | 只看該作者


后來找到鏈接(https://github.com/esp8266/Ardui ... 2/esp8266-2.5.2.zip),直接下載,下了一段還是不行........



回復

使用道具 舉報

7#
ID:513258 發表于 2019-9-25 17:07 | 只看該作者
還有一招是從國內百度網盤上下載
提取碼:p26y
用網盤下載好文件后把文件解壓到
C:\Users\你電腦的用戶名\AppData\Local\Arduino15\staging\packages
解壓好之后重復上面四步就會發現Arduino認為它已經把東西下載好了直接開始安裝,然后就......還是不行啊




回復

使用道具 舉報

8#
ID:513258 發表于 2019-9-25 17:12 | 只看該作者
只好回過頭,再去開發板管理器下載,經過二個小時,勉強下載了,沒想到的是校驗沒有通過,說是文件可能壞了.......



回復

使用道具 舉報

9#
ID:513258 發表于 2019-9-25 19:07 | 只看該作者


下載第5次,到第三個工具了
回復

使用道具 舉報

10#
ID:513258 發表于 2019-9-26 07:55 | 只看該作者
昨天一晚上沒關電腦,早上繼續下載,呵呵,到第11次終于行了,看來需要多試幾次



回復

使用道具 舉報

11#
ID:513258 發表于 2019-9-26 08:56 | 只看該作者
本帖最后由 eagler8 于 2019-9-26 09:20 編輯


回復

使用道具 舉報

12#
ID:513258 發表于 2019-9-26 08:58 | 只看該作者
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266
  4. 項目:點亮LED (在GPIO14)
  5. */

  6. void setup() {
  7.   pinMode(LED_BUILTIN, OUTPUT);     
  8. }

  9. void loop() {
  10.   digitalWrite(LED_BUILTIN, LOW);   
  11.   delay(200);                     
  12.   digitalWrite(LED_BUILTIN, HIGH);  
  13.   delay(200);                     
  14. }
復制代碼


回復

使用道具 舉報

13#
ID:513258 發表于 2019-9-26 09:04 | 只看該作者

回復

使用道具 舉報

14#
ID:513258 發表于 2019-9-26 09:19 | 只看該作者


盡管Arduino UNO和WeMos-D1R2類似,但它們的引腳分配還是有一些區別。上圖提供了引腳的映射。在某些情況下,為UNO編寫的程序將需要稍作修改,以調整為WeMos-D1R2的正確引腳分配。
回復

使用道具 舉報

15#
ID:513258 發表于 2019-9-26 09:33 | 只看該作者
ESP8266 WeMos-D1R2 接腳圖



回復

使用道具 舉報

16#
ID:513258 發表于 2019-9-26 10:07 | 只看該作者


參考電原理圖
回復

使用道具 舉報

17#
ID:513258 發表于 2019-9-26 10:58 | 只看該作者
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266
  4. 項目:測試串口
  5. */

  6. void setup() {
  7.   // put your setup code here, to run once:
  8.   Serial.begin(9600);
  9. }

  10. void loop() {
  11.   // put your main code here, to run repeatedly:
  12.   Serial.println("hello eagler8!");
  13.   delay(2000);
  14. }
復制代碼


回復

使用道具 舉報

18#
ID:513258 發表于 2019-9-26 11:00 | 只看該作者

回復

使用道具 舉報

19#
ID:513258 發表于 2019-9-26 11:41 | 只看該作者
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266
  4. 項目:無延遲閃爍LED
  5. */

  6. int ledState = LOW;

  7. unsigned long previousMillis = 0;
  8. const long interval = 1000;

  9. void setup() {
  10.   pinMode(LED_BUILTIN, OUTPUT);
  11. }

  12. void loop() {
  13.   unsigned long currentMillis = millis();
  14.   if (currentMillis - previousMillis >= interval) {
  15.     previousMillis = currentMillis;
  16.     if (ledState == LOW) {
  17.       ledState = HIGH;  // Note that this switches the LED *off*
  18.     } else {
  19.       ledState = LOW;  // Note that this switches the LED *on*
  20.     }
  21.     digitalWrite(LED_BUILTIN, ledState);
  22.   }
  23. }
復制代碼


回復

使用道具 舉報

20#
ID:513258 發表于 2019-9-26 11:53 | 只看該作者
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266
  4. 項目:ESP8266閃爍,由Daniel Salazar輪詢超時
  5. */

  6. #include <PolledTimeout.h>

  7. void ledOn() {
  8.   digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
  9. }

  10. void ledOff() {
  11.   digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  12. }

  13. void ledToggle() {
  14.   digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));  // Change the state of the LED
  15. }


  16. esp8266::polledTimeout::periodicFastUs halfPeriod(500000); //use fully qualified type and avoid importing all ::esp8266 namespace to the global namespace

  17. // the setup function runs only once at start
  18. void setup() {
  19.   Serial.begin(115200);

  20.   Serial.println();
  21.   Serial.printf("periodic/oneShotMs::timeMax()     = %u ms\n", (uint32_t)esp8266::polledTimeout::periodicMs::timeMax());
  22.   Serial.printf("periodic/oneShotFastMs::timeMax() = %u ms\n", (uint32_t)esp8266::polledTimeout::periodicFastMs::timeMax());
  23.   Serial.printf("periodic/oneShotFastUs::timeMax() = %u us\n", (uint32_t)esp8266::polledTimeout::periodicFastUs::timeMax());
  24.   Serial.printf("periodic/oneShotFastNs::timeMax() = %u ns\n", (uint32_t)esp8266::polledTimeout::periodicFastNs::timeMax());

  25. #if 0 // 1 or debugging polledTimeoutf
  26.   Serial.printf("periodic/oneShotMs::rangeCompensate     = %u\n", (uint32_t)esp8266::polledTimeout::periodicMs::rangeCompensate);
  27.   Serial.printf("periodic/oneShotFastMs::rangeCompensate = %u\n", (uint32_t)esp8266::polledTimeout::periodicFastMs::rangeCompensate);
  28.   Serial.printf("periodic/oneShotFastUs::rangeCompensate = %u\n", (uint32_t)esp8266::polledTimeout::periodicFastUs::rangeCompensate);
  29.   Serial.printf("periodic/oneShotFastNs::rangeCompensate = %u\n", (uint32_t)esp8266::polledTimeout::periodicFastNs::rangeCompensate);
  30. #endif

  31.   pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output

  32.   using esp8266::polledTimeout::oneShotMs; //import the type to the local namespace

  33.   //STEP1; turn the led ON
  34.   ledOn();

  35.   //STEP2: wait for ON timeout
  36.   oneShotMs timeoutOn(2000);
  37.   while (!timeoutOn) {
  38.     yield();
  39.   }

  40.   //STEP3: turn the led OFF
  41.   ledOff();

  42.   //STEP4: wait for OFF timeout to assure the led is kept off for this time before exiting setup
  43.   oneShotMs timeoutOff(2000);
  44.   while (!timeoutOff) {
  45.     yield();
  46.   }

  47.   //Done with STEPs, do other stuff
  48.   halfPeriod.reset(); //halfPeriod is global, so it gets inited on sketch start. Clear it here to make it ready for loop, where it's actually used.
  49. }


  50. // the loop function runs over and over again forever
  51. void loop() {
  52.   if (halfPeriod) {
  53.     ledToggle();
  54.   }
  55. }
復制代碼


回復

使用道具 舉報

21#
ID:513258 發表于 2019-9-26 12:05 | 只看該作者
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266
  4. 項目:測試ide的eeprom設置是否與硬件匹配
  5. */

  6. void setup(void) {
  7.   Serial.begin(115200);
  8. }

  9. void loop() {

  10.   uint32_t realSize = ESP.getFlashChipRealSize();
  11.   uint32_t ideSize = ESP.getFlashChipSize();
  12.   FlashMode_t ideMode = ESP.getFlashChipMode();

  13.   Serial.printf("Flash real id:   %08X\n", ESP.getFlashChipId());
  14.   Serial.printf("Flash real size: %u bytes\n\n", realSize);

  15.   Serial.printf("Flash ide  size: %u bytes\n", ideSize);
  16.   Serial.printf("Flash ide speed: %u Hz\n", ESP.getFlashChipSpeed());
  17.   Serial.printf("Flash ide mode:  %s\n", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT" : ideMode == FM_DIO ? "DIO" : ideMode == FM_DOUT ? "DOUT" : "UNKNOWN"));

  18.   if (ideSize != realSize) {
  19.     Serial.println("Flash Chip configuration wrong!\n");
  20.   } else {
  21.     Serial.println("Flash Chip configuration ok.\n");
  22.   }

  23.   delay(5000);
  24. }
復制代碼


回復

使用道具 舉報

22#
ID:513258 發表于 2019-9-26 12:07 | 只看該作者

回復

使用道具 舉報

23#
ID:513258 發表于 2019-9-26 12:33 | 只看該作者
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266
  4. 項目:將內置LED連接到Sigma Delta源,呼吸燈
  5. */

  6. #include "sigma_delta.h"

  7. void setup() {

  8.   Serial.begin(115200);
  9.   pinMode(LED_BUILTIN, OUTPUT); // blinkie & sigma-delta mix
  10.   uint32_t reqFreq = 1000;
  11.   uint32_t realFreq;

  12.   realFreq = sigmaDeltaSetup(0, reqFreq); // chose a low frequency

  13.   Serial.println();
  14.   Serial.println("Start Sigma Delta Example\n");
  15.   Serial.printf("Frequency = %u\n", realFreq);

  16. }

  17. void loop() {

  18.   uint8_t duty, iRepeat;

  19.   Serial.println("Attaching the built in led to the sigma delta source now\n");
  20.   Serial.printf("Current duty = %i, prescaler = %i\n", sigmaDeltaRead(), sigmaDeltaGetPrescaler());
  21.   sigmaDeltaAttachPin(LED_BUILTIN);

  22.   Serial.println("Dimming builtin led...\n");
  23.   for (iRepeat = 0; iRepeat < 10; iRepeat++) {
  24.     for (duty = 0; duty < 255; duty = duty + 5) {
  25.       sigmaDeltaWrite(0, duty);
  26.       delay(10);
  27.     }

  28.     for (duty = 255; duty > 0; duty = duty - 5) {
  29.       sigmaDeltaWrite(0, duty);
  30.       delay(10);
  31.     }

  32.   }

  33.   Serial.println("Detaching builtin led & playing a blinkie\n");
  34.   sigmaDeltaDetachPin(LED_BUILTIN);
  35.   for (iRepeat = 0; iRepeat < 20; iRepeat++) {
  36.     digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
  37.     delay(500);
  38.   }
  39. }
復制代碼


回復

使用道具 舉報

24#
ID:513258 發表于 2019-9-26 12:34 | 只看該作者

回復

使用道具 舉報

25#
ID:513258 發表于 2019-9-26 13:01 | 只看該作者
  1. /*
  2. 【Arduino】108種傳感器模塊系列實驗(資料+代碼+圖形+仿真)
  3. 實驗一百二十五: 升級版 WeMos D1 R2 WiFi UNO 開發板 基于ESP8266
  4. 項目:Station模式下的操作實例,查詢IP地址
  5. */

  6. #include <ESP8266WiFi.h>

  7. #define AP_SSID "eagler8" //這里改成你的wifi名字
  8. #define AP_PSW  "zy156721"//這里改成你的wifi密碼

  9. void setup(){
  10.   //設置串口波特率,以便打印信息
  11.   Serial.begin(9600);

  12.   //啟動STA模式,并連接到wifi網絡
  13.   WiFi.begin(AP_SSID, AP_PSW);

  14.   Serial.print(String("Connecting to ")+AP_SSID);
  15.   //判斷網絡狀態是否連接上,沒連接上就延時500ms,并且打出一個點,模擬連接過程
  16.   while (WiFi.status() != WL_CONNECTED){
  17.     delay(500);
  18.     Serial.print(".");
  19.   }
  20.   Serial.println("");

  21.   Serial.print("Connected, IP address: ");
  22.   //輸出station IP地址,這里的IP地址由DHCP分配
  23.   Serial.println(WiFi.localIP());
  24.   Serial.println("Setup End");
  25. }

  26. void loop() {
  27. }
復制代碼


回復

使用道具 舉報

26#
ID:513258 發表于 2019-9-26 13:06 | 只看該作者

回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 日韩亚洲视频 | 亚洲人成人一区二区在线观看 | 久久久久久久国产精品 | 日韩看片 | 国产成在线观看免费视频 | 久久精品美女 | 国产精品成人一区二区三区 | 综合色在线 | 在线国产一区二区三区 | 日本一区二区三区四区 | 91成人午夜性a一级毛片 | 宅男噜噜噜66一区二区 | 午夜影晥 | 亚洲精品在线观看网站 | 欧美一区二区三区在线观看视频 | 在线视频99 | 中文字幕日韩一区 | 九九看片| 青青草这里只有精品 | 成人片免费看 | 欧美区在线 | 欧美亚洲视频在线观看 | 日本久久综合网 | 成人在线精品 | 91久久精品一区二区二区 | 不卡视频一区二区三区 | 亚洲欧美中文日韩在线v日本 | www..99re | 国产精品视频一 | 久久se精品一区精品二区 | jav成人av免费播放 | 欧美精品成人一区二区三区四区 | 亚洲成人蜜桃 | 欧美视频二区 | 欧美精品一区在线 | 少妇久久久久 | 国内精品久久精品 | 97色在线观看免费视频 | 国产一区二区视频在线观看 | 久草中文网 | 一区二区三区免费 |