sketch made in 2018 not working (new installation)

#include <C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\EEPROM.h> //(for me) 
#include "DigiKeyboard.h"                                // for debug (no serial.print on ATtiny85)
int counter = 0;
const byte  LM35Pin = A1;
const byte LED2 = 1;
const byte button = 0;
const float EMA_alpha = 0.3;  
boolean TemperatureInRange = false;//initialization of EMA alpha
float FilteredTemperature = readTemp();                                              //set EMA S for t=1
float Setpoint;                                                                   // Desired temperature
float readTemp()                                        // get the temperature and convert it to celsius
{
  return analogRead(LM35Pin) * 0.48828125;
}
boolean PrintButtonLP = false;
boolean SetButtonSP = false;
boolean buttonActive = false;
boolean longPressActive = false;
long buttonTimer = 0;
long longPressTime = 5000;
void setup() {
  pinMode(LED2, OUTPUT);
  pinMode(button, INPUT);
  Setpoint = EEPROM.get(1, Setpoint);                                  // read the settemp on the eeprom
  FilteredTemperature = readTemp();                                                  //set EMA S for t=1
  digitalWrite(LED2, HIGH);                                                        // flash once (ready)
  delay(500);
  digitalWrite(LED2, LOW);
  if (PrintButtonLP==true)
  {
  digitalWrite(LED2, HIGH);                      
  }
}
void loop() 
{
  if (digitalRead(button) == HIGH) 
  {
    if (buttonActive == false) 
    {
      buttonActive = true;
      buttonTimer = millis();
    }
     if ((millis() - buttonTimer > longPressTime) && (longPressActive == false)) 
     {
      longPressActive = true;
      PrintButtonLP = !PrintButtonLP;
     }
   } else {
     if (buttonActive == true) 
     {
      if (longPressActive == true) 
      {
        longPressActive = false;
        //delay(25);
    } else {
        SetButtonSP = !SetButtonSP;
      }
      buttonActive = false;
     }
  }
{
  float temperature = readTemp();
  FilteredTemperature = (EMA_alpha * temperature) + ((1 - EMA_alpha) * FilteredTemperature);//run the EMA
  if (PrintButtonLP==false)
  {
  delay(500);
  }
  if (PrintButtonLP==true)
  {
   DigiKeyboard.print("      ");
   DigiKeyboard.print(temperature); //real temp
   DigiKeyboard.print("   ");
   DigiKeyboard.println(FilteredTemperature); 
     
   //filtered
  }
   if (SetButtonSP==true)                                                            // chk settemp swtch
   {
     Setpoint = FilteredTemperature;                                        // set current temp to eeprom
     EEPROM.put (1, Setpoint);
     digitalWrite(LED2, HIGH);                                 // flash once (current temp set to eeprom)
     delay(2000);
     //???digitalWrite(LED2, LOW);
     digitalWrite(LED2, SetButtonSP = false);
     if (PrintButtonLP==true)
     {
       DigiKeyboard.println(" set; ");         // (serial.print when 'settemp to eeprom' for ATtiny85)
     }
   }
  if (FilteredTemperature < Setpoint + 10.0)
  {
    if (!TemperatureInRange)
    {
      // Temperature newly in range
      digitalWrite(LED2, LOW);
      TemperatureInRange = true;
    }
  } else {
    if (TemperatureInRange) 
    {
      // Temperature is newly out of range
      TemperatureInRange = false;
      digitalWrite(LED2, HIGH);                   // 2 x flash once only (when 'settemp minus 10 deg')
      if (PrintButtonLP==true)
      {
        DigiKeyboard.println(" alarm; "); // (serial.print when 'settemp minus 10deg' for ATtiny85)
     }
    } else {
  }
  }
  if ( (FilteredTemperature > Setpoint - 10.0) && (counter < 1) )                   // Too low by 10.0°C
  {
     digitalWrite(LED2, HIGH);                       // 2 x flash once only (when 'settemp minus 10 deg')
     delay(250);
     digitalWrite(LED2, LOW);
     delay(250);
     if (PrintButtonLP==true)
    {
     DigiKeyboard.println(" test; ");      // (serial.print when 'settemp minus 10deg' for ATtiny85)
    }
     counter++;
  }
}
}

Please explain what “not working” means.

hi thanx, was getting there :wink:
well, i whiped my hdd and reinstalled everything so everything is new versions of what i had back then.

the first thing i had to change was,
#include <EEPROM.h> (could never get it to work bach then)

if i verify, i get:

Arduino: 1.8.13 (Windows 10), Board: “Digispark, Default - 16.5 MHz, Default (6650 bytes avail.)”

In file included from C:\Users\johann\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.7.0\libraries\DigisparkKeyboard/DigiKeyboard.h:17:0,

from D:\Users\lost6\Documents\Arduino\vbdb\vbdb.ino:2:

C:\Users\johann\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.7.0\libraries\DigisparkKeyboard/keylayouts.h:5647:2: warning: #warning “Using default layout (LAYOUT_US_ENGLISH)” [-Wcpp]

#warning “Using default layout (LAYOUT_US_ENGLISH)”

^~~~~~~

vbdb:9:29: error: ‘readTemp’ was not declared in this scope

float FilteredTemperature = readTemp(); //set EMA S for t=1

^~~~~~~~

D:\Users\lost6\Documents\Arduino\vbdb\vbdb.ino: In function ‘void loop()’:

D:\Users\lost6\Documents\Arduino\vbdb\vbdb.ino:43:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

if ((millis() - buttonTimer > longPressTime) && (longPressActive == false))


exit status 1

'readTemp' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

(this is the same code i used)
here is the topic from 2018
https://forum.arduino.cc/?topic=559041#msg3814689

You seem to be missing some code, and perhaps one or more libraries.

What is connected to the Arduino and which Arduino is it?

Post links to product pages, and photo of a hand drawn wiring diagram.

Edit: now I see that the function readTemp() is defined near the top of your program. Move it somewhere else, and/or add a function prototype at the very top, like this:

float readTemp(void);

Sometimes the Arduino preprocessor does not place the function prototypes correctly.

its a Digispark ATtiny85, with a lm35, buzzer and button

jremington: Edit: now I see that the function readTemp() is defined near the top of your program. Move it somewhere else, and/or add a function prototype at the very top, like this:

float readTemp(void);

Sometimes the Arduino preprocessor does not place the function prototypes correctly.

thank you so much

float readTemp(void);

right at the top fixed it!!!! :)