遇到EEPRON错误,小白不会解决-Arduino中文社区 - Powered by Discuz! Archiver

anyi 发表于 2020-4-13 15:32

遇到EEPRON错误,小白不会解决


这是读取SHT31温湿度和LTC4150电量计然后上报的程序
在没有加电量计之前程序是没问题的,加了之后就出现EEPRON报错了,求大神指点


这是报错↓↓↓

15:32:12.743 -> ===========================================================
15:32:12.743 -> ================== Blinker Timer loaded! ==================
15:32:12.743 -> Warning!EEPROM address 1536-2431 is used for Blinker Timer!
15:32:12.743 -> ============= DON'T USE THESE EEPROM ADDRESS! =============
15:32:12.743 -> ===========================================================
15:32:12.743 ->
15:32:12.743 -> countdown state: false
15:32:12.743 -> _cdRunState: 0
15:32:12.776 -> _totalTime: 0
15:32:12.776 -> _runTime: 0
15:32:12.776 -> _action:
15:32:12.776 -> loop state: false
15:32:12.776 -> _lpRunState: 0
15:32:12.776 -> _times: 0
15:32:12.776 -> _tri_times: 0
15:32:12.776 -> _time1: 0
15:32:12.776 -> _action1:
15:32:12.776 -> _time2: 0
15:32:12.776 -> _action2:
15:32:12.776 -> _lpData: 0



这是程序↓↓↓

#define BLINKER_WIFI
#include <Blinker.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"

#define INT 5
#define POL 6
#define CLR 7
#define SHDN 8 // Unneeded in this sketch, set to input

double battery_mAh = 1000.0; // milliamp-hours (mAh)
double battery_percent = 100.0;// state-of-charge (percent)
// Global variables:
double ah_quanta = 0.17067759; // mAh for each INT
double percent_quanta; // calculate below

float humi_read = 0, temp_read = 0;

char auth[] = "92604c475778";
char ssid[] = "Xiaomi_B680";
char pswd[] = "407DEwifi";

BlinkerNumber HUMI("hum");
BlinkerNumber TEMP("tem");
BlinkerNumber BATTERY("bat");

Adafruit_SHT31 sht31 = Adafruit_SHT31();

void heartbeat()
{
    HUMI.print(humi_read);
    TEMP.print(temp_read);
    BATTERY.print(int(battery_percent));
}

void dataStorage()//历史数据返回函数
{
    Blinker.dataStorage("temp", temp_read);
    Blinker.dataStorage("humi", humi_read);
    Blinker.dataStorage("battery", int(battery_percent));
}

void setup()
{
    Serial.begin(115200);
    BLINKER_DEBUG.stream(Serial);
    BLINKER_DEBUG.debugAll();
    FuelGauge.begin();
    Blinker.begin(auth, ssid, pswd);
    Blinker.attachHeartbeat(heartbeat);
    Blinker.attachDataStorage(dataStorage,600);//关联回调函数,开启历史数据存储功能

    pinMode(INT,INPUT);
    pinMode(POL,INPUT);
    pinMode(CLR,OUTPUT);
    digitalWrite(CLR,HIGH);
    pinMode(SHDN,INPUT); // Unneeded, disabled by setting to input

   percent_quanta = 1.0/(battery_mAh/1000.0*5859.0/100.0);

    if (! sht31.begin(0x44)) {   // Set to 0x45 for alternate i2c addr
    Serial.println("Couldn't find SHT31");
    while (1) delay(1);
}
}

void loop()
{
    Blinker.run();

    float t = sht31.readTemperature();
    float h = sht31.readHumidity();
    float b = FuelGauge.percent();

    if (isnan(h) || isnan(t))
    {
      BLINKER_LOG("Failed to read from DHT sensor!");
    }
    else
    {
      BLINKER_LOG("Humidity: ", h, " %");
      BLINKER_LOG("Temperature: ", t, " *C");
      humi_read = h;
      temp_read = t;
    }

static long int time, lasttime;
double mA;
boolean polarity;

if (digitalRead(INT)==0) // INT has gone low
{
    // Determine delay since last interrupt (for mA calculation)
    // Note that first interrupt will be incorrect (no previous time!)

    lasttime = time;
    time = micros();

    // Get the polarity value

    polarity = digitalRead(POL);
    if (polarity) // high = charging
    {
      battery_mAh += ah_quanta;
      battery_percent += percent_quanta;
    }
    else // low = discharging
    {
      battery_mAh -= ah_quanta;
      battery_percent -= percent_quanta;
    }

    // Calculate mA from time delay (optional)
    mA = 614.4/((time-lasttime)/1000000.0);

    // If charging, we'll set mA negative (optional)
    if (polarity) mA = mA * -1.0;

    // Clear the interrupt signal
    digitalWrite(CLR,LOW);
    delayMicroseconds(40); // CLR needs to be low > 20us
    digitalWrite(CLR,HIGH);

    // Blink the LED (optional)
//    digitalWrite(LED,HIGH);
//    delay(100);
//    digitalWrite(LED,LOW);

    // Print out the current battery status
//    Serial.print("mAh: ");
//    Serial.print(battery_mAh);
//    Serial.print(" soc: ");
//    Serial.print(battery_percent);
//    Serial.print("% time: ");;

    boolean val = digitalRead(POL);
    if (val == HIGH)
    {
          BATTERY.icon("fas fa-battery-bolt");
    }
    else(val == LOW);
    {
         BATTERY.icon("fas fa-battery-three-quarters");
    }
    if(battery_percent < 20)
    {
    BATTERY.icon("fas fa-battery-slash");
    BATTERY.color("#fddb00");
    Blinker.wechat("Title: 电量信息", "State: 电量不足", "Message: 电量已经低于20%,及时充电啦啦啦");
    }

    Blinker.delay(30000);
}
}







coloz 发表于 2020-4-13 18:56

只有“error”才是报错,Warning只是警告注意,不是错误
页: [1]
查看完整版本: 遇到EEPRON错误,小白不会解决