Can anyone advise how you define a logic variable in the IDE for ATmega 2560?
docdoc
April 24, 2025, 11:15am
2
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.
xfpd
April 24, 2025, 8:08pm
4
#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:
/*
Arduino.h - Main include file for the Arduino SDK
Copyright (c) 2005-2013 Arduino Team. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Arduino_h
This file has been truncated. show original