Arduino Programming Language: BooleanVariables

Name

boolean

Description

Datatype boolean defines two values: true and false. 
The value false indicates the 0, true rapresents 1 or any different value than 0.

Syntax

boolean var
boolean var = booleanvalue

Parameters

  • var: variable name
  • booleanvalue: possible values are true or false

Usage

Application

Examples

int pinLED = 3; // LED on pin 3

boolean switch = true;

void setup()
{
pinMode(pinLED, OUTPUT);
digitalWrite(pinLED, LOW); //LED closed
}

void loop()
{
digitalWrite(pinLED, switch);
delay(1000);
switch = !switch;

}


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc