# Error: 'PULLDOWN' was not declared in this scope

**URL:** <https://forum.arduino.cc/t/error-pulldown-was-not-declared-in-this-scope/1341029>\
**Category:** Programming\
**Created:** [January 10, 2025, 7:54am UTC](https://forum.arduino.cc/t/error-pulldown-was-not-declared-in-this-scope/1341029 "2025-01-10T07:54:16Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![michaelbinbc](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/michaelbinbc/32/1129439_2.png) [@michaelbinbc](https://forum.arduino.cc/u/michaelbinbc)\
**Post date:** [January 30, 2025, 6:38pm UTC](https://forum.arduino.cc/t/error-pulldown-was-not-declared-in-this-scope/1341029/21 "2025-01-30T18:38:16Z")

</div>

Well crap... I just found the original EEPROMVar.h. It compiles just fine. Now it will store any settings changed through the menu on the chip itself so it doesn't reset if the power goes out.

```arduino
#include <Arduino.h> //changed from WProgram.h
#include <EEPROM.h>
/*
   www.alexanderbrevig.com
   AlphaBeta
*/

class EEPROMAddressCounter {
protected:
  static int availableAddress;
};
int EEPROMAddressCounter::availableAddress = 0;

template<typename T>
class EEPROMVar : 
public EEPROMAddressCounter {
public:
  static const byte IS_INITIALIZED = B10101010;
  EEPROMVar(T init) {
    address = availableAddress;
    var = init;
    restore();
    availableAddress += sizeof(T) + 1; //make room for the is initialized flag
  }
  operator T () { 
    return var; 
  }
  EEPROMVar &operator=(T val) {
    var = val;
    save();
  }
  void operator++(int) {
    var += T(1); //cast for safety
    save();
  }
  void operator--(int) {
    var -= T(1); //cast for safety
    save();
  }
  void operator++() {
    var += T(1); //cast for safety
    save();
  }
  void operator--() {
    var -= T(1); //cast for safety
    save();
  }
  template<typename V>
    void operator /= (V divisor) {
    var = var / divisor;
    save();
  }
  template<typename V>
    void operator *= (V multiplicator) {
    var = var * multiplicator;
    save();
  }
protected:
  void save(){
    union {
      byte raw[sizeof(T)];
      T data;
    } writer;
    writer.data = var;
    for (byte i=0; i<sizeof(T); i++) {
       EEPROM.write(address + 1 + i, writer.raw[i]);
    }
  }
  void restore(){
    
    byte init = EEPROM.read(address);
    
    if (init!=EEPROMVar::IS_INITIALIZED) {
      //it was not initialized
      EEPROM.write(address,EEPROMVar::IS_INITIALIZED);
      union {
        byte raw[sizeof(T)];
        T data;
      } writer;
      writer.data = var;
      for (byte i=0; i<sizeof(T); i++) {
         EEPROM.write(address + 1 + i, writer.raw[i]);
      }
    }
    //read from EEPROM
    union {
      byte raw[sizeof(T)];
      T data;
    } reader;
    for (byte i=0; i<sizeof(T); i++) {
       reader.raw[i] = EEPROM.read(address + 1 + i);\
    }
    var = reader.data;
  }
  T var;
  int address;
};

```

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 29, 2025, 6:39pm UTC](https://forum.arduino.cc/t/error-pulldown-was-not-declared-in-this-scope/1341029/22 "2025-07-29T18:39:09Z")

</div>

Closed on July 29, 2025, 6:39pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

[Previous page](https://forum.arduino.cc/t/error-pulldown-was-not-declared-in-this-scope/1341029.md?page=1)
