eesp32休眠电充供电休眠求助arduino-Arduino中文社区 - Powered by Discuz! Archiver

guqiang 发表于 2022-3-27 19:43

eesp32休眠电充供电休眠求助arduino

各位老师想做一个esp32点灯科技的物联网实验。打算电池供电,计划用电池供电,程序中睡眠30分钟在线2分钟传递数据。arduino编程发现能进入睡眠但不能上传数据,大家帮我看看哪里不对。

#define BLINKER_WIFI
#include <Blinker.h>
#include <Arduino.h>
#include <esp_sleep.h>
//RTC_DATA_ATTR int bootCount = 0;
volatile int light1;
volatile int light2;
volatile int light3;
volatile int light4;
char auth[] = "09a0cd4b4016";
char ssid[] = "Atour";
char pswd[] = "4000606606";
BlinkerNumber Number1("num-abc");
BlinkerNumber Number2("num-abd");
BlinkerNumber Number3("num-abe");
BlinkerNumber Number4("num-abf");
void dataStorage(){
   Blinker.dataStorage("num-abc", light1);
Blinker.dataStorage("num-abd", light2);
Blinker.dataStorage("num-abe", light3);
Blinker.dataStorage("num-abf", light4);

}

void setup(){
esp_sleep_enable_timer_wakeup(50000000);
Blinker.begin(auth,ssid,pswd);
Serial.begin(115200);

//Serial.printf("ESP32 is restart now! It's the %d time\r\n", ++bootCount);

// Serial.println(esp_sleep_get_wakeup_cause());
light1 = 0;
light2 = 0;
light3 = 0;
light4 = 0;
Blinker.attachDataStorage(dataStorage);

}

void loop(){
light1 = analogRead(33);
light2 = analogRead(32);
light3 = analogRead(34);
light4 = analogRead(35);
delay(100);
Number1.print(light1);
Number2.print(light2);
Number3.print(light3);
Number4.print(light4);
Serial.print("ligh1:");
Serial.println(light1);
Serial.print("ligh2:");
Serial.println(light2);
Serial.print("ligh3:");
Serial.println(light3);
Serial.print("ligh4:");
Serial.println(light4);

Blinker.run();
//delay(10000);
// Serial.println("ESP32 will sleep now!");
    delay(10000);
esp_deep_sleep_start();

}

奈何col 发表于 2022-3-28 09:02

blinker暂时不支持休眠,以后会提供低功耗解决方案

guqiang 发表于 2022-3-28 10:29

奈何col 发表于 2022-3-28 09:02
blinker暂时不支持休眠,以后会提供低功耗解决方案

好的谢谢

imhm 发表于 2022-3-28 20:32

醒来后先重启 。。;P
页: [1]
查看完整版本: eesp32休眠电充供电休眠求助arduino