You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously only Arduino's type alias, boolean was documented.
In this case it's arguable that the benefits of a slightly more descriptive type name outweigh the disadvantages of using a non-standard type. For that reason documenting bool and recommending its use instead of boolean is desirable.
Copy file name to clipboardExpand all lines: Language/Variables/Data Types/boolean.adoc
+3-41
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ subCategories: [ "Data Types" ]
17
17
18
18
[float]
19
19
=== Description
20
-
A `boolean` holds one of two values, `true` or `false`. (Each `boolean` variable occupies one byte of memory.)
20
+
`boolean` is a non-standard type alias for link:../../../variables/data-types/bool/[bool] defined by Arduino. It's recommended to instead use the standard type `bool`, which is identical.
21
21
22
22
23
23
[%hardbreaks]
@@ -28,44 +28,6 @@ A `boolean` holds one of two values, `true` or `false`. (Each `boolean` variable
28
28
29
29
30
30
31
-
// HOW TO USE SECTION STARTS
32
-
[#howtouse]
33
-
--
34
-
35
-
[float]
36
-
=== Example Code
37
-
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
38
-
This code shows how to use the `boolean` datatype.
39
-
40
-
[source,arduino]
41
-
----
42
-
int LEDpin = 5; // LED on pin 5
43
-
int switchPin = 13; // momentary switch on 13, other side connected to ground
44
-
45
-
boolean running = false;
46
-
47
-
void setup()
48
-
{
49
-
pinMode(LEDpin, OUTPUT);
50
-
pinMode(switchPin, INPUT);
51
-
digitalWrite(switchPin, HIGH); // turn on pullup resistor
52
-
}
53
-
54
-
void loop()
55
-
{
56
-
if (digitalRead(switchPin) == LOW)
57
-
{ // switch is pressed - pullup keeps pin high normally
58
-
delay(100); // delay to debounce switch
59
-
running = !running; // toggle running variable
60
-
digitalWrite(LEDpin, running); // indicate via LED
0 commit comments