Arduino Forum

Using Arduino => Microcontrollers => Topic started by: itwasntme967 on Sep 24, 2018, 08:56 am

Title: "'ESP' does not name a type"
Post by: itwasntme967 on Sep 24, 2018, 08:56 am
Hi there, I'm experimenting with the ESP8266 and wanted to try the deepsleep feature. while compiling though I get the Error 'ESP' does not name a type.
The deep sleep example compiles without a problem.
Does anybody have any idea what may cause this?
Code is below, the rest works fine, I compiled the programm without any errors when all ESP.* functions were commented out.

Code: [Select]

#include <GxEPD.h>
#include <GxGDE0213B1\GxGDE0213B1.cpp>

#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include <Fonts/FreeMonoBold24pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>

GxIO_Class io(SPI, SS, 0, 2);
GxEPD_Class display(io);

#include <Wire.h>
#include <Adafruit_SHT31.h>
Adafruit_SHT31 sht31 = Adafruit_SHT31();

uint32_t x;
uint32_t y;
uint32_t i;
int j;
uint32_t magic = 0;


void setup() {

ESP.rtcUserMemoryRead(0, &magic, sizeof(magic));
ESP.rtcUserMemoryRead(4, &x, sizeof(x));
ESP.rtcUserMemoryRead(8, &y, sizeof(y));
ESP.rtcUserMemoryRead(16, &i, sizeof(i));

display.init(115200);
display.setRotation(3);
display.setTextColor(GxEPD_BLACK);

if(!magic || i == 20){
  display.fillRect(0,0,GxEPD_HEIGHT, GxEPD_WIDTH, GxEPD_WHITE);
  display.update();
  magic = 1;
}
       //SDA,SCL
Wire.begin(5,12);
sht31.begin(0x44);

float t = sht31.readTemperature();
float phi = sht31.readHumidity();

if((x / 100.00) != t){
  UpdateDisplayTemp(t);
    j = 1;
    x = t *100;
  }
 
  if((y / 100.00) != phi);{
    UpdateDisplayHydro(phi);
    j = 1;
    y = phi * 100;
  }

if(j = 1){i++;}
}

ESP.rtcUserMemoryWrite(0, &magic, sizeof(magic));
ESP.rtcUserMemoryWrite(4, &x, sizeof(x));
ESP.rtcUserMemoryWrite(8, &y, sizeof(y));
ESP.rtcUserMemoryWrite(16, &i, sizeof(i));

ESP.deepSleep(10e6);


void loop() {
}


void UpdateDisplayTemp(float temp){


  //update the temperature
  display.setFont(&FreeMonoBold24pt7b);
  display.fillRect(0,0,250,122, 1);
  display.updateWindow(0,0,250,122, true);
  display.fillCircle(180,25,6, GxEPD_BLACK);
  display.fillCircle(180,25,3, GxEPD_WHITE);
  display.setCursor(190,50);
  display.println("C");
  display.updateWindow(172,18,45,50, true);
  if(temp < 10){
    display.setCursor(58,50); 
  } else if(temp < 100){
    display.setCursor(30,50);
  } else {
    display.setCursor(2, 50);
  }
    display.print(temp);

    display.updateWindow(2,20,170,40, true);
    }


void UpdateDisplayHydro(float hydro){

 //update the hydro
  display.setFont(&FreeMonoBold18pt7b);
  display.setCursor(195,100);
  display.println("%");
  display.updateWindow(195,68,30,40, true);
  if(hydro < 10){
    display.setCursor(108,100);
  } else if(hydro < 100){
    display.setCursor(87,100);
  } else {
    display.setCursor(59, 100);
  }
    display.print(hydro);
    display.updateWindow(59,70,130,40, true);
}
Title: Re: "'ESP' does not name a type"
Post by: itwasntme967 on Sep 24, 2018, 11:41 am
Nevermid, I found the problem to be a stray } in

Code: [Select]

[...]

if(j = 1){i++;}
}

[...]


I deleted it and set a new one after

Code: [Select]


[...]

ESP.deepSleep(10e6);
} //new

[...]