Defining a logic variable type

Can anyone advise how you define a logic variable in the IDE for ATmega 2560?

What do you mean by "logical variable"?

If you mean a variable that must only be true or false, just declare it "bool", example:

  bool isActive = false;
...
  if (isActive) {
    isActive = false;
    // then do something
...
  }
...
  if (condition) {
    // Set the flag
    isActive = true;
  }

Perhaps read the pinned post re 'How to get the most from the forum' first.

#define UP 1 // variable UP is now defined as logic level 1 / HIGH
#define DN 0 // variable DN is now defined as logic level 0 / LOW

// #define HIGH 0x1  // defined in Arduino.h
// #define LOW  0x0 // defined in Arduino.h

Many more #define here:

Thank you!

Bruce Clift

1 Like