- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Logical NOT in Arduinon
Logical NOT is performed using the ! operator. The truth table is given below −
Expression | Output |
---|---|
T | F |
F | T |
As you can see, the logical NOT inverts the truth value of the expression.
Example
The usage can be understood from the example given below −
void setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.println(); int i = 10; if (!(i > 10)) { Serial.println("i is NOT greater than 10"); } else { Serial.println("i is greater than 10"); } } void loop() { // put your main code here, to run repeatedly: }
Output
The Serial Monitor output is shown below −
The NOT function is often used while waiting for something to become true.
while(!condition){ //do something }
For example, if you are waiting for Serial input,
while(!Serial.available()){ //Wait }
The above loop will break when Serial.available() returns something greater than 0, i.e., when the serial input is received.
- Related Articles
- Logical NOT in Arduino
- Logical AND and OR in Arduino
- Bitwise NOT in Arduino
- What is Logical NOT Operator (!) in JavaScript?
- Explain about logical not(!) operator in detail with example in javascript?
- Check if two strings are equal or not in Arduino
- Logical Operators in C++
- Logical Group in 8051
- Check if the board is connected or not in Arduino IDE
- How to compute elementwise logical AND, OR and NOT of given input tensors in PyTorch?
- Logical instructions in 8086 microprocessor
- Logical Operator in Dart Programming
- Mathematical Logical Connectives
- Perl Logical Operators
- Java Logical Operators
- Python Logical Operators

Advertisements