0

When I try to upload my script I get this in my serial monitor:

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

The board I am using is Uno + Wifi

And this is my sketch:

/*
* Arduino Smart Thermometer
*
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library 
#include <Button.h>
#include <SteinhartHart.h>

//LCD constants
const int rs = 2, en = 3, d4 = 8, d5 = 9, d6 = 10, d7 = 11;

//Thermsistor variables
int ThermistorPin = 0;
boolean degreeChanged = false;
double temp = 0.0;

//Buttons
int decreaseDegreePin = 12;
int increaseDegreePin = 13;
int backlightSwitch = 7;

#define PULLUP false        //To keep things simple, we use the Arduino's internal pullup resistor.
#define INVERT false        //Since the pullup resistor will keep the pin high unless the
                           //switch is closed, this is negative logic, i.e. a high state
                           //means the button is NOT pressed. (Assuming a normally open switch.)
#define DEBOUNCE_MS 50     //A debounce time of 20 milliseconds usually works well for tactile button switches.

Button decreaseDegreeButton(decreaseDegreePin, PULLUP, INVERT, DEBOUNCE_MS);    //Declare the button
Button increaseDegreeButton(increaseDegreePin, PULLUP, INVERT, DEBOUNCE_MS);    //Declare the button
Button backlightSwitchButton(backlightSwitch, PULLUP, INVERT, DEBOUNCE_MS);    //Declare the button

//Variables
int wantedDegree = 20;
int backlight = 255;
int switchPin = 4;
double curTemp;

// the following variables are unsigned longs because the time, measured in
// milliseconds, will quickly become a bigger number than can be stored in an int.
unsigned long lastDebounceTime = 0;  // the last time the output pin was toggled
unsigned long debounceDelay = 50;    // the debounce time; increase if the output flickers
unsigned long previousDegreeUpdateTime = 0;
unsigned long degreeUpdateDelay = 3000;

//Libraries
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
SteinhartHart thermsistor(ThermistorPin);

void setup() { 
  //Initialize backlight
  analogWrite(5,backlight);

  pinMode(switchPin,OUTPUT);

  //Initialize display
  lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display } 

  //First display
  updateDegree();
  displayCurrentStatus();
}
void loop() { 
  switchHeather();

  //Initialize backlight
  analogWrite(5,backlight);

  //Recalculate degree
  updateDegree();

  //Buttons initialization
  changeDegreeWithButtons();

  //If degree is updated, update display
  unsigned long currentDegreeUpdateTime = millis();
  if(degreeChanged){
    if((currentDegreeUpdateTime - previousDegreeUpdateTime) > degreeUpdateDelay){
      previousDegreeUpdateTime = currentDegreeUpdateTime;
      displayCurrentStatus();
    }
  }

}

void switchHeather(){
  if(wantedDegree > curTemp){
    digitalWrite(switchPin, HIGH);
  }
  else{
    digitalWrite(switchPin, LOW);
  }
}

void updateDegree(){

  curTemp = thermsistor.getTempCelsius();

  if(temp != curTemp)
  {
    temp = curTemp;
    degreeChanged = true;
  }
  else{
    degreeChanged = false;
  }
}

void displayCurrentStatus(){
    //Print degrees to LCD
    lcd.clear();
    lcd.print("Temperatuur:");
    lcd.setCursor(0,1); // Sets the location at which subsequent text written to the LCD will be displayed 
    lcd.print(temp);
    lcd.print(char(223));
    lcd.print(" Celcius");
}

void changeDegreeWithButtons(){
  //Read buttons
  decreaseDegreeButton.read();
  increaseDegreeButton.read();
  backlightSwitchButton.read();

  if (increaseDegreeButton.wasReleased()) {
    wantedDegree++;
    lcd.clear();
    lcd.print("Temperatuur:");
    lcd.setCursor(0,1); // Sets the location at which subsequent text written to the LCD will be displayed 
    lcd.print("Omhoog naar: ");
    lcd.print(wantedDegree);
  }

  if (decreaseDegreeButton.wasReleased()) {
    wantedDegree--;
    lcd.clear();
    lcd.print("Temperatuur:");
    lcd.setCursor(0,1); // Sets the location at which subsequent text written to the LCD will be displayed 
    lcd.print("Omlaag naar: ");
    lcd.print(wantedDegree);
  }

  //Backlight switch
  if (backlightSwitchButton.wasReleased()) {
    if(backlight == 255){
      lcd.clear();
      lcd.print("Backlight: Off");
      backlight = 0;
    }
    else{
      lcd.clear();
      lcd.print("Backlight: On");
      backlight = 255;
    }
  }
}

Why does this happen and how can I fix it? When I use the same script on my Arduin Uno board it does work. The board Uno + Wifi however doesn't.

Also what I used is:

  • An LCD Screen
  • 3 buttons with resistors
  • A thermsistor with resistor
  • A relay (only connected to arduino
  • External power source
2

This message indicates that you currently have the ESP8266 rather than the ATmega connected to the USB interface.

In order to upload Arduino sketches to the ATmega, you need to follow the instructions on the sale page to change the dip switches to USB<>ATmega328 mode.

enter image description here

The table is probably sufficient, if not you can puzzle out the German explanatory text or try machine translation.

It's possible you could also install ESP8266 support in your Arduino IDE and run your sketches on the ESP8266 part of the board instead of the ATmega part, however chances are mot of the Arduino headers go to the ATmega, so you would be limited in what peripherals you could connect.

  • Thank you this makes sense I thought I could just upload everything to ESP8266. But this leaves me with one question. The reason I use the ESP8266 part is because I need to pull data from the internet. If I upload my sketch to the Atmega part how do I pull the data from ESP8266 that I retrieved from there? – Sinan Samet Nov 25 '17 at 17:11
  • In example let's say I have a "String data" in ESP8266" how do I use this "data" variable inside Atmega? – Sinan Samet Nov 25 '17 at 17:12
  • That is both an entirely different question, and one which is too broad to be a fit here. Do a web search for Arduino + ESP8266 examples and invest some time in studying and trying them. – Chris Stratton Nov 25 '17 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.