From 5064375ed7b3cd344c00fccdea5fdd3eb9de66cc Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Wed, 3 Oct 2018 12:55:54 -0400 Subject: [PATCH 001/298] remove redundant "else" test in temperature example Fix #450. There is also a spelling problem with "precede". --- Language/Structure/Control Structure/else.adoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 8ac37de85..66757eb1c 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -17,7 +17,7 @@ subCategories: [ "Control Structure" ] [float] === Description -The `if...else` allows greater control over the flow of code than the basic link:../if[if] statement, by allowing multiple tests to be grouped together. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can proceed another `if` test, so that multiple, mutually exclusive tests can be run at the same time. +The `if...else` allows greater control over the flow of code than the basic link:../if[if] statement, by allowing multiple tests to be grouped together. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can precede another `if` test, so that multiple, mutually exclusive tests can be run at the same time. [%hardbreaks] Each test will proceed to the next one until a true test is encountered. When a true test is found, its associated block of code is run, and the program then skips to the line following the entire if/else construction. If no test proves to be true, the default `else` block is executed, if one is present, and sets the default behavior. @@ -57,15 +57,15 @@ Below is an extract from a code for temperature sensor system ---- if (temperature >= 70) { - //Danger! Shut down the system + // Danger! Shut down the system } -else if (temperature >= 60 && temperature < 70) +else if (temperature >= 60) { - //Warning! User attention required + // Warning! Thorttle down, run the fans, and notify the user } else { - //Safe! Continue usual tasks... + // Safe! Continue usual tasks... } ---- @@ -84,4 +84,4 @@ else [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS From fa9ff4471f4bdaa8f15c39473ac8570c70dd9f80 Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Wed, 3 Oct 2018 20:03:11 -0400 Subject: [PATCH 002/298] else: (squash this) run a spillcheck --- Language/Structure/Control Structure/else.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 66757eb1c..8d0477b99 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -61,7 +61,7 @@ if (temperature >= 70) } else if (temperature >= 60) { - // Warning! Thorttle down, run the fans, and notify the user + // Warning! Throttle down, run the fans, and notify the user } else { From 5063fa08e44047a83c83b106c44d44f71e60d8a3 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 6 Feb 2019 01:03:13 -0800 Subject: [PATCH 003/298] Separate parameters list with blank lines When there were multiple parameters with longer descriptions, the Parameters section ended up looking like a wall of text. Separating each parameter with a blank line makes it easier to read and faster to find the information you're searching for. This format is also easier for the collaborators to work with because they don't need to remember to add the ` +` at the end of the line. There are currently several reference pages where that was forgotten. I had also considered formatting the parameters section as a list. That looks quite nice also, but in the end I decided I slightly preferred the blank lines. Example of the previous formatting being problematic: https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt#_parameters --- .../Reference_Terms/AsciiDoc_Template-Single_Entity.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc index f13b90bc6..8e5f571de 100644 --- a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc +++ b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc @@ -42,7 +42,8 @@ image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption=" [float] === Parameters // List all available parameters, please describe them one by one adding the data type (e.g int, boolean, char, String, float, long, double...) ►►►►► THIS SECTION IS MANDATORY FOR FUNCTIONS ◄◄◄◄◄ -`pin`: the number of the pin to write to. Allowed data types: int. + +`pin`: the number of the pin to write to. Allowed data types: int. + `value`: the duty cycle between 0 (always off) and 255 (always on). Allowed data types: int. From 7e6c54764e44da0e69455a9e11f58109f2a80315 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 6 Feb 2019 01:51:01 -0800 Subject: [PATCH 004/298] Establish a standard for the use of blank lines to separate sections Blank lines were used inconsistently and unnecessarily in the reference example. I have attempted to decipher the intended spacing standard and apply this across the document. This proposal establishes an official style. If accepted, I will apply it across all the reference pages, where this sort of inconsistency is widespread. --- .../Reference_Terms/AsciiDoc_Template-Single_Entity.adoc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc index f13b90bc6..d08fe8850 100644 --- a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc +++ b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc @@ -12,8 +12,6 @@ subCategories: [ "Subcategory Name" ] - - // PAGE TITLE = title @@ -56,7 +54,6 @@ Nothing - // HOW TO USE SECTION STARTS [#howtouse] -- @@ -66,7 +63,6 @@ Nothing // Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ Sets the output to the LED proportional to the value read from the potentiometer. - [source,arduino] // Add relevant code that exemplify the use of the Reference term, // Please note that sometimes when copy-pasting code, a few spaces can be added at the beginnng of each line of code. @@ -102,6 +98,7 @@ image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption=" // HOW TO USE SECTION ENDS + // SEE ALSO SECTION [#see_also] -- @@ -112,7 +109,6 @@ image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption=" // definitions: (please add the tag #DEFINITION#), and examples of Projects and Tutorials // examples: (please add the tag #EXAMPLE#) - [role="language"] // Whenever you want to link to another Reference term, or more in general to a relative link, // use the syntax shown below. Please note that the file format is subsituted by attribute. @@ -133,4 +129,3 @@ image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption=" -- // SEE ALSO SECTION ENDS - From f7666e57ea6c961090ed606236e30929be567096 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 18 Feb 2019 19:49:38 -0800 Subject: [PATCH 005/298] Make all files end in a newline When a file doesn't end in a newline, it causes Git diffs to show the previous last line of the file as having been modified when new line(s) are added after it, even when no modification was made. This makes the diff more difficult and slow to review. --- .drone.yml | 2 +- .../Reference_Terms/AsciiDoc_Template-Single_Entity.adoc | 1 - Language/Functions/Advanced IO/tone.adoc | 2 +- Language/Functions/Characters/isDigit.adoc | 2 +- Language/Functions/Communication/Serial/end.adoc | 2 +- Language/Functions/Communication/Serial/readString.adoc | 2 +- Language/Functions/Communication/Serial/readStringUntil.adoc | 2 +- Language/Functions/Communication/Serial/serialEvent.adoc | 2 +- Language/Functions/Communication/Stream/streamAvailable.adoc | 2 +- Language/Functions/Communication/Stream/streamFind.adoc | 2 +- Language/Functions/Communication/Stream/streamFindUntil.adoc | 2 +- Language/Functions/Communication/Stream/streamFlush.adoc | 2 +- Language/Functions/Communication/Stream/streamParseFloat.adoc | 2 +- Language/Functions/Communication/Stream/streamParseInt.adoc | 2 +- Language/Functions/Communication/Stream/streamPeek.adoc | 2 +- Language/Functions/Communication/Stream/streamRead.adoc | 2 +- .../Functions/Communication/Stream/streamReadStringUntil.adoc | 1 - Language/Functions/USB/Keyboard/keyboardBegin.adoc | 2 +- Language/Functions/USB/Keyboard/keyboardModifiers.adoc | 2 +- Language/Functions/USB/Mouse.adoc | 1 - Language/Functions/USB/Mouse/mouseBegin.adoc | 1 - Language/Functions/USB/Mouse/mouseClick.adoc | 2 +- Language/Structure/Bitwise Operators/bitshiftRight.adoc | 2 +- Language/Structure/Bitwise Operators/bitwiseOr.adoc | 2 +- Language/Structure/Boolean Operators/logicalAnd.adoc | 2 +- Language/Structure/Boolean Operators/logicalOr.adoc | 2 +- Language/Structure/Comparison Operators/equalTo.adoc | 1 - Language/Structure/Compound Operators/compoundAddition.adoc | 2 +- Language/Structure/Compound Operators/increment.adoc | 2 +- Language/Structure/Control Structure/else.adoc | 2 +- Language/Structure/Control Structure/for.adoc | 2 +- Language/Structure/Control Structure/while.adoc | 2 +- Language/Structure/Further Syntax/include.adoc | 2 +- Language/Variables/Constants/floatingPointConstants.adoc | 2 +- Language/Variables/Conversion/byteCast.adoc | 2 +- Language/Variables/Conversion/charCast.adoc | 2 +- Language/Variables/Conversion/floatCast.adoc | 2 +- Language/Variables/Conversion/intCast.adoc | 2 +- Language/Variables/Conversion/longCast.adoc | 2 +- Language/Variables/Conversion/wordcast.adoc | 2 +- Language/Variables/Data Types/String/Functions/c_str.adoc | 2 +- Language/Variables/Data Types/String/Functions/compareTo.adoc | 2 +- Language/Variables/Data Types/String/Functions/concat.adoc | 2 +- Language/Variables/Data Types/String/Functions/endsWith.adoc | 2 +- Language/Variables/Data Types/String/Functions/equals.adoc | 2 +- Language/Variables/Data Types/String/Functions/indexOf.adoc | 2 +- Language/Variables/Data Types/String/Functions/lastIndexOf.adoc | 2 +- Language/Variables/Data Types/String/Functions/length.adoc | 2 +- Language/Variables/Data Types/String/Functions/setCharAt.adoc | 2 +- Language/Variables/Data Types/String/Functions/startsWith.adoc | 2 +- Language/Variables/Data Types/String/Functions/substring.adoc | 2 +- .../Variables/Data Types/String/Operators/concatenation.adoc | 2 +- Language/Variables/Data Types/byte.adoc | 2 +- Language/Variables/Data Types/char.adoc | 2 +- Language/Variables/Data Types/double.adoc | 2 +- Language/Variables/Data Types/float.adoc | 2 +- Language/Variables/Data Types/short.adoc | 2 +- Language/Variables/Data Types/unsignedChar.adoc | 2 +- Language/Variables/Data Types/unsignedLong.adoc | 2 +- Language/Variables/Data Types/void.adoc | 2 +- Language/Variables/Variable Scope & Qualifiers/const.adoc | 2 +- 61 files changed, 56 insertions(+), 61 deletions(-) diff --git a/.drone.yml b/.drone.yml index 34276eb08..1dcd73639 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,4 +7,4 @@ pipeline: - bcmi-labs/reference when: branch: [master] - event: push \ No newline at end of file + event: push diff --git a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc index f13b90bc6..3fde61f2a 100644 --- a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc +++ b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc @@ -133,4 +133,3 @@ image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption=" -- // SEE ALSO SECTION ENDS - diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 562f8988c..2e30e59b3 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -84,4 +84,4 @@ If you want to play different pitches on multiple pins, you need to call `noTone * #EXAMPLE# http://arduino.cc/en/Tutorial/PWM[PWM^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Functions/Characters/isDigit.adoc b/Language/Functions/Characters/isDigit.adoc index b50894612..a6e0580b1 100644 --- a/Language/Functions/Characters/isDigit.adoc +++ b/Language/Functions/Characters/isDigit.adoc @@ -79,4 +79,4 @@ else * #LANGUAGE# link:../../communication/serial/read[read()] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Functions/Communication/Serial/end.adoc b/Language/Functions/Communication/Serial/end.adoc index 3660c7b68..badd58458 100644 --- a/Language/Functions/Communication/Serial/end.adoc +++ b/Language/Functions/Communication/Serial/end.adoc @@ -32,4 +32,4 @@ Disables serial communication, allowing the RX and TX pins to be used for genera Nothing -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/readString.adoc b/Language/Functions/Communication/Serial/readString.adoc index fb1d5f1eb..201e7f357 100644 --- a/Language/Functions/Communication/Serial/readString.adoc +++ b/Language/Functions/Communication/Serial/readString.adoc @@ -59,4 +59,4 @@ A String read from the serial buffer * #LANGUAGE# link:../parsefloat[parseFloat()] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Functions/Communication/Serial/readStringUntil.adoc b/Language/Functions/Communication/Serial/readStringUntil.adoc index afc98e781..c56d8cfa2 100644 --- a/Language/Functions/Communication/Serial/readStringUntil.adoc +++ b/Language/Functions/Communication/Serial/readStringUntil.adoc @@ -73,4 +73,4 @@ The terminator character is discarded from the serial buffer. * #LANGUAGE# link:../../stream/streamparsefloat[stream.parseFloat()] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index da41b804a..0196531d9 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -94,4 +94,4 @@ Nothing * #LANGUAGE# link:../write[write()] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamAvailable.adoc b/Language/Functions/Communication/Stream/streamAvailable.adoc index 908e14b1b..e896bcaf6 100644 --- a/Language/Functions/Communication/Stream/streamAvailable.adoc +++ b/Language/Functions/Communication/Stream/streamAvailable.adoc @@ -33,4 +33,4 @@ This function is part of the Stream class, and can be called by any class that i `int` : the number of bytes available to read -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamFind.adoc b/Language/Functions/Communication/Stream/streamFind.adoc index 7ce172638..4e83d6478 100644 --- a/Language/Functions/Communication/Stream/streamFind.adoc +++ b/Language/Functions/Communication/Stream/streamFind.adoc @@ -39,4 +39,4 @@ This function is part of the Stream class, and can be called by any class that i `bool` -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamFindUntil.adoc b/Language/Functions/Communication/Stream/streamFindUntil.adoc index 8f4d8b10e..5977f7ae7 100644 --- a/Language/Functions/Communication/Stream/streamFindUntil.adoc +++ b/Language/Functions/Communication/Stream/streamFindUntil.adoc @@ -40,4 +40,4 @@ This function is part of the Stream class, and can be called by any class that i `bool` -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamFlush.adoc b/Language/Functions/Communication/Stream/streamFlush.adoc index d66cd99de..4fcb80885 100644 --- a/Language/Functions/Communication/Stream/streamFlush.adoc +++ b/Language/Functions/Communication/Stream/streamFlush.adoc @@ -34,4 +34,4 @@ This function is part of the Stream class, and can be called by any class that i Nothing -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamParseFloat.adoc b/Language/Functions/Communication/Stream/streamParseFloat.adoc index d49f42ab0..239a19a98 100644 --- a/Language/Functions/Communication/Stream/streamParseFloat.adoc +++ b/Language/Functions/Communication/Stream/streamParseFloat.adoc @@ -36,4 +36,4 @@ This function is part of the Stream class, and can be called by any class that i `float` -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamParseInt.adoc b/Language/Functions/Communication/Stream/streamParseInt.adoc index 7256592c2..018a362e0 100644 --- a/Language/Functions/Communication/Stream/streamParseInt.adoc +++ b/Language/Functions/Communication/Stream/streamParseInt.adoc @@ -45,4 +45,4 @@ This function is part of the Stream class, and can be called by any class that i `long` -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamPeek.adoc b/Language/Functions/Communication/Stream/streamPeek.adoc index 1d2a271ec..75a637a1d 100644 --- a/Language/Functions/Communication/Stream/streamPeek.adoc +++ b/Language/Functions/Communication/Stream/streamPeek.adoc @@ -44,4 +44,4 @@ The next byte (or character), or -1 if none is available. -- -- -// HOW TO USE SECTION ENDS \ No newline at end of file +// HOW TO USE SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamRead.adoc b/Language/Functions/Communication/Stream/streamRead.adoc index 913addee0..6d514fcea 100644 --- a/Language/Functions/Communication/Stream/streamRead.adoc +++ b/Language/Functions/Communication/Stream/streamRead.adoc @@ -34,4 +34,4 @@ This function is part of the Stream class, and can be called by any class that i The first byte of incoming data available (or -1 if no data is available). -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc index 2944c527a..2e4ce08ac 100644 --- a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc @@ -50,4 +50,3 @@ The terminator character is discarded from the stream. -- // HOW TO USE SECTION ENDS - diff --git a/Language/Functions/USB/Keyboard/keyboardBegin.adoc b/Language/Functions/USB/Keyboard/keyboardBegin.adoc index 39f0c5e4d..f4bd5aceb 100644 --- a/Language/Functions/USB/Keyboard/keyboardBegin.adoc +++ b/Language/Functions/USB/Keyboard/keyboardBegin.adoc @@ -67,4 +67,4 @@ void loop() { } ---- -// HOW TO USE SECTION ENDS \ No newline at end of file +// HOW TO USE SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 15976a8cf..d6bd91df4 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -66,4 +66,4 @@ The Leonardo's definitions for modifier keys are listed below: |KEY_F12 |0xCD |205 -- -// OVERVIEW SECTION ENDS \ No newline at end of file +// OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Mouse.adoc b/Language/Functions/USB/Mouse.adoc index 8d810aac1..adab1e421 100644 --- a/Language/Functions/USB/Mouse.adoc +++ b/Language/Functions/USB/Mouse.adoc @@ -68,4 +68,3 @@ link:../mouse/mouseispressed[Mouse.isPressed()] -- // SEE ALSO SECTION ENDS - diff --git a/Language/Functions/USB/Mouse/mouseBegin.adoc b/Language/Functions/USB/Mouse/mouseBegin.adoc index f4820aa74..8faf9d18e 100644 --- a/Language/Functions/USB/Mouse/mouseBegin.adoc +++ b/Language/Functions/USB/Mouse/mouseBegin.adoc @@ -86,4 +86,3 @@ void loop(){ -- // SEE ALSO SECTION ENDS - diff --git a/Language/Functions/USB/Mouse/mouseClick.adoc b/Language/Functions/USB/Mouse/mouseClick.adoc index f54a532c2..e500ae493 100644 --- a/Language/Functions/USB/Mouse/mouseClick.adoc +++ b/Language/Functions/USB/Mouse/mouseClick.adoc @@ -95,4 +95,4 @@ When you use the `Mouse.click()` command, the Arduino takes over your mouse! Mak * #LANGUAGE# link:../mouseispressed[Mouse.isPressed()] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitshiftRight.adoc b/Language/Structure/Bitwise Operators/bitshiftRight.adoc index a340c3e07..fdd3d285a 100644 --- a/Language/Structure/Bitwise Operators/bitshiftRight.adoc +++ b/Language/Structure/Bitwise Operators/bitshiftRight.adoc @@ -96,4 +96,4 @@ int y = x >> 3; // integer division of 1000 by 8, causing y = 125. * #EXAMPLE# http://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitwiseOr.adoc b/Language/Structure/Bitwise Operators/bitwiseOr.adoc index 1cc8f019d..3b2d84c70 100644 --- a/Language/Structure/Bitwise Operators/bitwiseOr.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseOr.adoc @@ -78,4 +78,4 @@ DDRD = DDRD | B11111100; * #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Boolean Operators/logicalAnd.adoc b/Language/Structure/Boolean Operators/logicalAnd.adoc index 8bbbf351a..3b31a38de 100644 --- a/Language/Structure/Boolean Operators/logicalAnd.adoc +++ b/Language/Structure/Boolean Operators/logicalAnd.adoc @@ -61,4 +61,4 @@ Make sure you don't mistake the boolean AND operator, && (double ampersand) for * #LANGUAGE# link:../../bitwise-operators/bitwiseand[& (Bitwise AND)] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Boolean Operators/logicalOr.adoc b/Language/Structure/Boolean Operators/logicalOr.adoc index d876fd062..4b2fc8727 100644 --- a/Language/Structure/Boolean Operators/logicalOr.adoc +++ b/Language/Structure/Boolean Operators/logicalOr.adoc @@ -63,4 +63,4 @@ Do not confuse the boolean || (double pipe) operator with the bitwise OR operato * #LANGUAGE# link:../../bitwise-operators/bitwiseor[| Bitwise OR] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Comparison Operators/equalTo.adoc b/Language/Structure/Comparison Operators/equalTo.adoc index c9f11bd72..625842895 100644 --- a/Language/Structure/Comparison Operators/equalTo.adoc +++ b/Language/Structure/Comparison Operators/equalTo.adoc @@ -71,4 +71,3 @@ if (x==y) // tests if x is equal to y -- // SEE ALSO SECTION ENDS - diff --git a/Language/Structure/Compound Operators/compoundAddition.adoc b/Language/Structure/Compound Operators/compoundAddition.adoc index 8d7fd6d84..94c6abe8c 100644 --- a/Language/Structure/Compound Operators/compoundAddition.adoc +++ b/Language/Structure/Compound Operators/compoundAddition.adoc @@ -67,4 +67,4 @@ x += 4; // x now contains 6 * #LANGUAGE# link:../../arithmetic-operators/addition[Normal Addition] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/increment.adoc b/Language/Structure/Compound Operators/increment.adoc index e35179032..b2caeaf6c 100644 --- a/Language/Structure/Compound Operators/increment.adoc +++ b/Language/Structure/Compound Operators/increment.adoc @@ -71,4 +71,4 @@ y = x++; // x contains 4, but y still contains 3 [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 8ac37de85..fb8cb7b9c 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -84,4 +84,4 @@ else [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index 8ca661d46..61a84eee8 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -112,4 +112,4 @@ void loop() [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/while.adoc b/Language/Structure/Control Structure/while.adoc index fce5e5102..04a2cc636 100644 --- a/Language/Structure/Control Structure/while.adoc +++ b/Language/Structure/Control Structure/while.adoc @@ -70,4 +70,4 @@ while(var < 200){ * #EXAMPLE# https://arduino.cc/en/Tutorial/WhileLoop[While Loop Tutorial^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Further Syntax/include.adoc b/Language/Structure/Further Syntax/include.adoc index 6421dde13..e561f5170 100644 --- a/Language/Structure/Further Syntax/include.adoc +++ b/Language/Structure/Further Syntax/include.adoc @@ -67,4 +67,4 @@ prog_uint16_t myConstants[] PROGMEM = {0, 21140, 702 , 9128, 0, 25764, 8456, -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Constants/floatingPointConstants.adoc b/Language/Variables/Constants/floatingPointConstants.adoc index 01af89e6c..b595af718 100644 --- a/Language/Variables/Constants/floatingPointConstants.adoc +++ b/Language/Variables/Constants/floatingPointConstants.adoc @@ -77,4 +77,4 @@ Floating point constants can also be expressed in a variety of scientific notati [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Conversion/byteCast.adoc b/Language/Variables/Conversion/byteCast.adoc index 1b6eb6e9d..15ca5bdea 100644 --- a/Language/Variables/Conversion/byteCast.adoc +++ b/Language/Variables/Conversion/byteCast.adoc @@ -50,4 +50,4 @@ Converts a value to the link:../../data-types/byte[byte] data type. * #LANGUAGE# link:../../data-types/byte[byte] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Conversion/charCast.adoc b/Language/Variables/Conversion/charCast.adoc index 6c2d8e791..9b59805e6 100644 --- a/Language/Variables/Conversion/charCast.adoc +++ b/Language/Variables/Conversion/charCast.adoc @@ -50,4 +50,4 @@ Converts a value to the link:../../data-types/char[char] data type. * #LANGUAGE# link:../../data-types/char[char] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Conversion/floatCast.adoc b/Language/Variables/Conversion/floatCast.adoc index 9b0da90cb..bc0b30a32 100644 --- a/Language/Variables/Conversion/floatCast.adoc +++ b/Language/Variables/Conversion/floatCast.adoc @@ -66,4 +66,4 @@ See the reference for link:../../data-types/float[float] for details about the p * #LANGUAGE# link:../../data-types/float[float] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Conversion/intCast.adoc b/Language/Variables/Conversion/intCast.adoc index a087cb6a2..cf28b4a1e 100644 --- a/Language/Variables/Conversion/intCast.adoc +++ b/Language/Variables/Conversion/intCast.adoc @@ -52,4 +52,4 @@ Converts a value to the link:../../data-types/int[int] data type. -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Conversion/longCast.adoc b/Language/Variables/Conversion/longCast.adoc index 05749fd89..6ef310760 100644 --- a/Language/Variables/Conversion/longCast.adoc +++ b/Language/Variables/Conversion/longCast.adoc @@ -52,4 +52,4 @@ Converts a value to the link:../../data-types/long[long] data type. -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Conversion/wordcast.adoc b/Language/Variables/Conversion/wordcast.adoc index 19cff9667..cf1ac3ba4 100644 --- a/Language/Variables/Conversion/wordcast.adoc +++ b/Language/Variables/Conversion/wordcast.adoc @@ -55,4 +55,4 @@ Converts a value to the link:../../data-types/word[word] data type. -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/c_str.adoc b/Language/Variables/Data Types/String/Functions/c_str.adoc index e8193ce51..7392dd719 100644 --- a/Language/Variables/Data Types/String/Functions/c_str.adoc +++ b/Language/Variables/Data Types/String/Functions/c_str.adoc @@ -52,4 +52,4 @@ A pointer to the C-style version of the invoking String. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/compareTo.adoc b/Language/Variables/Data Types/String/Functions/compareTo.adoc index 52681d0a8..8aec0e84e 100644 --- a/Language/Variables/Data Types/String/Functions/compareTo.adoc +++ b/Language/Variables/Data Types/String/Functions/compareTo.adoc @@ -59,4 +59,4 @@ Compares two Strings, testing whether one comes before or after the other, or wh [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/concat.adoc b/Language/Variables/Data Types/String/Functions/concat.adoc index 865626f78..1720ec61d 100644 --- a/Language/Variables/Data Types/String/Functions/concat.adoc +++ b/Language/Variables/Data Types/String/Functions/concat.adoc @@ -56,4 +56,4 @@ Appends the parameter to a String. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/endsWith.adoc b/Language/Variables/Data Types/String/Functions/endsWith.adoc index cc3a17ed5..2028ddfb0 100644 --- a/Language/Variables/Data Types/String/Functions/endsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/endsWith.adoc @@ -57,4 +57,4 @@ Tests whether or not a String ends with the characters of another String. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/equals.adoc b/Language/Variables/Data Types/String/Functions/equals.adoc index 3f404645e..80cdc4521 100644 --- a/Language/Variables/Data Types/String/Functions/equals.adoc +++ b/Language/Variables/Data Types/String/Functions/equals.adoc @@ -54,4 +54,4 @@ Compares two Strings for equality. The comparison is case-sensitive, meaning the [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/indexOf.adoc b/Language/Variables/Data Types/String/Functions/indexOf.adoc index addfccc87..c6fad44da 100644 --- a/Language/Variables/Data Types/String/Functions/indexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/indexOf.adoc @@ -58,4 +58,4 @@ The index of val within the String, or -1 if not found. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc index 42755d854..ce5357e45 100644 --- a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc @@ -58,4 +58,4 @@ The index of val within the String, or -1 if not found. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/length.adoc b/Language/Variables/Data Types/String/Functions/length.adoc index cba495102..0933adefe 100644 --- a/Language/Variables/Data Types/String/Functions/length.adoc +++ b/Language/Variables/Data Types/String/Functions/length.adoc @@ -53,4 +53,4 @@ The length of the String in characters. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/setCharAt.adoc b/Language/Variables/Data Types/String/Functions/setCharAt.adoc index b56bda940..abd4e751d 100644 --- a/Language/Variables/Data Types/String/Functions/setCharAt.adoc +++ b/Language/Variables/Data Types/String/Functions/setCharAt.adoc @@ -57,4 +57,4 @@ None [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/startsWith.adoc b/Language/Variables/Data Types/String/Functions/startsWith.adoc index 305eb2225..91a48add4 100644 --- a/Language/Variables/Data Types/String/Functions/startsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/startsWith.adoc @@ -54,4 +54,4 @@ Tests whether or not a String starts with the characters of another String. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/substring.adoc b/Language/Variables/Data Types/String/Functions/substring.adoc index 446fc7e78..a66b3abdf 100644 --- a/Language/Variables/Data Types/String/Functions/substring.adoc +++ b/Language/Variables/Data Types/String/Functions/substring.adoc @@ -58,4 +58,4 @@ The substring. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/concatenation.adoc b/Language/Variables/Data Types/String/Operators/concatenation.adoc index 9e29d792f..d49c383da 100644 --- a/Language/Variables/Data Types/String/Operators/concatenation.adoc +++ b/Language/Variables/Data Types/String/Operators/concatenation.adoc @@ -57,4 +57,4 @@ new String that is the combination of the original two Strings. [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/byte.adoc b/Language/Variables/Data Types/byte.adoc index 83114ff7f..d37f4aa8a 100644 --- a/Language/Variables/Data Types/byte.adoc +++ b/Language/Variables/Data Types/byte.adoc @@ -44,4 +44,4 @@ A byte stores an 8-bit unsigned number, from 0 to 255. * #LANGUAGE# link:../../conversion/bytecast[byte()] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/char.adoc b/Language/Variables/Data Types/char.adoc index 04616ad92..f50ab5ecd 100644 --- a/Language/Variables/Data Types/char.adoc +++ b/Language/Variables/Data Types/char.adoc @@ -60,4 +60,4 @@ The char datatype is a signed type, meaning that it encodes numbers from -128 to * #LANGUAGE# link:../../../functions/communication/serial/println[Serial.println] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/double.adoc b/Language/Variables/Data Types/double.adoc index 25be32baa..872f3f829 100644 --- a/Language/Variables/Data Types/double.adoc +++ b/Language/Variables/Data Types/double.adoc @@ -52,4 +52,4 @@ Users who borrow code from other sources that includes double variables may wish === See also -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/float.adoc b/Language/Variables/Data Types/float.adoc index bbb91a30f..96bc01496 100644 --- a/Language/Variables/Data Types/float.adoc +++ b/Language/Variables/Data Types/float.adoc @@ -80,4 +80,4 @@ If doing math with floats, you need to add a decimal point, otherwise it will be [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/short.adoc b/Language/Variables/Data Types/short.adoc index fb18aacc2..21a52407a 100644 --- a/Language/Variables/Data Types/short.adoc +++ b/Language/Variables/Data Types/short.adoc @@ -63,4 +63,4 @@ On all Arduinos (ATMega and ARM based) a short stores a 16-bit (2-byte) value. T * #LANGUAGE# link:../../constants/integerconstants[Integer Constants] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/unsignedChar.adoc b/Language/Variables/Data Types/unsignedChar.adoc index 1f2ccbc96..b3148cb86 100644 --- a/Language/Variables/Data Types/unsignedChar.adoc +++ b/Language/Variables/Data Types/unsignedChar.adoc @@ -59,4 +59,4 @@ unsigned char myChar = 240; * #LANGUAGE# link:../../../functions/communication/serial/println[Serial.println] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/unsignedLong.adoc b/Language/Variables/Data Types/unsignedLong.adoc index 9cccdf9e1..7e8cf1165 100644 --- a/Language/Variables/Data Types/unsignedLong.adoc +++ b/Language/Variables/Data Types/unsignedLong.adoc @@ -79,4 +79,4 @@ void loop() * #LANGUAGE# link:../../constants/integerconstants[Integer Constants] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/void.adoc b/Language/Variables/Data Types/void.adoc index 6ab03f354..b462fcb1c 100644 --- a/Language/Variables/Data Types/void.adoc +++ b/Language/Variables/Data Types/void.adoc @@ -67,4 +67,4 @@ void loop() * #LANGUAGE# link:../../constants/integerconstants[Integer Constants] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Variable Scope & Qualifiers/const.adoc b/Language/Variables/Variable Scope & Qualifiers/const.adoc index a10d78221..da2861783 100644 --- a/Language/Variables/Variable Scope & Qualifiers/const.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/const.adoc @@ -74,4 +74,4 @@ You can use either `const` or `#define` for creating numeric or string constants * #LANGUAGE# link:../../../structure/further-syntax/define[#define] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS From 45dd2520fc06ad18dd9fb2dc1835875f11d5d33f Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 21 Feb 2019 22:09:54 -0800 Subject: [PATCH 006/298] Remove the term "Built-in" from the String tutorials link text I don't think the average Language Reference user will be familiar with the term "Built-in" (it's the term for the example sketches bundled with the Arduino IDE) so I think this could cause confusion. It doesn't really add anything of value to the link text so there's no reason for it to be there. --- Language/Variables/Data Types/String/Functions/c_str.adoc | 2 +- Language/Variables/Data Types/String/Functions/charAt.adoc | 2 +- Language/Variables/Data Types/String/Functions/compareTo.adoc | 2 +- Language/Variables/Data Types/String/Functions/concat.adoc | 2 +- Language/Variables/Data Types/String/Functions/endsWith.adoc | 2 +- Language/Variables/Data Types/String/Functions/equals.adoc | 2 +- .../Variables/Data Types/String/Functions/equalsIgnoreCase.adoc | 2 +- Language/Variables/Data Types/String/Functions/getBytes.adoc | 2 +- Language/Variables/Data Types/String/Functions/indexOf.adoc | 2 +- Language/Variables/Data Types/String/Functions/lastIndexOf.adoc | 2 +- Language/Variables/Data Types/String/Functions/length.adoc | 2 +- Language/Variables/Data Types/String/Functions/remove.adoc | 2 +- Language/Variables/Data Types/String/Functions/replace.adoc | 2 +- Language/Variables/Data Types/String/Functions/reserve.adoc | 2 +- Language/Variables/Data Types/String/Functions/setCharAt.adoc | 2 +- Language/Variables/Data Types/String/Functions/startsWith.adoc | 2 +- Language/Variables/Data Types/String/Functions/substring.adoc | 2 +- Language/Variables/Data Types/String/Functions/toCharArray.adoc | 2 +- Language/Variables/Data Types/String/Functions/toDouble.adoc | 2 +- Language/Variables/Data Types/String/Functions/toFloat.adoc | 2 +- Language/Variables/Data Types/String/Functions/toInt.adoc | 2 +- Language/Variables/Data Types/String/Functions/toLowerCase.adoc | 2 +- Language/Variables/Data Types/String/Functions/toUpperCase.adoc | 2 +- Language/Variables/Data Types/String/Functions/trim.adoc | 2 +- Language/Variables/Data Types/String/Operators/append.adoc | 2 +- Language/Variables/Data Types/String/Operators/comparison.adoc | 2 +- .../Variables/Data Types/String/Operators/concatenation.adoc | 2 +- .../Variables/Data Types/String/Operators/differentFrom.adoc | 2 +- .../Variables/Data Types/String/Operators/elementAccess.adoc | 2 +- Language/Variables/Data Types/String/Operators/greaterThan.adoc | 2 +- .../Data Types/String/Operators/greaterThanOrEqualTo.adoc | 2 +- Language/Variables/Data Types/String/Operators/lessThan.adoc | 2 +- .../Data Types/String/Operators/lessThanOrEqualTo.adoc | 2 +- Language/Variables/Data Types/stringObject.adoc | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Language/Variables/Data Types/String/Functions/c_str.adoc b/Language/Variables/Data Types/String/Functions/c_str.adoc index e8193ce51..edd99be26 100644 --- a/Language/Variables/Data Types/String/Functions/c_str.adoc +++ b/Language/Variables/Data Types/String/Functions/c_str.adoc @@ -50,6 +50,6 @@ A pointer to the C-style version of the invoking String. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/charAt.adoc b/Language/Variables/Data Types/String/Functions/charAt.adoc index b4d334d69..39edc7eba 100644 --- a/Language/Variables/Data Types/String/Functions/charAt.adoc +++ b/Language/Variables/Data Types/String/Functions/charAt.adoc @@ -53,6 +53,6 @@ The n'th character of the String. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/compareTo.adoc b/Language/Variables/Data Types/String/Functions/compareTo.adoc index 52681d0a8..351edfc6a 100644 --- a/Language/Variables/Data Types/String/Functions/compareTo.adoc +++ b/Language/Variables/Data Types/String/Functions/compareTo.adoc @@ -57,6 +57,6 @@ Compares two Strings, testing whether one comes before or after the other, or wh === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/concat.adoc b/Language/Variables/Data Types/String/Functions/concat.adoc index 865626f78..7c665f427 100644 --- a/Language/Variables/Data Types/String/Functions/concat.adoc +++ b/Language/Variables/Data Types/String/Functions/concat.adoc @@ -54,6 +54,6 @@ Appends the parameter to a String. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/endsWith.adoc b/Language/Variables/Data Types/String/Functions/endsWith.adoc index cc3a17ed5..40c8b54a5 100644 --- a/Language/Variables/Data Types/String/Functions/endsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/endsWith.adoc @@ -55,6 +55,6 @@ Tests whether or not a String ends with the characters of another String. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/equals.adoc b/Language/Variables/Data Types/String/Functions/equals.adoc index 3f404645e..797e9ee23 100644 --- a/Language/Variables/Data Types/String/Functions/equals.adoc +++ b/Language/Variables/Data Types/String/Functions/equals.adoc @@ -52,6 +52,6 @@ Compares two Strings for equality. The comparison is case-sensitive, meaning the === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc b/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc index 782d13ce9..544f97ed8 100644 --- a/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc +++ b/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc @@ -52,6 +52,6 @@ Compares two Strings for equality. The comparison is not case-sensitive, meaning === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/getBytes.adoc b/Language/Variables/Data Types/String/Functions/getBytes.adoc index 22876e885..6ae711607 100644 --- a/Language/Variables/Data Types/String/Functions/getBytes.adoc +++ b/Language/Variables/Data Types/String/Functions/getBytes.adoc @@ -54,6 +54,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/indexOf.adoc b/Language/Variables/Data Types/String/Functions/indexOf.adoc index addfccc87..5a1b88a63 100644 --- a/Language/Variables/Data Types/String/Functions/indexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/indexOf.adoc @@ -56,6 +56,6 @@ The index of val within the String, or -1 if not found. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc index 42755d854..93d51c872 100644 --- a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc @@ -56,6 +56,6 @@ The index of val within the String, or -1 if not found. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/length.adoc b/Language/Variables/Data Types/String/Functions/length.adoc index cba495102..83227aaeb 100644 --- a/Language/Variables/Data Types/String/Functions/length.adoc +++ b/Language/Variables/Data Types/String/Functions/length.adoc @@ -51,6 +51,6 @@ The length of the String in characters. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/remove.adoc b/Language/Variables/Data Types/String/Functions/remove.adoc index 657502ba2..a90e25708 100644 --- a/Language/Variables/Data Types/String/Functions/remove.adoc +++ b/Language/Variables/Data Types/String/Functions/remove.adoc @@ -69,6 +69,6 @@ greeting.remove(2, 2); // greeting now contains "heo" === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/replace.adoc b/Language/Variables/Data Types/String/Functions/replace.adoc index ec5bdddba..c4617685e 100644 --- a/Language/Variables/Data Types/String/Functions/replace.adoc +++ b/Language/Variables/Data Types/String/Functions/replace.adoc @@ -55,6 +55,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/reserve.adoc b/Language/Variables/Data Types/String/Functions/reserve.adoc index 763bfdf16..a7ada643f 100644 --- a/Language/Variables/Data Types/String/Functions/reserve.adoc +++ b/Language/Variables/Data Types/String/Functions/reserve.adoc @@ -81,6 +81,6 @@ void loop() { === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/setCharAt.adoc b/Language/Variables/Data Types/String/Functions/setCharAt.adoc index b56bda940..849e23375 100644 --- a/Language/Variables/Data Types/String/Functions/setCharAt.adoc +++ b/Language/Variables/Data Types/String/Functions/setCharAt.adoc @@ -55,6 +55,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/startsWith.adoc b/Language/Variables/Data Types/String/Functions/startsWith.adoc index 305eb2225..13dc1071e 100644 --- a/Language/Variables/Data Types/String/Functions/startsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/startsWith.adoc @@ -52,6 +52,6 @@ Tests whether or not a String starts with the characters of another String. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/substring.adoc b/Language/Variables/Data Types/String/Functions/substring.adoc index 446fc7e78..3341576d6 100644 --- a/Language/Variables/Data Types/String/Functions/substring.adoc +++ b/Language/Variables/Data Types/String/Functions/substring.adoc @@ -56,6 +56,6 @@ The substring. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Functions/toCharArray.adoc b/Language/Variables/Data Types/String/Functions/toCharArray.adoc index dd6be8bce..2d09464a7 100644 --- a/Language/Variables/Data Types/String/Functions/toCharArray.adoc +++ b/Language/Variables/Data Types/String/Functions/toCharArray.adoc @@ -54,6 +54,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toDouble.adoc b/Language/Variables/Data Types/String/Functions/toDouble.adoc index f20d85a94..617585a88 100644 --- a/Language/Variables/Data Types/String/Functions/toDouble.adoc +++ b/Language/Variables/Data Types/String/Functions/toDouble.adoc @@ -53,6 +53,6 @@ If no valid conversion could be performed because the String doesn't start with === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toFloat.adoc b/Language/Variables/Data Types/String/Functions/toFloat.adoc index 85a406ad3..d67b5bcff 100644 --- a/Language/Variables/Data Types/String/Functions/toFloat.adoc +++ b/Language/Variables/Data Types/String/Functions/toFloat.adoc @@ -53,6 +53,6 @@ If no valid conversion could be performed because the String doesn't start with === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toInt.adoc b/Language/Variables/Data Types/String/Functions/toInt.adoc index 4608cd7cb..a8e283ea8 100644 --- a/Language/Variables/Data Types/String/Functions/toInt.adoc +++ b/Language/Variables/Data Types/String/Functions/toInt.adoc @@ -53,6 +53,6 @@ If no valid conversion could be performed because the String doesn't start with === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc index 3b8aafde2..1a1ff2649 100644 --- a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc @@ -51,6 +51,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc index 73303b1af..6216bd200 100644 --- a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc @@ -50,6 +50,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/trim.adoc b/Language/Variables/Data Types/String/Functions/trim.adoc index 829c9d9bc..0e1afd4d0 100644 --- a/Language/Variables/Data Types/String/Functions/trim.adoc +++ b/Language/Variables/Data Types/String/Functions/trim.adoc @@ -51,6 +51,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/append.adoc b/Language/Variables/Data Types/String/Operators/append.adoc index 04b750387..be267c431 100644 --- a/Language/Variables/Data Types/String/Operators/append.adoc +++ b/Language/Variables/Data Types/String/Operators/append.adoc @@ -55,6 +55,6 @@ None === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/comparison.adoc b/Language/Variables/Data Types/String/Operators/comparison.adoc index 4b2ff8a25..441efb2d2 100644 --- a/Language/Variables/Data Types/String/Operators/comparison.adoc +++ b/Language/Variables/Data Types/String/Operators/comparison.adoc @@ -53,6 +53,6 @@ myString1 == myString2 === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/concatenation.adoc b/Language/Variables/Data Types/String/Operators/concatenation.adoc index 9e29d792f..27b94088f 100644 --- a/Language/Variables/Data Types/String/Operators/concatenation.adoc +++ b/Language/Variables/Data Types/String/Operators/concatenation.adoc @@ -55,6 +55,6 @@ new String that is the combination of the original two Strings. === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Data Types/String/Operators/differentFrom.adoc b/Language/Variables/Data Types/String/Operators/differentFrom.adoc index e7b7417fb..2bfb6f5a4 100644 --- a/Language/Variables/Data Types/String/Operators/differentFrom.adoc +++ b/Language/Variables/Data Types/String/Operators/differentFrom.adoc @@ -57,6 +57,6 @@ myString1 != myString2 === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/elementAccess.adoc b/Language/Variables/Data Types/String/Operators/elementAccess.adoc index 715adbb18..31c491b58 100644 --- a/Language/Variables/Data Types/String/Operators/elementAccess.adoc +++ b/Language/Variables/Data Types/String/Operators/elementAccess.adoc @@ -59,6 +59,6 @@ The nth char of the String. Same as charAt(). === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/greaterThan.adoc b/Language/Variables/Data Types/String/Operators/greaterThan.adoc index ac31aed42..526da157c 100644 --- a/Language/Variables/Data Types/String/Operators/greaterThan.adoc +++ b/Language/Variables/Data Types/String/Operators/greaterThan.adoc @@ -58,6 +58,6 @@ myString1 > myString2 === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc b/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc index 26af43233..d83e415ac 100644 --- a/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc +++ b/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc @@ -54,6 +54,6 @@ myString1 >= myString2 === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/lessThan.adoc b/Language/Variables/Data Types/String/Operators/lessThan.adoc index b45c76657..75eda2455 100644 --- a/Language/Variables/Data Types/String/Operators/lessThan.adoc +++ b/Language/Variables/Data Types/String/Operators/lessThan.adoc @@ -53,6 +53,6 @@ myString1 < myString2 === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc b/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc index e41c0d720..20e24c3d1 100644 --- a/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc +++ b/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc @@ -59,6 +59,6 @@ myString1 <= myString2 === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/stringObject.adoc b/Language/Variables/Data Types/stringObject.adoc index edcaba803..bafbe4b05 100644 --- a/Language/Variables/Data Types/stringObject.adoc +++ b/Language/Variables/Data Types/stringObject.adoc @@ -140,7 +140,7 @@ String stringOne = String(5.698, 3); // using a float and the d * #LANGUAGE# link:../string/operators/differentfrom[!= (different from)] [role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] // SEE ALSO SECTION STARTS From be2738f14ba268605402aa63bee86eaecc7527a8 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 21 Feb 2019 22:22:11 -0800 Subject: [PATCH 007/298] Use consistent link text for digital/analog pins tutorial links There was wide variation in the link text used to refer to these pages. I made the text consistent with the majority of the existing content. --- Language/Functions/Analog IO/analogRead.adoc | 2 +- Language/Functions/Analog IO/analogReference.adoc | 2 +- Language/Functions/Digital IO/digitalRead.adoc | 2 +- Language/Functions/Digital IO/digitalWrite.adoc | 2 +- Language/Functions/Digital IO/pinMode.adoc | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Language/Functions/Analog IO/analogRead.adoc b/Language/Functions/Analog IO/analogRead.adoc index 3e4692d33..3bf2ab431 100644 --- a/Language/Functions/Analog IO/analogRead.adoc +++ b/Language/Functions/Analog IO/analogRead.adoc @@ -97,6 +97,6 @@ If the analog input pin is not connected to anything, the value returned by anal [role="language"] * #LANGUAGE# link:../../zero-due-mkr-family/analogreadresolution[analogReadResolution()] -* #LANGUAGE# https://www.arduino.cc/en/Tutorial/AnalogInputPins[Tutorial: Analog Input Pins^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/AnalogInputPins[Description of the analog input pins^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index 3211ec909..ba1199b2b 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -87,7 +87,7 @@ Alternatively, you can connect the external reference voltage to the AREF pin th === See also [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/AnalogInputPins[Description of analog input pins^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/AnalogInputPins[Description of the analog input pins^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Digital IO/digitalRead.adoc b/Language/Functions/Digital IO/digitalRead.adoc index 8126be878..111aa058e 100644 --- a/Language/Functions/Digital IO/digitalRead.adoc +++ b/Language/Functions/Digital IO/digitalRead.adoc @@ -85,7 +85,7 @@ The analog input pins can be used as digital pins, referred to as A0, A1, etc. T === See also [role="example"] -* #EXAMPLE# Tutorial: (http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins]) +* #EXAMPLE# http://arduino.cc/en/Tutorial/DigitalPins[Description of the digital pins^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Digital IO/digitalWrite.adoc b/Language/Functions/Digital IO/digitalWrite.adoc index 7c89ba0d2..e982ea8e7 100644 --- a/Language/Functions/Digital IO/digitalWrite.adoc +++ b/Language/Functions/Digital IO/digitalWrite.adoc @@ -89,7 +89,7 @@ The analog input pins can be used as digital pins, referred to as A0, A1, etc. T === See also [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/DigitalPins[Tutorial: Digital Pins^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/DigitalPins[Description of the digital pins^] -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Digital IO/pinMode.adoc b/Language/Functions/Digital IO/pinMode.adoc index ee7c50fc5..2e66ed1df 100644 --- a/Language/Functions/Digital IO/pinMode.adoc +++ b/Language/Functions/Digital IO/pinMode.adoc @@ -17,7 +17,7 @@ subCategories: [ "Digital I/O" ] [float] === Description -Configures the specified pin to behave either as an input or an output. See the description of (http://arduino.cc/en/Tutorial/DigitalPins[digital pins]) for details on the functionality of the pins. +Configures the specified pin to behave either as an input or an output. See the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins] page for details on the functionality of the pins. [%hardbreaks] As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly disables the internal pullups. [%hardbreaks] @@ -31,7 +31,7 @@ As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with === Parameters `pin`: the number of the pin whose mode you wish to set -`mode`: `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. (see the (http://arduino.cc/en/Tutorial/DigitalPins[digital pins]) page for a more complete description of the functionality.) +`mode`: `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. (see the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins] page for a more complete description of the functionality.) //Check how to add links @@ -84,7 +84,7 @@ The analog input pins can be used as digital pins, referred to as A0, A1, etc. === See also [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/DigitalPins[Description of the pins on an Arduino board^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/DigitalPins[Description of the digital pins^] -- // SEE ALSO SECTION ENDS From 70ad13fca9e903ff386ebc1f874641c5d9dc6783 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 25 Feb 2019 19:16:33 -0800 Subject: [PATCH 008/298] Add example code for bitWrite --- .../Functions/Bits and Bytes/bitWrite.adoc | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Language/Functions/Bits and Bytes/bitWrite.adoc b/Language/Functions/Bits and Bytes/bitWrite.adoc index ed37ba66b..80a0ac708 100644 --- a/Language/Functions/Bits and Bytes/bitWrite.adoc +++ b/Language/Functions/Bits and Bytes/bitWrite.adoc @@ -42,6 +42,32 @@ Nothing // OVERVIEW SECTION ENDS +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +Demonstrates the use of bitWrite by printing the value of a variable to the Serial Monitor before and after the use of `bitWrite()`. + + +[source,arduino] +void setup() { + Serial.begin(9600); + while (!Serial) {} // wait for serial port to connect. Needed for native USB port only + byte x = 0b10000000; // the 0b prefix indicates a binary constant + Serial.println(x, BIN); // 10000000 + bitWrite(x, 0, 1); // write 1 to the least significant bit of x + Serial.println(x, BIN); // 10000001 +} + +void loop() {} +---- +[%hardbreaks] +-- +// HOW TO USE SECTION ENDS + + // SEE ALSO SECTION [#see_also] -- From 38056a2f77c22a43c1c22ce055ad5e146818a4b5 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 22 Feb 2019 00:05:05 -0800 Subject: [PATCH 009/298] Update links to tone tutorials The tone tutorial links use outdated URLs that must redirect to the current URLs. It's better to point the links directly to the correct URL. --- Language/Functions/Advanced IO/tone.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index c3f248f48..b50bcdaea 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -77,10 +77,10 @@ If you want to play different pitches on multiple pins, you need to call `noTone * #LANGUAGE# link:../../analog-io/analogwrite[analogWrite()] [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone[Tone^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/toneMelody[Tone^] * #EXAMPLE# http://arduino.cc/en/Tutorial/tonePitchFollower[Pitch follower^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone3[Simple Keyboard^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone4[multiple tones^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/toneKeyboard[Simple Keyboard^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/toneMultiple[multiple tones^] * #EXAMPLE# http://arduino.cc/en/Tutorial/PWM[PWM^] -- From 76216bdd1a534fd5b3b64518ea4a8c1010dd1c13 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 22 Feb 2019 00:13:33 -0800 Subject: [PATCH 010/298] Standardize link text I'm following the example of the Tutorials page in how to format the link text for the tutorial links --- Language/Functions/Advanced IO/tone.adoc | 8 ++++---- Language/Functions/Communication/Serial/serialEvent.adoc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index c3f248f48..af77b23d6 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -77,10 +77,10 @@ If you want to play different pitches on multiple pins, you need to call `noTone * #LANGUAGE# link:../../analog-io/analogwrite[analogWrite()] [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone[Tone^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/tonePitchFollower[Pitch follower^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone3[Simple Keyboard^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone4[multiple tones^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone[Tone Melody^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/tonePitchFollower[Pitch Follower^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone3[Tone Keyboard^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone4[Tone Multiple^] * #EXAMPLE# http://arduino.cc/en/Tutorial/PWM[PWM^] -- diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index 07221af74..79cbf9903 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -80,7 +80,7 @@ Nothing === See also [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/SerialEvent[SerialEvent Tutorial^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/SerialEvent[Serial Event Tutorial^] [role="language"] * #LANGUAGE# link:../begin[begin()] From ba674fae837ab7219537906dc37c1d784c74d93b Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Sat, 30 Mar 2019 14:18:02 +1100 Subject: [PATCH 011/298] Inline link to Blink Without Delay sketch I couldn't find the link immediately to the sketch sited below (because below it's listed as an example), so I just inlined the sketch. And then I inlined and summarized the idea of the sketch, too. --- Language/Functions/Time/delay.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/delay.adoc b/Language/Functions/Time/delay.adoc index e24178867..631eecbdb 100644 --- a/Language/Functions/Time/delay.adoc +++ b/Language/Functions/Time/delay.adoc @@ -68,7 +68,7 @@ void loop() { [float] === Notes and Warnings -While it is easy to create a blinking LED with the `delay()` function, and many sketches use short delays for such tasks as switch debouncing, the use of `delay()` in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the link:../millis[millis()] function and the sketch sited below. More knowledgeable programmers usually avoid the use of `delay()` for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple. +While it is easy to create a blinking LED with the `delay()` function, and many sketches use short delays for such tasks as switch debouncing, the use of `delay()` in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the link:http://arduino.cc/en/Tutorial/BlinkWithoutDelay[Blink Without Delay] sketch, which loops, polling the link:../millis[millis()] function until enough time has elapsed. More knowledgeable programmers usually avoid the use of `delay()` for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple. Certain things do go on while the delay() function is controlling the Atmega chip however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (link:../../analog-io/analogwrite[analogWrite]) values and pin states are maintained, and link:../../external-interrupts/attachinterrupt[interrupts] will work as they should. From 0c93b4e26538c8ee2c64c07511a0aa019c21b390 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 21 Feb 2019 21:55:03 -0800 Subject: [PATCH 012/298] Be consistent with the use of "Tutorial" in link text These two tutorial links are no different from the many other example links on the other reference pages, yet they have the word "Tutorial" added, contrary to the standard established in the reference samples. There are some other instances of the use of "Tutorial" in the link text, but in those cases the link does lead to more of a general tutorial than a standard tutorial for an example sketch, so I have left those as is. --- Language/Functions/Communication/Serial/serialEvent.adoc | 2 +- Language/Structure/Control Structure/while.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index f29c817db..76fe73419 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -80,7 +80,7 @@ Nothing === See also [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/SerialEvent[Serial Event Tutorial^] +* #EXAMPLE# http://arduino.cc/en/Tutorial/SerialEvent[Serial Event^] [role="language"] * #LANGUAGE# link:../begin[begin()] diff --git a/Language/Structure/Control Structure/while.adoc b/Language/Structure/Control Structure/while.adoc index a7cdcd9e4..93bdc4831 100644 --- a/Language/Structure/Control Structure/while.adoc +++ b/Language/Structure/Control Structure/while.adoc @@ -67,7 +67,7 @@ while (var < 200) { [role="language"] [role="example"] -* #EXAMPLE# https://arduino.cc/en/Tutorial/WhileLoop[While Loop Tutorial^] +* #EXAMPLE# https://arduino.cc/en/Tutorial/WhileLoop[While Loop^] -- // SEE ALSO SECTION ENDS From 4824795640db89dc09fc3c85ac40bd4841bf6571 Mon Sep 17 00:00:00 2001 From: HansM Date: Thu, 18 Apr 2019 22:19:23 +0200 Subject: [PATCH 013/298] Fixed broken link and spelling in streamParseFloat.adoc. --- Language/Functions/Communication/Stream/streamParseFloat.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Stream/streamParseFloat.adoc b/Language/Functions/Communication/Stream/streamParseFloat.adoc index 239a19a98..3e9439f3c 100644 --- a/Language/Functions/Communication/Stream/streamParseFloat.adoc +++ b/Language/Functions/Communication/Stream/streamParseFloat.adoc @@ -14,9 +14,9 @@ title: Stream.parseFloat() [float] === Description -`parseFloat()` returns the first valid floating point number from the current position. Initial characters that are not digits (or the minus sign) are skipped. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see ../streamsettimeout[Stream.setTimeout()]). +`parseFloat()` returns the first valid floating point number from the current position. Initial characters that are not digits (or the minus sign) are skipped. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../streamsettimeout[Stream.setTimeout()]). -This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more informatio +This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more information. [%hardbreaks] From 1be9921250e52d2d6bc355f7b2cdccd1d656e4bf Mon Sep 17 00:00:00 2001 From: HansM Date: Thu, 18 Apr 2019 22:27:25 +0200 Subject: [PATCH 014/298] Fixes broken link and code highlighting in streamFindUntil.adoc. Fixes https://github.com/arduino/reference-en/issues/584. --- Language/Functions/Communication/Stream/streamFindUntil.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Stream/streamFindUntil.adoc b/Language/Functions/Communication/Stream/streamFindUntil.adoc index 5977f7ae7..71607eb84 100644 --- a/Language/Functions/Communication/Stream/streamFindUntil.adoc +++ b/Language/Functions/Communication/Stream/streamFindUntil.adoc @@ -14,9 +14,9 @@ title: Stream.findUntil() [float] === Description -`findUntil()` reads data from the stream until the target string of given length or terminator string is found, or it times out (see ../streamsettimeout[Stream.setTimeout()]). +`findUntil()` reads data from the stream until the target string of given length or terminator string is found, or it times out (see link:../streamsettimeout[Stream.setTimeout()]). -The function returns true if target string is found, false if timed out +The function returns `true` if target string is found, `false` if timed out. This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more information. [%hardbreaks] From abfdfb9353609775d427d5a9f989ae42ea2073cc Mon Sep 17 00:00:00 2001 From: HansM Date: Fri, 19 Apr 2019 00:12:29 +0200 Subject: [PATCH 015/298] Fixes broken link and code highlighting in streamFind.adoc --- Language/Functions/Communication/Stream/streamFind.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Communication/Stream/streamFind.adoc b/Language/Functions/Communication/Stream/streamFind.adoc index 4e83d6478..b6d41fddc 100644 --- a/Language/Functions/Communication/Stream/streamFind.adoc +++ b/Language/Functions/Communication/Stream/streamFind.adoc @@ -14,7 +14,7 @@ title: Stream.find() [float] === Description -`find()` reads data from the stream until the target is found. The function returns true if target is found, false if timed out (see ../streamsettimeout[Stream.setTimeout()]). +`find()` reads data from the stream until the target is found. The function returns true if target is found, false if timed out (see link:../streamsettimeout[Stream.setTimeout()]). This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[stream class] main page for more information. [%hardbreaks] @@ -30,9 +30,9 @@ This function is part of the Stream class, and can be called by any class that i === Parameters `stream` : an instance of a class that inherits from Stream. -`target` : the string to search for (char) +`target` : the string to search for (`char`) -`length` : length of the target (size_t) +`length` : length of the target (`size_t`) [float] === Returns From c92d1eee4ba5a30aba20a4da72bcf847443323b6 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 29 Apr 2019 07:33:43 -0700 Subject: [PATCH 016/298] Correct syntax section of parseInt() reference pages Both the Stream.parseInt() and Serial.parseInt() reference pages had erroneous information in their syntax documentation. Reference: https://github.com/arduino/ArduinoCore-API/blob/1.0.0/api/Stream.h#L86 --- .../Communication/Serial/parseInt.adoc | 12 +++++++++--- .../Communication/Stream/streamParseInt.adoc | 17 ++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Language/Functions/Communication/Serial/parseInt.adoc b/Language/Functions/Communication/Serial/parseInt.adoc index 2286ca5ca..f4598dc64 100644 --- a/Language/Functions/Communication/Serial/parseInt.adoc +++ b/Language/Functions/Communication/Serial/parseInt.adoc @@ -21,7 +21,6 @@ Looks for the next valid integer in the incoming serial. The function terminates In particular: -* Initial characters that are not digits or a minus sign, are skipped; + * Parsing stops when no characters have been read for a configurable time-out value, or a non-digit is read; + * If no valid digits were read when the time-out (see Serial.setTimeout()) occurs, 0 is returned; [%hardbreaks] @@ -30,13 +29,20 @@ In particular: [float] === Syntax `_Serial_.parseInt()` + -`_Serial_.parseInt(char skipChar)` +`_Serial_.parseInt(lookahead)` + +`_Serial_.parseInt(lookahead, ignore)` [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + -`skipChar`: used to skip the indicated char in the search. Used for example to skip thousands divider. +`lookahead`: the mode used to look ahead in the stream for an integer. Allowed data types: `LookaheadMode`. Allowed `lookahead` values: + +* `SKIP_ALL`: all characters other than digits or a minus sign are ignored when scanning the stream for an integer. This is the default mode. +* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid. +* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped. + +`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamParseInt.adoc b/Language/Functions/Communication/Stream/streamParseInt.adoc index 018a362e0..05c89d155 100644 --- a/Language/Functions/Communication/Stream/streamParseInt.adoc +++ b/Language/Functions/Communication/Stream/streamParseInt.adoc @@ -14,11 +14,10 @@ title: Stream.parseInt() [float] === Description -`parseInt()` returns the first valid (long) integer number from the current position. Initial characters that are not integers (or the minus sign) are skipped. +`parseInt()` returns the first valid (long) integer number from the current position. In particular: -* Initial characters that are not digits or a minus sign, are skipped; + * Parsing stops when no characters have been read for a configurable time-out value, or a non-digit is read; + * If no valid digits were read when the time-out (see link:../streamsettimeout[Stream.setTimeout()]) occurs, 0 is returned; @@ -28,17 +27,21 @@ This function is part of the Stream class, and can be called by any class that i [float] === Syntax -`stream.parseInt(list)` +`stream.parseInt()` + +`stream.parseInt(lookahead)` + +`stream.parseInt(lookahead, ignore)` -`stream.parseInt(''list', char skipchar')` [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream` : an instance of a class that inherits from Stream. + +`lookahead`: the mode used to look ahead in the stream for an integer. Allowed data types: `LookaheadMode`. Allowed `lookahead` values: -`list` : the stream to check for ints (`char`) +* `SKIP_ALL`: all characters other than digits or a minus sign are ignored when scanning the stream for an integer. This is the default mode. +* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid. +* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped. -`skipChar`: used to skip the indicated char in the search. Used for example to skip thousands divider. +`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` [float] === Returns From f1926841bc694474e65cefd02f0ca265fcac1d1d Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 29 Apr 2019 08:04:43 -0700 Subject: [PATCH 017/298] Correct syntax section of parseFloat() reference pages Both the Stream.parseFloat() and Serial.parseFloat() reference pages had erroneous information in their syntax documentation. Reference: https://github.com/arduino/ArduinoCore-API/blob/1.0.0/api/Stream.h#L93 --- .../Communication/Serial/parseFloat.adoc | 15 ++++++++++++--- .../Communication/Stream/streamParseFloat.adoc | 15 +++++++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Language/Functions/Communication/Serial/parseFloat.adoc b/Language/Functions/Communication/Serial/parseFloat.adoc index cf6d4444d..b454ed222 100644 --- a/Language/Functions/Communication/Serial/parseFloat.adoc +++ b/Language/Functions/Communication/Serial/parseFloat.adoc @@ -14,7 +14,7 @@ title: Serial.parseFloat() [float] === Description -`Serial.parseFloat()` returns the first valid floating point number from the Serial buffer. Characters that are not digits (or the minus sign) are skipped. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../settimeout[Serial.setTimeout()]). +`Serial.parseFloat()` returns the first valid floating point number from the Serial buffer. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../settimeout[Serial.setTimeout()]). `Serial.parseFloat()` inherits from the link:../../stream[Stream] utility class. [%hardbreaks] @@ -22,12 +22,21 @@ title: Serial.parseFloat() [float] === Syntax -`_Serial_.parseFloat()` +`_Serial_.parseFloat()` + +`_Serial_.parseFloat(lookahead)` + +`_Serial_.parseFloat(lookahead, ignore)` [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`lookahead`: the mode used to look ahead in the stream for a floating point number. Allowed data types: `LookaheadMode`. Allowed `lookahead` values: + +* `SKIP_ALL`: all characters other than a minus sign, decimal point, or digits are ignored when scanning the stream for a floating point number. This is the default mode. +* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid. +* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped. + +`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamParseFloat.adoc b/Language/Functions/Communication/Stream/streamParseFloat.adoc index 3e9439f3c..2356720ff 100644 --- a/Language/Functions/Communication/Stream/streamParseFloat.adoc +++ b/Language/Functions/Communication/Stream/streamParseFloat.adoc @@ -14,7 +14,7 @@ title: Stream.parseFloat() [float] === Description -`parseFloat()` returns the first valid floating point number from the current position. Initial characters that are not digits (or the minus sign) are skipped. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../streamsettimeout[Stream.setTimeout()]). +`parseFloat()` returns the first valid floating point number from the current position. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../streamsettimeout[Stream.setTimeout()]). This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more information. [%hardbreaks] @@ -22,14 +22,21 @@ This function is part of the Stream class, and can be called by any class that i [float] === Syntax -`stream.parseFloat(list)` +`stream.parseFloat()` + +`stream.parseFloat(lookahead)` + +`stream.parseFloat(lookahead, ignore)` [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream` : an instance of a class that inherits from Stream. + +`lookahead`: the mode used to look ahead in the stream for a floating point number. Allowed data types: `LookaheadMode`. Allowed `lookahead` values: -`list` : the stream to check for floats (`char`) +* `SKIP_ALL`: all characters other than a minus sign, decimal point, or digits are ignored when scanning the stream for a floating point number. This is the default mode. +* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid. +* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped. + +`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` [float] === Returns From cd9723fde0fa81fc8dc037a46a22650bc243c870 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 2 May 2019 22:30:19 -0700 Subject: [PATCH 018/298] Fix markup of bitWrite() example --- Language/Functions/Bits and Bytes/bitWrite.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/Language/Functions/Bits and Bytes/bitWrite.adoc b/Language/Functions/Bits and Bytes/bitWrite.adoc index 80a0ac708..37efcc198 100644 --- a/Language/Functions/Bits and Bytes/bitWrite.adoc +++ b/Language/Functions/Bits and Bytes/bitWrite.adoc @@ -52,6 +52,7 @@ Demonstrates the use of bitWrite by printing the value of a variable to the Seri [source,arduino] +---- void setup() { Serial.begin(9600); while (!Serial) {} // wait for serial port to connect. Needed for native USB port only From a5b437ad84f06569e5281a734eca2a6b8389b2b2 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 21 Feb 2019 04:47:02 -0800 Subject: [PATCH 019/298] Use standard format for Syntax, Parameters, and Returns sections I have faithfully followed the standard established by the reference sample. The exception is in documenting the return type, since the reference sample does not provide any guidance on this subject. In this, I attempted to be consistent with the standard established for documenting parameter types ("Allowed data types:" for parameters, "Data type:" for return type). --- Language/Functions/Advanced IO/pulseIn.adoc | 12 ++++++------ .../Functions/Advanced IO/pulseInLong.adoc | 12 ++++++------ Language/Functions/Advanced IO/shiftIn.adoc | 10 ++++------ Language/Functions/Advanced IO/shiftOut.adoc | 11 ++++------- Language/Functions/Advanced IO/tone.adoc | 13 +++++-------- Language/Functions/Analog IO/analogRead.adoc | 6 +++--- .../Functions/Analog IO/analogReference.adoc | 1 + Language/Functions/Analog IO/analogWrite.adoc | 4 ++-- Language/Functions/Bits and Bytes/bit.adoc | 1 + .../Functions/Bits and Bytes/bitClear.adoc | 4 ++-- .../Functions/Bits and Bytes/bitRead.adoc | 7 +++---- Language/Functions/Bits and Bytes/bitSet.adoc | 4 ++-- .../Functions/Bits and Bytes/bitWrite.adoc | 7 +++---- .../Functions/Bits and Bytes/highByte.adoc | 3 ++- .../Functions/Bits and Bytes/lowByte.adoc | 4 +++- Language/Functions/Characters/isAlpha.adoc | 9 ++++----- .../Functions/Characters/isAlphaNumeric.adoc | 9 ++++----- Language/Functions/Characters/isAscii.adoc | 9 ++++----- Language/Functions/Characters/isControl.adoc | 9 ++++----- Language/Functions/Characters/isDigit.adoc | 9 ++++----- Language/Functions/Characters/isGraph.adoc | 8 +++----- .../Characters/isHexadecimalDigit.adoc | 9 +++------ .../Functions/Characters/isLowerCase.adoc | 9 ++++----- .../Functions/Characters/isPrintable.adoc | 9 ++++----- Language/Functions/Characters/isPunct.adoc | 9 ++++----- Language/Functions/Characters/isSpace.adoc | 9 ++++----- .../Functions/Characters/isUpperCase.adoc | 9 ++++----- .../Functions/Characters/isWhitespace.adoc | 6 +++--- .../Communication/Serial/available.adoc | 5 ++++- .../Serial/availableForWrite.adoc | 2 ++ .../Functions/Communication/Serial/begin.adoc | 13 +++++-------- .../Functions/Communication/Serial/end.adoc | 1 + .../Functions/Communication/Serial/find.adoc | 10 +++++----- .../Communication/Serial/findUntil.adoc | 7 ++++--- .../Functions/Communication/Serial/flush.adoc | 1 + .../Communication/Serial/getTimeout.adoc | 4 +++- .../Communication/Serial/ifSerial.adoc | 6 ++++-- .../Communication/Serial/parseFloat.adoc | 3 ++- .../Communication/Serial/parseInt.adoc | 3 ++- .../Functions/Communication/Serial/peek.adoc | 3 ++- .../Functions/Communication/Serial/print.adoc | 5 +++-- .../Communication/Serial/println.adoc | 10 +++++----- .../Functions/Communication/Serial/read.adoc | 3 ++- .../Communication/Serial/readBytes.adoc | 9 ++++----- .../Communication/Serial/readBytesUntil.adoc | 12 +++++------- .../Communication/Serial/readString.adoc | 3 ++- .../Communication/Serial/readStringUntil.adoc | 5 +++-- .../Communication/Serial/serialEvent.adoc | 2 ++ .../Communication/Serial/setTimeout.adoc | 4 +++- .../Functions/Communication/Serial/write.adoc | 17 ++++++----------- .../Communication/Stream/streamAvailable.adoc | 5 +++-- .../Communication/Stream/streamFind.adoc | 9 ++++----- .../Communication/Stream/streamFindUntil.adoc | 9 ++++----- .../Communication/Stream/streamFlush.adoc | 3 ++- .../Stream/streamGetTimeout.adoc | 3 ++- .../Stream/streamParseFloat.adoc | 3 ++- .../Communication/Stream/streamParseInt.adoc | 3 ++- .../Communication/Stream/streamPeek.adoc | 3 ++- .../Communication/Stream/streamRead.adoc | 3 ++- .../Communication/Stream/streamReadBytes.adoc | 9 ++++----- .../Stream/streamReadBytesUntil.adoc | 10 ++++------ .../Stream/streamReadString.adoc | 3 ++- .../Stream/streamReadStringUntil.adoc | 4 ++-- .../Stream/streamSetTimeout.adoc | 5 +++-- .../Functions/Digital IO/digitalRead.adoc | 1 + .../Functions/Digital IO/digitalWrite.adoc | 4 ++-- Language/Functions/Digital IO/pinMode.adoc | 7 +++---- .../External Interrupts/attachInterrupt.adoc | 11 ++++++----- .../External Interrupts/detachInterrupt.adoc | 5 +++-- Language/Functions/Interrupts/interrupts.adoc | 3 ++- .../Functions/Interrupts/noInterrupts.adoc | 3 ++- Language/Functions/Math/abs.adoc | 5 +++-- Language/Functions/Math/constrain.adoc | 15 +++++++-------- Language/Functions/Math/map.adoc | 13 +++++-------- Language/Functions/Math/max.adoc | 5 +++-- Language/Functions/Math/min.adoc | 4 ++-- Language/Functions/Math/pow.adoc | 11 ++++++++--- Language/Functions/Math/sq.adoc | 5 +++-- Language/Functions/Math/sqrt.adoc | 5 +++-- Language/Functions/Random Numbers/random.adoc | 6 +++--- .../Functions/Random Numbers/randomSeed.adoc | 7 +++++-- Language/Functions/Time/delay.adoc | 3 ++- .../Functions/Time/delayMicroseconds.adoc | 3 ++- Language/Functions/Time/micros.adoc | 5 +++-- Language/Functions/Time/millis.adoc | 3 ++- Language/Functions/Trigonometry/cos.adoc | 5 +++-- Language/Functions/Trigonometry/sin.adoc | 5 +++-- Language/Functions/Trigonometry/tan.adoc | 5 +++-- .../Functions/USB/Keyboard/keyboardBegin.adoc | 3 ++- .../Functions/USB/Keyboard/keyboardEnd.adoc | 3 ++- .../Functions/USB/Keyboard/keyboardPress.adoc | 7 ++++--- .../Functions/USB/Keyboard/keyboardPrint.adoc | 7 +++++-- .../USB/Keyboard/keyboardPrintln.adoc | 7 ++++--- .../USB/Keyboard/keyboardRelease.adoc | 5 +++-- .../USB/Keyboard/keyboardReleaseAll.adoc | 3 ++- .../Functions/USB/Keyboard/keyboardWrite.adoc | 5 +++-- Language/Functions/USB/Mouse/mouseBegin.adoc | 3 ++- Language/Functions/USB/Mouse/mouseClick.adoc | 3 ++- Language/Functions/USB/Mouse/mouseEnd.adoc | 3 ++- .../Functions/USB/Mouse/mouseIsPressed.adoc | 7 +++---- Language/Functions/USB/Mouse/mouseMove.adoc | 8 ++++---- Language/Functions/USB/Mouse/mousePress.adoc | 5 ++--- .../Functions/USB/Mouse/mouseRelease.adoc | 10 +++++----- .../analogReadResolution.adoc | 1 + .../analogWriteResolution.adoc | 1 + .../Arithmetic Operators/addition.adoc | 13 +++++-------- .../Arithmetic Operators/division.adoc | 13 +++++-------- .../Arithmetic Operators/multiplication.adoc | 13 +++++-------- .../Arithmetic Operators/remainder.adoc | 12 ++++-------- .../Arithmetic Operators/subtraction.adoc | 13 +++++-------- .../Bitwise Operators/bitshiftLeft.adoc | 10 ++++------ .../Bitwise Operators/bitshiftRight.adoc | 10 ++++------ .../Comparison Operators/equalTo.adoc | 10 ++++------ .../Comparison Operators/greaterThan.adoc | 10 ++++------ .../greaterThanOrEqualTo.adoc | 10 ++++------ .../Comparison Operators/lessThan.adoc | 10 ++++------ .../lessThanOrEqualTo.adoc | 10 ++++------ .../Comparison Operators/notEqualTo.adoc | 10 ++++------ .../Compound Operators/compoundAddition.adoc | 10 ++++------ .../compoundBitwiseAnd.adoc | 10 ++++------ .../Compound Operators/compoundBitwiseOr.adoc | 10 ++++------ .../compoundBitwiseXor.adoc | 10 ++++------ .../Compound Operators/compoundDivision.adoc | 10 ++++------ .../compoundMultiplication.adoc | 10 ++++------ .../Compound Operators/compoundRemainder.adoc | 10 ++++------ .../compoundSubtraction.adoc | 10 ++++------ .../Compound Operators/decrement.adoc | 11 +++++------ .../Compound Operators/increment.adoc | 10 ++++------ .../Structure/Control Structure/doWhile.adoc | 6 +++++- .../Structure/Control Structure/else.adoc | 1 + Language/Structure/Control Structure/for.adoc | 8 ++++++-- Language/Structure/Control Structure/if.adoc | 13 ++++++++++++- .../Structure/Control Structure/return.adoc | 10 +++------- .../Control Structure/switchCase.adoc | 5 +++-- .../Structure/Control Structure/while.adoc | 6 +++++- Language/Structure/Further Syntax/define.adoc | 13 +++++++------ Language/Variables/Conversion/byteCast.adoc | 5 +++-- Language/Variables/Conversion/charCast.adoc | 5 +++-- Language/Variables/Conversion/floatCast.adoc | 5 +++-- Language/Variables/Conversion/intCast.adoc | 5 +++-- Language/Variables/Conversion/longCast.adoc | 5 +++-- Language/Variables/Conversion/wordcast.adoc | 9 +++++---- .../Data Types/String/Functions/c_str.adoc | 4 +++- .../Data Types/String/Functions/charAt.adoc | 6 +++--- .../String/Functions/compareTo.adoc | 13 ++++++------- .../Data Types/String/Functions/concat.adoc | 8 ++++---- .../Data Types/String/Functions/endsWith.adoc | 11 +++++------ .../Data Types/String/Functions/equals.adoc | 7 ++++--- .../String/Functions/equalsIgnoreCase.adoc | 8 +++++--- .../Data Types/String/Functions/getBytes.adoc | 10 +++++----- .../Data Types/String/Functions/indexOf.adoc | 8 ++++---- .../String/Functions/lastIndexOf.adoc | 9 ++++----- .../Data Types/String/Functions/length.adoc | 3 ++- .../Data Types/String/Functions/remove.adoc | 11 +++++------ .../Data Types/String/Functions/replace.adoc | 13 ++++++------- .../Data Types/String/Functions/reserve.adoc | 9 +++++---- .../String/Functions/setCharAt.adoc | 11 +++++------ .../String/Functions/startsWith.adoc | 7 ++++--- .../String/Functions/substring.adoc | 9 ++++----- .../String/Functions/toCharArray.adoc | 10 +++++----- .../Data Types/String/Functions/toDouble.adoc | 7 +++---- .../Data Types/String/Functions/toFloat.adoc | 7 +++---- .../Data Types/String/Functions/toInt.adoc | 7 +++---- .../String/Functions/toLowerCase.adoc | 5 +++-- .../String/Functions/toUpperCase.adoc | 5 +++-- .../Data Types/String/Functions/trim.adoc | 5 +++-- .../Data Types/String/Operators/append.adoc | 11 +++++------ .../String/Operators/comparison.adoc | 15 +++++++-------- .../String/Operators/concatenation.adoc | 13 +++++++------ .../String/Operators/differentFrom.adoc | 15 +++++++-------- .../String/Operators/elementAccess.adoc | 13 +++++-------- .../String/Operators/greaterThan.adoc | 15 +++++++-------- .../Operators/greaterThanOrEqualTo.adoc | 13 ++++++------- .../Data Types/String/Operators/lessThan.adoc | 14 +++++++------- .../String/Operators/lessThanOrEqualTo.adoc | 15 +++++++-------- Language/Variables/Data Types/bool.adoc | 4 ++-- Language/Variables/Data Types/byte.adoc | 4 ++-- Language/Variables/Data Types/char.adoc | 4 ++-- Language/Variables/Data Types/double.adoc | 4 ++-- Language/Variables/Data Types/float.adoc | 5 ++--- Language/Variables/Data Types/int.adoc | 5 +++-- Language/Variables/Data Types/long.adoc | 7 +++---- Language/Variables/Data Types/short.adoc | 5 +++-- Language/Variables/Data Types/size_t.adoc | 4 ++-- .../Variables/Data Types/stringObject.adoc | 19 +++++++++---------- .../Variables/Data Types/unsignedChar.adoc | 4 ++-- .../Variables/Data Types/unsignedInt.adoc | 13 +++++++++---- .../Variables/Data Types/unsignedLong.adoc | 7 +++---- Language/Variables/Data Types/word.adoc | 4 ++-- Language/Variables/Utilities/PROGMEM.adoc | 17 ++++++++--------- Language/Variables/Utilities/sizeof.adoc | 5 +++-- 191 files changed, 701 insertions(+), 700 deletions(-) diff --git a/Language/Functions/Advanced IO/pulseIn.adoc b/Language/Functions/Advanced IO/pulseIn.adoc index b2ec352bc..6fbebd607 100644 --- a/Language/Functions/Advanced IO/pulseIn.adoc +++ b/Language/Functions/Advanced IO/pulseIn.adoc @@ -25,20 +25,20 @@ The timing of this function has been determined empirically and will probably sh [float] === Syntax -`pulseIn(pin, value)` - +`pulseIn(pin, value)` + `pulseIn(pin, value, timeout)` + [float] === Parameters -`pin`: the number of the pin on which you want to read the pulse. (int) +`pin`: the number of the pin on which you want to read the pulse. Allowed data types: `int`. + +`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. Allowed data types: `int`. + +`timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. -`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. (int) -`timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long) [float] === Returns -the length of the pulse (in microseconds) or 0 if no pulse started before the timeout (unsigned long) +The length of the pulse (in microseconds) or 0 if no pulse started before the timeout. Data type: `unsigned long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Advanced IO/pulseInLong.adoc b/Language/Functions/Advanced IO/pulseInLong.adoc index 2b93677c6..9d948f197 100644 --- a/Language/Functions/Advanced IO/pulseInLong.adoc +++ b/Language/Functions/Advanced IO/pulseInLong.adoc @@ -27,20 +27,20 @@ The timing of this function has been determined empirically and will probably sh [float] === Syntax -`pulseInLong(pin, value)` - +`pulseInLong(pin, value)` + `pulseInLong(pin, value, timeout)` + [float] === Parameters -`pin`: the number of the pin on which you want to read the pulse. (int) +`pin`: the number of the pin on which you want to read the pulse. Allowed data types: `int`. + +`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. Allowed data types: `int`. + +`timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. -`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. (int) -`timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long) [float] === Returns -the length of the pulse (in microseconds) or 0 if no pulse started before the timeout (unsigned long) +The length of the pulse (in microseconds) or 0 if no pulse started before the timeout. Data type: `unsigned long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Advanced IO/shiftIn.adoc b/Language/Functions/Advanced IO/shiftIn.adoc index c5131887e..83929a746 100644 --- a/Language/Functions/Advanced IO/shiftIn.adoc +++ b/Language/Functions/Advanced IO/shiftIn.adoc @@ -32,16 +32,14 @@ Note: this is a software implementation; Arduino also provides an link:https://w [float] === Parameters -`dataPin`: the pin on which to input each bit (int) +`dataPin`: the pin on which to input each bit. Allowed data types: `int`. + +`clockPin`: the pin to toggle to signal a read from *dataPin*. + +`bitOrder`: which order to shift in the bits; either *MSBFIRST* or *LSBFIRST*. (Most Significant Bit First, or, Least Significant Bit First). -`clockPin`: the pin to toggle to signal a read from *dataPin* - -`bitOrder`: which order to shift in the bits; either *MSBFIRST* or *LSBFIRST*. -(Most Significant Bit First, or, Least Significant Bit First) [float] === Returns -the value read (byte) +The value read. Data type: `byte`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Advanced IO/shiftOut.adoc b/Language/Functions/Advanced IO/shiftOut.adoc index f1b62f76e..57d9fec25 100644 --- a/Language/Functions/Advanced IO/shiftOut.adoc +++ b/Language/Functions/Advanced IO/shiftOut.adoc @@ -28,14 +28,11 @@ This is a software implementation; see also the https://www.arduino.cc/en/Refere [float] === Parameters -`dataPin`: the pin on which to output each bit (int) +`dataPin`: the pin on which to output each bit. Allowed data types: `int`. + +`clockPin`: the pin to toggle once the dataPin has been set to the correct value. Allowed data types: `int`. + +`bitOrder`: which order to shift out the bits; either MSBFIRST or LSBFIRST. (Most Significant Bit First, or, Least Significant Bit First). + +`value`: the data to shift out. Allowed data types: `byte`. -`clockPin`: the pin to toggle once the dataPin has been set to the correct value (int) - -`bitOrder`: which order to shift out the bits; either MSBFIRST or LSBFIRST. -(Most Significant Bit First, or, Least Significant Bit First) - -`value`: the data to shift out. (byte) [float] === Returns diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 819632cbb..ef986a3f6 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -29,19 +29,16 @@ It is not possible to generate tones lower than 31Hz. For technical details, see [float] === Syntax -`tone(pin, frequency)` - +`tone(pin, frequency)` + `tone(pin, frequency, duration)` -[%hardbreaks] + [float] === Parameters -`pin`: the pin on which to generate the tone +`pin`: the pin on which to generate the tone. + +`frequency`: the frequency of the tone in hertz. Allowed data types: `unsigned int`. + +`duration`: the duration of the tone in milliseconds (optional). Allowed data types: `unsigned long`. -`frequency`: the frequency of the tone in hertz - `unsigned int` - -`duration`: the duration of the tone in milliseconds (optional) - `unsigned long` -[%hardbreaks] [float] === Returns diff --git a/Language/Functions/Analog IO/analogRead.adoc b/Language/Functions/Analog IO/analogRead.adoc index 6fb4765b5..8a6ae8e2d 100644 --- a/Language/Functions/Analog IO/analogRead.adoc +++ b/Language/Functions/Analog IO/analogRead.adoc @@ -38,17 +38,17 @@ On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 microseconds [float] === Syntax - `analogRead(pin)` + [float] === Parameters `pin`: the name of the analog input pin to read from (A0 to A5 on most boards, A0 to A6 on MKR boards, A0 to A7 on the Mini and Nano, A0 to A15 on the Mega). + [float] === Returns - -The analog reading on the pin (int). Although it is limited to the resolution of the analog to digital converter (0-1023 for 10 bits or 0-4095 for 12 bits). +The analog reading on the pin. Although it is limited to the resolution of the analog to digital converter (0-1023 for 10 bits or 0-4095 for 12 bits). Data type: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index ba1199b2b..2ae7c6b7a 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -52,6 +52,7 @@ Arduino SAM Boards (Due) === Parameters `type`: which type of reference to use (see list of options in the description). + [float] === Returns Nothing diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 7e334b6f1..6aee6cb59 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -33,8 +33,8 @@ The `analogWrite` function has nothing to do with the analog pins or the `analog [float] === Parameters -`pin`: the pin to write to. Allowed data types: int. + -`value`: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: int +`pin`: the pin to write to. Allowed data types: `int`. + +`value`: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: `int`. [float] diff --git a/Language/Functions/Bits and Bytes/bit.adoc b/Language/Functions/Bits and Bytes/bit.adoc index 73f8e1d6f..7b4636411 100644 --- a/Language/Functions/Bits and Bytes/bit.adoc +++ b/Language/Functions/Bits and Bytes/bit.adoc @@ -30,6 +30,7 @@ Computes the value of the specified bit (bit 0 is 1, bit 1 is 2, bit 2 is 4, etc === Parameters `n`: the bit whose value to compute + [float] === Returns The value of the bit. diff --git a/Language/Functions/Bits and Bytes/bitClear.adoc b/Language/Functions/Bits and Bytes/bitClear.adoc index efce60852..c81e359fe 100644 --- a/Language/Functions/Bits and Bytes/bitClear.adoc +++ b/Language/Functions/Bits and Bytes/bitClear.adoc @@ -28,9 +28,9 @@ Clears (writes a 0 to) a bit of a numeric variable. [float] === Parameters -`x`: the numeric variable whose bit to clear +`x`: the numeric variable whose bit to clear. + +`n`: which bit to clear, starting at 0 for the least-significant (rightmost) bit. -`n`: which bit to clear, starting at 0 for the least-significant (rightmost) bit [float] === Returns diff --git a/Language/Functions/Bits and Bytes/bitRead.adoc b/Language/Functions/Bits and Bytes/bitRead.adoc index 00b5fb896..b6c324c15 100644 --- a/Language/Functions/Bits and Bytes/bitRead.adoc +++ b/Language/Functions/Bits and Bytes/bitRead.adoc @@ -28,14 +28,13 @@ Reads a bit of a number. [float] === Parameters -`x`: the number from which to read - -`n`: which bit to read, starting at 0 for the least-significant (rightmost) bit +`x`: the number from which to read. + +`n`: which bit to read, starting at 0 for the least-significant (rightmost) bit. [float] === Returns -the value of the bit (0 or 1). +The value of the bit (0 or 1). -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Bits and Bytes/bitSet.adoc b/Language/Functions/Bits and Bytes/bitSet.adoc index 5d910c29c..522de02e8 100644 --- a/Language/Functions/Bits and Bytes/bitSet.adoc +++ b/Language/Functions/Bits and Bytes/bitSet.adoc @@ -28,9 +28,9 @@ Sets (writes a 1 to) a bit of a numeric variable. [float] === Parameters -`x`: the numeric variable whose bit to set +`x`: the numeric variable whose bit to set. + +`n`: which bit to set, starting at 0 for the least-significant (rightmost) bit. -`n`: which bit to set, starting at 0 for the least-significant (rightmost) bit [float] === Returns diff --git a/Language/Functions/Bits and Bytes/bitWrite.adoc b/Language/Functions/Bits and Bytes/bitWrite.adoc index 80a0ac708..c0d027926 100644 --- a/Language/Functions/Bits and Bytes/bitWrite.adoc +++ b/Language/Functions/Bits and Bytes/bitWrite.adoc @@ -28,11 +28,10 @@ Writes a bit of a numeric variable. [float] === Parameters -`x`: the numeric variable to which to write +`x`: the numeric variable to which to write. + +`n`: which bit of the number to write, starting at 0 for the least-significant (rightmost) bit. + +`b`: the value to write to the bit (0 or 1). -`n`: which bit of the number to write, starting at 0 for the least-significant (rightmost) bit - -`b`: the value to write to the bit (0 or 1) [float] === Returns diff --git a/Language/Functions/Bits and Bytes/highByte.adoc b/Language/Functions/Bits and Bytes/highByte.adoc index a30945f09..74fc59123 100644 --- a/Language/Functions/Bits and Bytes/highByte.adoc +++ b/Language/Functions/Bits and Bytes/highByte.adoc @@ -30,9 +30,10 @@ Extracts the high-order (leftmost) byte of a word (or the second lowest byte of === Parameters `x`: a value of any type + [float] === Returns -byte +Data type: `byte`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Bits and Bytes/lowByte.adoc b/Language/Functions/Bits and Bytes/lowByte.adoc index 9055f6ac4..77c90a772 100644 --- a/Language/Functions/Bits and Bytes/lowByte.adoc +++ b/Language/Functions/Bits and Bytes/lowByte.adoc @@ -30,9 +30,11 @@ Extracts the low-order (rightmost) byte of a variable (e.g. a word). === Parameters `x`: a value of any type + [float] === Returns -byte +Data type: `byte`. + -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Characters/isAlpha.adoc b/Language/Functions/Characters/isAlpha.adoc index cf33bba24..e331e0e47 100644 --- a/Language/Functions/Characters/isAlpha.adoc +++ b/Language/Functions/Characters/isAlpha.adoc @@ -23,14 +23,13 @@ Analyse if a char is alpha (that is a letter). Returns true if thisChar contains [float] === Syntax -[source,arduino] ----- -isAlpha(thisChar) ----- +`isAlpha(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isAlphaNumeric.adoc b/Language/Functions/Characters/isAlphaNumeric.adoc index 79a2a0af4..257edd9fc 100644 --- a/Language/Functions/Characters/isAlphaNumeric.adoc +++ b/Language/Functions/Characters/isAlphaNumeric.adoc @@ -23,14 +23,13 @@ Analyse if a char is alphanumeric (that is a letter or a numbers). Returns true [float] === Syntax -[source,arduino] ----- -isAlphaNumeric(thisChar) ----- +`isAlphaNumeric(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isAscii.adoc b/Language/Functions/Characters/isAscii.adoc index 2631ae2db..3aad8d047 100644 --- a/Language/Functions/Characters/isAscii.adoc +++ b/Language/Functions/Characters/isAscii.adoc @@ -23,14 +23,13 @@ Analyse if a char is Ascii. Returns true if thisChar contains an Ascii character [float] === Syntax -[source,arduino] ----- -isAscii(thisChar) ----- +`isAscii(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isControl.adoc b/Language/Functions/Characters/isControl.adoc index 2b8bde222..dc032aa5b 100644 --- a/Language/Functions/Characters/isControl.adoc +++ b/Language/Functions/Characters/isControl.adoc @@ -23,14 +23,13 @@ Analyse if a char is a control character. Returns true if thisChar is a control [float] === Syntax -[source,arduino] ----- -isControl(thisChar) ----- +`isControl(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isDigit.adoc b/Language/Functions/Characters/isDigit.adoc index 6583d2ecd..c26892b1b 100644 --- a/Language/Functions/Characters/isDigit.adoc +++ b/Language/Functions/Characters/isDigit.adoc @@ -23,14 +23,13 @@ Analyse if a char is a digit (that is a number). Returns true if thisChar is a n [float] === Syntax -[source,arduino] ----- -isDigit(thisChar) ----- +`isDigit(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isGraph.adoc b/Language/Functions/Characters/isGraph.adoc index c09a1143c..237576e88 100644 --- a/Language/Functions/Characters/isGraph.adoc +++ b/Language/Functions/Characters/isGraph.adoc @@ -23,14 +23,12 @@ Analyse if a char is printable with some content (space is printable but has no [float] === Syntax -[source,arduino] ----- -isGraph(thisChar) ----- +`isGraph(thisChar)` [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isHexadecimalDigit.adoc b/Language/Functions/Characters/isHexadecimalDigit.adoc index be5a35310..e6e6b6026 100644 --- a/Language/Functions/Characters/isHexadecimalDigit.adoc +++ b/Language/Functions/Characters/isHexadecimalDigit.adoc @@ -23,16 +23,13 @@ Analyse if a char is an hexadecimal digit (A-F, 0-9). Returns true if thisChar c [float] === Syntax -[source,arduino] ----- +`isHexadecimalDigit(thisChar)` -isHexadecimalDigit(thisChar) - ----- [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isLowerCase.adoc b/Language/Functions/Characters/isLowerCase.adoc index e3ac4c633..8f27e712f 100644 --- a/Language/Functions/Characters/isLowerCase.adoc +++ b/Language/Functions/Characters/isLowerCase.adoc @@ -23,14 +23,13 @@ Analyse if a char is lower case (that is a letter in lower case). Returns true i [float] === Syntax -[source,arduino] ----- -isLowerCase(thisChar) ----- +`isLowerCase(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isPrintable.adoc b/Language/Functions/Characters/isPrintable.adoc index 8e416574e..ecea1307c 100644 --- a/Language/Functions/Characters/isPrintable.adoc +++ b/Language/Functions/Characters/isPrintable.adoc @@ -23,14 +23,13 @@ Analyse if a char is printable (that is any character that produces an output, e [float] === Syntax -[source,arduino] ----- -isPrintable(thisChar) ----- +`isPrintable(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isPunct.adoc b/Language/Functions/Characters/isPunct.adoc index c7f76c7c2..001fd7588 100644 --- a/Language/Functions/Characters/isPunct.adoc +++ b/Language/Functions/Characters/isPunct.adoc @@ -23,14 +23,13 @@ Analyse if a char is punctuation (that is a comma, a semicolon, an exlamation ma [float] === Syntax -[source,arduino] ----- -isPunct(thisChar) ----- +`isPunct(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isSpace.adoc b/Language/Functions/Characters/isSpace.adoc index fa6c8ab6b..2f4ff1824 100644 --- a/Language/Functions/Characters/isSpace.adoc +++ b/Language/Functions/Characters/isSpace.adoc @@ -23,14 +23,13 @@ Analyse if a char is the space character. Returns true if thisChar contains the [float] === Syntax -[source,arduino] ----- -isSpace(thisChar) ----- +`isSpace(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isUpperCase.adoc b/Language/Functions/Characters/isUpperCase.adoc index 36a36a46e..d03d3bacd 100644 --- a/Language/Functions/Characters/isUpperCase.adoc +++ b/Language/Functions/Characters/isUpperCase.adoc @@ -19,14 +19,13 @@ Analyse if a char is upper case (that is, a letter in upper case). Returns true [float] === Syntax -[source,arduino] ----- -isUpperCase(thisChar) ----- +`isUpperCase(thisChar)` + [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Characters/isWhitespace.adoc b/Language/Functions/Characters/isWhitespace.adoc index c8b31ac4f..365bd8094 100644 --- a/Language/Functions/Characters/isWhitespace.adoc +++ b/Language/Functions/Characters/isWhitespace.adoc @@ -24,13 +24,13 @@ Returns true if thisChar contains a white space. [float] === Syntax -[source,arduino] -isWhitespace(thisChar) +`isWhitespace(thisChar)` [float] === Parameters -`thisChar`: variable. *Allowed data types:* char +`thisChar`: variable. Allowed data types: `char`. + [float] === Returns diff --git a/Language/Functions/Communication/Serial/available.adoc b/Language/Functions/Communication/Serial/available.adoc index d6188e3a4..4c6d7a60f 100644 --- a/Language/Functions/Communication/Serial/available.adoc +++ b/Language/Functions/Communication/Serial/available.adoc @@ -21,13 +21,16 @@ Get the number of bytes (characters) available for reading from the serial port. === Syntax `_Serial_.available()` + [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + [float] === Returns -The number of bytes available to read . +The number of bytes available to read. + -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/availableForWrite.adoc b/Language/Functions/Communication/Serial/availableForWrite.adoc index 6b8e539c0..9989dfb66 100644 --- a/Language/Functions/Communication/Serial/availableForWrite.adoc +++ b/Language/Functions/Communication/Serial/availableForWrite.adoc @@ -27,9 +27,11 @@ Get the number of bytes (characters) available for writing in the serial buffer === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + [float] === Returns The number of bytes available to write. + -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/begin.adoc b/Language/Functions/Communication/Serial/begin.adoc index af09442ad..0033a91af 100644 --- a/Language/Functions/Communication/Serial/begin.adoc +++ b/Language/Functions/Communication/Serial/begin.adoc @@ -26,15 +26,11 @@ An optional second argument configures the data, parity, and stop bits. The defa `_Serial_.begin(speed, config)` - [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. - -`speed`: in bits per second (baud) - `long` - -`config`: sets data, parity, and stop bits. Valid values are - +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`speed`: in bits per second (baud). Allowed data types: `long`. + +`config`: sets data, parity, and stop bits. Valid values are: + `SERIAL_5N1` + `SERIAL_6N1` + `SERIAL_7N1` + @@ -58,7 +54,8 @@ An optional second argument configures the data, parity, and stop bits. The defa `SERIAL_5O2` + `SERIAL_6O2` + `SERIAL_7O2` + -`SERIAL_8O2` + +`SERIAL_8O2` + [float] === Returns diff --git a/Language/Functions/Communication/Serial/end.adoc b/Language/Functions/Communication/Serial/end.adoc index badd58458..b13b78ff5 100644 --- a/Language/Functions/Communication/Serial/end.adoc +++ b/Language/Functions/Communication/Serial/end.adoc @@ -27,6 +27,7 @@ Disables serial communication, allowing the RX and TX pins to be used for genera === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + [float] === Returns Nothing diff --git a/Language/Functions/Communication/Serial/find.adoc b/Language/Functions/Communication/Serial/find.adoc index 7684b1e63..e8e383f5d 100644 --- a/Language/Functions/Communication/Serial/find.adoc +++ b/Language/Functions/Communication/Serial/find.adoc @@ -25,17 +25,17 @@ Serial.find() inherits from the link:../../stream[stream] utility class. `_Serial_.find(target)` + `_Serial_.find(target, length)` + [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. - -`target` : the string to search for (char) +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`target`: the string to search for. Allowed data types: `char`. + +`length`: length of the target. Allowed data types: `size_t`. -`length` : length of the target (size_t) [float] === Returns -`bool` +Data type: `bool`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/findUntil.adoc b/Language/Functions/Communication/Serial/findUntil.adoc index 826253084..f19bfa6ef 100644 --- a/Language/Functions/Communication/Serial/findUntil.adoc +++ b/Language/Functions/Communication/Serial/findUntil.adoc @@ -30,12 +30,13 @@ The function returns true if the target string is found, false if it times out. [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + -`target` : the string to search for (char) + -`terminal` : the terminal string in the search (char) +`target`: the string to search for. Allowed data types: `char`. + +`terminal`: the terminal string in the search. Allowed data types: `char`. + [float] === Returns -`bool` +Data type: `bool`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/flush.adoc b/Language/Functions/Communication/Serial/flush.adoc index d5a077343..c3c6f43b8 100644 --- a/Language/Functions/Communication/Serial/flush.adoc +++ b/Language/Functions/Communication/Serial/flush.adoc @@ -29,6 +29,7 @@ Waits for the transmission of outgoing serial data to complete. (Prior to Arduin === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + [float] === Returns Nothing diff --git a/Language/Functions/Communication/Serial/getTimeout.adoc b/Language/Functions/Communication/Serial/getTimeout.adoc index 1d5d12c04..c900bd8ba 100644 --- a/Language/Functions/Communication/Serial/getTimeout.adoc +++ b/Language/Functions/Communication/Serial/getTimeout.adoc @@ -24,13 +24,15 @@ title: Serial.getTimeout() === Syntax `_Serial_.getTimeout()` + [float] === Parameters None + [float] === Returns -The timeout value set by `Serial.setTimeout()` (unsigned long) +The timeout value set by `Serial.setTimeout()`. Data type: `unsigned long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/ifSerial.adoc b/Language/Functions/Communication/Serial/ifSerial.adoc index aac44ba09..d5a0fa29f 100644 --- a/Language/Functions/Communication/Serial/ifSerial.adoc +++ b/Language/Functions/Communication/Serial/ifSerial.adoc @@ -26,13 +26,15 @@ This was introduced in Arduino IDE 1.0.1. === Syntax `if (Serial)` + [float] === Parameters -Nothing +None + [float] === Returns -`bool` : returns true if the specified serial port is available. This will only return false if querying the Leonardo's USB CDC serial connection before it is ready. +Returns true if the specified serial port is available. This will only return false if querying the Leonardo's USB CDC serial connection before it is ready. Data type: `bool`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/parseFloat.adoc b/Language/Functions/Communication/Serial/parseFloat.adoc index b454ed222..b9b0cde79 100644 --- a/Language/Functions/Communication/Serial/parseFloat.adoc +++ b/Language/Functions/Communication/Serial/parseFloat.adoc @@ -38,9 +38,10 @@ title: Serial.parseFloat() `ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` + [float] === Returns -`float` +Data type: `float`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/parseInt.adoc b/Language/Functions/Communication/Serial/parseInt.adoc index f4598dc64..962b48cbd 100644 --- a/Language/Functions/Communication/Serial/parseInt.adoc +++ b/Language/Functions/Communication/Serial/parseInt.adoc @@ -44,9 +44,10 @@ In particular: `ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` + [float] === Returns -`long` : the next valid integer +The next valid integer. Data type: `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/peek.adoc b/Language/Functions/Communication/Serial/peek.adoc index 35e37b565..7209996be 100644 --- a/Language/Functions/Communication/Serial/peek.adoc +++ b/Language/Functions/Communication/Serial/peek.adoc @@ -29,9 +29,10 @@ Returns the next byte (character) of incoming serial data without removing it fr === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + [float] === Returns -The first byte of incoming serial data available (or -1 if no data is available) - `int` +The first byte of incoming serial data available (or -1 if no data is available). Data type: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index 7c3b6258f..06844efc5 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -49,11 +49,12 @@ To send data without conversion to its representation as characters, use link:.. [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + -`val`: the value to print - any data type +`val`: the value to print. Allowed data types: any data type. + [float] === Returns -`size_t`: `print()` returns the number of bytes written, though reading that number is optional. +`print()` returns the number of bytes written, though reading that number is optional. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/println.adoc b/Language/Functions/Communication/Serial/println.adoc index b0deaf76c..15ef923c0 100644 --- a/Language/Functions/Communication/Serial/println.adoc +++ b/Language/Functions/Communication/Serial/println.adoc @@ -26,15 +26,15 @@ Prints data to the serial port as human-readable ASCII text followed by a carria [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`val`: the value to print. Allowed data types: any data type. + +`format`: specifies the number base (for integral data types) or number of decimal places (for floating point types). -`val`: the value to print - any data type - -`format`: specifies the number base (for integral data types) or number of decimal places (for floating point types) [float] === Returns -`size_t`: `println()` returns the number of bytes written, though reading that number is optional +`println()` returns the number of bytes written, though reading that number is optional. Data type: `size_t`. + -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/read.adoc b/Language/Functions/Communication/Serial/read.adoc index 4b0836ec2..2a781fc7e 100644 --- a/Language/Functions/Communication/Serial/read.adoc +++ b/Language/Functions/Communication/Serial/read.adoc @@ -29,9 +29,10 @@ Reads incoming serial data. === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + [float] === Returns -The first byte of incoming serial data available (or -1 if no data is available) - `int`. +The first byte of incoming serial data available (or -1 if no data is available). Data type: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/readBytes.adoc b/Language/Functions/Communication/Serial/readBytes.adoc index c69fdb689..ef2ccc739 100644 --- a/Language/Functions/Communication/Serial/readBytes.adoc +++ b/Language/Functions/Communication/Serial/readBytes.adoc @@ -29,15 +29,14 @@ title: Serial.readBytes() [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`buffer`: the buffer to store the bytes in. Allowed data types: or array of `char` or `byte`s. + +`length`: the number of bytes to read. Allowed data types: `int`. -`buffer`: the buffer to store the bytes in (`char[]` or `byte[]`) - -`length` : the number of bytes to read (`int`) [float] === Returns -The number of bytes placed in the buffer (`size_t`) +The number of bytes placed in the buffer. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index 097ec4089..103ea47d7 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -29,17 +29,15 @@ Serial.readBytesUntil() reads characters from the serial buffer into an array. T [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`character`: the character to search for. Allowed data types: `char`. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`s. + +`length`: the number of bytes to read. Allowed data types: `int`. -`character` : the character to search for (`char`) - -`buffer`: the buffer to store the bytes in (`char[]` or `byte[]`) - -`length` : the number of bytes to read (`int`) [float] === Returns -`size_t` +Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/readString.adoc b/Language/Functions/Communication/Serial/readString.adoc index 201e7f357..3e6822e2a 100644 --- a/Language/Functions/Communication/Serial/readString.adoc +++ b/Language/Functions/Communication/Serial/readString.adoc @@ -29,9 +29,10 @@ title: Serial.readString() === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + [float] === Returns -A String read from the serial buffer +A `String` read from the serial buffer -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/readStringUntil.adoc b/Language/Functions/Communication/Serial/readStringUntil.adoc index c56d8cfa2..53990e334 100644 --- a/Language/Functions/Communication/Serial/readStringUntil.adoc +++ b/Language/Functions/Communication/Serial/readStringUntil.adoc @@ -28,11 +28,12 @@ title: Serial.readStringUntil() [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + -`terminator` : the character to search for (`char`) +`terminator`: the character to search for. Allowed data types: `char`. + [float] === Returns -The entire String read from the serial buffer, up to the terminator character +The entire `String` read from the serial buffer, up to the terminator character -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index 76fe73419..e554fb882 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -43,10 +43,12 @@ void serialEvent3() { } ---- + [float] === Parameters `statements`: any valid statements + [float] === Returns Nothing diff --git a/Language/Functions/Communication/Serial/setTimeout.adoc b/Language/Functions/Communication/Serial/setTimeout.adoc index 80c27a70a..76e73dff1 100644 --- a/Language/Functions/Communication/Serial/setTimeout.adoc +++ b/Language/Functions/Communication/Serial/setTimeout.adoc @@ -24,10 +24,12 @@ title: Serial.setTimeout() === Syntax `_Serial_.setTimeout(time)` + [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + -`time` : timeout duration in milliseconds (`long`). +`time`: timeout duration in milliseconds. Allowed data types: `long`. + [float] === Returns diff --git a/Language/Functions/Communication/Serial/write.adoc b/Language/Functions/Communication/Serial/write.adoc index 7d391a540..494d2210b 100644 --- a/Language/Functions/Communication/Serial/write.adoc +++ b/Language/Functions/Communication/Serial/write.adoc @@ -24,21 +24,16 @@ Writes binary data to the serial port. This data is sent as a byte or series of [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`val`: a value to send as a single byte. + +`str`: a string to send as a series of bytes. + +`buf`: an array to send as a series of bytes. + +`len`: the number of bytes to be sent from the array. -`val`: a value to send as a single byte - -`str`: a string to send as a series of bytes - -`buf`: an array to send as a series of bytes - -`len`: the number of bytes to be sent from the array [float] === Returns -`size_t` - -`write()` will return the number of bytes written, though reading that number is optional +`write()` will return the number of bytes written, though reading that number is optional. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamAvailable.adoc b/Language/Functions/Communication/Stream/streamAvailable.adoc index e896bcaf6..867180620 100644 --- a/Language/Functions/Communication/Stream/streamAvailable.adoc +++ b/Language/Functions/Communication/Stream/streamAvailable.adoc @@ -26,11 +26,12 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + [float] === Returns -`int` : the number of bytes available to read +The number of bytes available to read. Data type: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamFind.adoc b/Language/Functions/Communication/Stream/streamFind.adoc index b6d41fddc..99c41c2b5 100644 --- a/Language/Functions/Communication/Stream/streamFind.adoc +++ b/Language/Functions/Communication/Stream/streamFind.adoc @@ -28,15 +28,14 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + +`target`: the string to search for. Allowed data types: `char`. + +`length`: length of the target. Allowed data types: `size_t`. -`target` : the string to search for (`char`) - -`length` : length of the target (`size_t`) [float] === Returns -`bool` +Data type: `bool`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamFindUntil.adoc b/Language/Functions/Communication/Stream/streamFindUntil.adoc index 71607eb84..a16f61f78 100644 --- a/Language/Functions/Communication/Stream/streamFindUntil.adoc +++ b/Language/Functions/Communication/Stream/streamFindUntil.adoc @@ -29,15 +29,14 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream +`stream`: an instance of a class that inherits from Stream. + +`target`: the string to search for. Allowed data types: `char`. + +`terminal`: the terminal string in the search. Allowed data types: `char`. -`target` : the string to search for (char) - -`terminal` : the terminal string in the search (char) [float] === Returns -`bool` +Data type: `bool`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamFlush.adoc b/Language/Functions/Communication/Stream/streamFlush.adoc index 4fcb80885..c37052a46 100644 --- a/Language/Functions/Communication/Stream/streamFlush.adoc +++ b/Language/Functions/Communication/Stream/streamFlush.adoc @@ -27,7 +27,8 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamGetTimeout.adoc b/Language/Functions/Communication/Stream/streamGetTimeout.adoc index 1b1434238..0323f6d53 100644 --- a/Language/Functions/Communication/Stream/streamGetTimeout.adoc +++ b/Language/Functions/Communication/Stream/streamGetTimeout.adoc @@ -27,9 +27,10 @@ title: Stream.getTimeout() === Parameters None + [float] === Returns -The timeout value set by `stream.setTimeout()` (unsigned long) +The timeout value set by `stream.setTimeout()`. Data type: `unsigned long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamParseFloat.adoc b/Language/Functions/Communication/Stream/streamParseFloat.adoc index 2356720ff..71fcd977a 100644 --- a/Language/Functions/Communication/Stream/streamParseFloat.adoc +++ b/Language/Functions/Communication/Stream/streamParseFloat.adoc @@ -38,9 +38,10 @@ This function is part of the Stream class, and can be called by any class that i `ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` + [float] === Returns -`float` +Data type: `float`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamParseInt.adoc b/Language/Functions/Communication/Stream/streamParseInt.adoc index 05c89d155..244148496 100644 --- a/Language/Functions/Communication/Stream/streamParseInt.adoc +++ b/Language/Functions/Communication/Stream/streamParseInt.adoc @@ -43,9 +43,10 @@ This function is part of the Stream class, and can be called by any class that i `ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char` + [float] === Returns -`long` +Data type: `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamPeek.adoc b/Language/Functions/Communication/Stream/streamPeek.adoc index 75a637a1d..1ed33a1bd 100644 --- a/Language/Functions/Communication/Stream/streamPeek.adoc +++ b/Language/Functions/Communication/Stream/streamPeek.adoc @@ -27,7 +27,8 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamRead.adoc b/Language/Functions/Communication/Stream/streamRead.adoc index 6d514fcea..6a932782b 100644 --- a/Language/Functions/Communication/Stream/streamRead.adoc +++ b/Language/Functions/Communication/Stream/streamRead.adoc @@ -27,7 +27,8 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamReadBytes.adoc b/Language/Functions/Communication/Stream/streamReadBytes.adoc index 99fc8cf6d..f519027d2 100644 --- a/Language/Functions/Communication/Stream/streamReadBytes.adoc +++ b/Language/Functions/Communication/Stream/streamReadBytes.adoc @@ -29,15 +29,14 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`s. + +`length`: the number of bytes to read. Allowed data types: `int`. -`buffer` : the buffer to store the bytes in (`char[]` or `byte[]`) - -`length` : the number of bytes to `read(int)` [float] === Returns -The number of bytes placed in the buffer (`size_t`) +The number of bytes placed in the buffer. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc b/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc index 8038d7ae2..fad3dfa5f 100644 --- a/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc @@ -29,13 +29,11 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + +`character`: the character to search for. Allowed data types: `char`. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`s. + +`length`: the number of bytes to read. Allowed data types: `int`. -`character` : the character to search for (`char`) - -`buffer`: the buffer to store the bytes in (`char[]` or `byte[]`) - -`length` : the number of bytes to `read(int)` [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamReadString.adoc b/Language/Functions/Communication/Stream/streamReadString.adoc index 0354d8ca1..b941ca660 100644 --- a/Language/Functions/Communication/Stream/streamReadString.adoc +++ b/Language/Functions/Communication/Stream/streamReadString.adoc @@ -27,7 +27,8 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream +`stream`: an instance of a class that inherits from Stream. + [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc index 2e4ce08ac..971337a49 100644 --- a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc @@ -27,9 +27,9 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters -`stream` : an instance of a class that inherits from Stream. +`stream`: an instance of a class that inherits from Stream. + +`terminator`: the character to search for. Allowed data types: `char`. -`terminator` : the character to search for (`char`) [float] === Returns diff --git a/Language/Functions/Communication/Stream/streamSetTimeout.adoc b/Language/Functions/Communication/Stream/streamSetTimeout.adoc index 71a662204..556a6494f 100644 --- a/Language/Functions/Communication/Stream/streamSetTimeout.adoc +++ b/Language/Functions/Communication/Stream/streamSetTimeout.adoc @@ -25,8 +25,9 @@ title: Stream.setTimeout() [float] === Parameters -`stream` : an instance of a class that inherits from Stream. -`time` : timeout duration in milliseconds (`long`). +`stream`: an instance of a class that inherits from Stream. + +`time`: timeout duration in milliseconds. Allowed data types: `long`. + [float] === Returns diff --git a/Language/Functions/Digital IO/digitalRead.adoc b/Language/Functions/Digital IO/digitalRead.adoc index 111aa058e..bedb99b3a 100644 --- a/Language/Functions/Digital IO/digitalRead.adoc +++ b/Language/Functions/Digital IO/digitalRead.adoc @@ -30,6 +30,7 @@ Reads the value from a specified digital pin, either `HIGH` or `LOW`. === Parameters `pin`: the number of the digital pin you want to read + [float] === Returns `HIGH` or `LOW` diff --git a/Language/Functions/Digital IO/digitalWrite.adoc b/Language/Functions/Digital IO/digitalWrite.adoc index e982ea8e7..9a3065dbc 100644 --- a/Language/Functions/Digital IO/digitalWrite.adoc +++ b/Language/Functions/Digital IO/digitalWrite.adoc @@ -35,9 +35,9 @@ If you do not set the `pinMode()` to `OUTPUT`, and connect an LED to a pin, when [float] === Parameters -`pin`: the pin number +`pin`: the pin number. + +`value`: `HIGH` or `LOW`. -`value`: `HIGH` or `LOW` [float] === Returns diff --git a/Language/Functions/Digital IO/pinMode.adoc b/Language/Functions/Digital IO/pinMode.adoc index 2e66ed1df..6ab7f7bde 100644 --- a/Language/Functions/Digital IO/pinMode.adoc +++ b/Language/Functions/Digital IO/pinMode.adoc @@ -27,13 +27,12 @@ As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with === Syntax `pinMode(pin, mode)` + [float] === Parameters -`pin`: the number of the pin whose mode you wish to set - -`mode`: `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. (see the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins] page for a more complete description of the functionality.) +`pin`: the number of the pin whose mode you wish to set. + +`mode`: `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. See the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins] page for a more complete description of the functionality. -//Check how to add links [float] === Returns diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index a0b20191d..76d2e8436 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -57,15 +57,15 @@ For more information on interrupts, see http://gammon.com.au/interrupts[Nick Gam [float] === Syntax -`attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);` (recommended) + -`attachInterrupt(interrupt, ISR, mode);` (not recommended) + -`attachInterrupt(pin, ISR, mode);` (Not recommended. Additionally, this syntax only works on Arduino SAMD Boards, Uno WiFi Rev2, Due, and 101.) +`attachInterrupt(digitalPinToInterrupt(pin), ISR, mode)` (recommended) + +`attachInterrupt(interrupt, ISR, mode)` (not recommended) + +`attachInterrupt(pin, ISR, mode)` (Not recommended. Additionally, this syntax only works on Arduino SAMD Boards, Uno WiFi Rev2, Due, and 101.) [float] === Parameters -`interrupt`: the number of the interrupt (`int`) + -`pin`: the pin number + +`interrupt`: the number of the interrupt. Allowed data types: `int`. + +`pin`: the pin number. + `ISR`: the ISR to call when the interrupt occurs; this function must take no parameters and return nothing. This function is sometimes referred to as an interrupt service routine. + `mode`: defines when the interrupt should be triggered. Four constants are predefined as valid values: + @@ -78,6 +78,7 @@ The Due, Zero and MKR1000 boards allows also: + * *HIGH* to trigger the interrupt whenever the pin is high. + [float] === Returns Nothing diff --git a/Language/Functions/External Interrupts/detachInterrupt.adoc b/Language/Functions/External Interrupts/detachInterrupt.adoc index edfadcecf..993164063 100644 --- a/Language/Functions/External Interrupts/detachInterrupt.adoc +++ b/Language/Functions/External Interrupts/detachInterrupt.adoc @@ -27,12 +27,13 @@ Turns off the given interrupt. `detachInterrupt(interrupt)` (not recommended) + `detachInterrupt(pin)` (Not recommended. Additionally, this syntax only works on Arduino SAMD Boards, Uno WiFi Rev2, Due, and 101.) + [float] === Parameters -`interrupt`: the number of the interrupt to disable (see link:../attachinterrupt[attachInterrupt()] for more details). - +`interrupt`: the number of the interrupt to disable (see link:../attachinterrupt[attachInterrupt()] for more details). + `pin`: the pin number of the interrupt to disable + [float] === Returns Nothing diff --git a/Language/Functions/Interrupts/interrupts.adoc b/Language/Functions/Interrupts/interrupts.adoc index 127e80717..251ecced8 100644 --- a/Language/Functions/Interrupts/interrupts.adoc +++ b/Language/Functions/Interrupts/interrupts.adoc @@ -28,7 +28,8 @@ Re-enables interrupts (after they've been disabled by link:../nointerrupts[noint [float] === Parameters -Nothing +None + [float] === Returns diff --git a/Language/Functions/Interrupts/noInterrupts.adoc b/Language/Functions/Interrupts/noInterrupts.adoc index a5249555a..c7e413dba 100644 --- a/Language/Functions/Interrupts/noInterrupts.adoc +++ b/Language/Functions/Interrupts/noInterrupts.adoc @@ -28,7 +28,8 @@ Disables interrupts (you can re-enable them with `interrupts()`). Interrupts all [float] === Parameters -Nothing +None + [float] === Returns diff --git a/Language/Functions/Math/abs.adoc b/Language/Functions/Math/abs.adoc index 3ea428058..c24610f7a 100644 --- a/Language/Functions/Math/abs.adoc +++ b/Language/Functions/Math/abs.adoc @@ -25,14 +25,15 @@ Calculates the absolute value of a number. === Syntax `abs(x)` + [float] === Parameters `x`: the number + [float] === Returns -`x`: if x is greater than or equal to 0. - +`x`: if x is greater than or equal to 0. + `-x`: if x is less than 0. -- diff --git a/Language/Functions/Math/constrain.adoc b/Language/Functions/Math/constrain.adoc index a871e1bd3..5ba9436ee 100644 --- a/Language/Functions/Math/constrain.adoc +++ b/Language/Functions/Math/constrain.adoc @@ -28,17 +28,16 @@ Constrains a number to be within a range. [float] === Parameters -`x`: the number to constrain, all data types -`a`: the lower end of the range, all data types -`b`: the upper end of the range, all data types +`x`: the number to constrain Allowed data types: all data types. + +`a`: the lower end of the range. Allowed data types: all data types. + +`b`: the upper end of the range. Allowed data types: all data types. + [float] === Returns -x: if x is between a and b - -a: if x is less than a - -b: if x is greater than b +x: if x is between a and b. + +a: if x is less than a. + +b: if x is greater than b. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Math/map.adoc b/Language/Functions/Math/map.adoc index 83e77b699..bc69e9ba8 100644 --- a/Language/Functions/Math/map.adoc +++ b/Language/Functions/Math/map.adoc @@ -42,15 +42,12 @@ The `map()` function uses integer math so will not generate fractions, when the [float] === Parameters -`value`: the number to map +`value`: the number to map. + +`fromLow`: the lower bound of the value's current range. + +`fromHigh`: the upper bound of the value's current range. + +`toLow`: the lower bound of the value's target range. + +`toHigh`: the upper bound of the value's target range. -`fromLow`: the lower bound of the value's current range - -`fromHigh`: the upper bound of the value's current range - -`toLow`: the lower bound of the value's target range - -`toHigh`: the upper bound of the value's target range [float] === Returns diff --git a/Language/Functions/Math/max.adoc b/Language/Functions/Math/max.adoc index ea61f743d..b3ec6d8d1 100644 --- a/Language/Functions/Math/max.adoc +++ b/Language/Functions/Math/max.adoc @@ -28,8 +28,9 @@ Calculates the maximum of two numbers. [float] === Parameters -`x`: the first number, any data type -`y`: the second number, any data type +`x`: the first number. Allowed data types: any data type. + +`y`: the second number. Allowed data types: any data type. + [float] === Returns diff --git a/Language/Functions/Math/min.adoc b/Language/Functions/Math/min.adoc index 7ab0c7dc5..77054141b 100644 --- a/Language/Functions/Math/min.adoc +++ b/Language/Functions/Math/min.adoc @@ -28,9 +28,9 @@ Calculates the minimum of two numbers. [float] === Parameters -`x`: the first number, any data type +`x`: the first number. Allowed data types: any data type. + +`y`: the second number. Allowed data types: any data type. -`y`: the second number, any data type [float] === Returns diff --git a/Language/Functions/Math/pow.adoc b/Language/Functions/Math/pow.adoc index 88b3df24f..4beded9a1 100644 --- a/Language/Functions/Math/pow.adoc +++ b/Language/Functions/Math/pow.adoc @@ -4,8 +4,13 @@ categories: [ "Functions" ] subCategories: [ "Math" ] --- + + + + = pow(base, exponent) + // OVERVIEW SECTION STARTS [#overview] -- @@ -23,13 +28,13 @@ Calculates the value of a number raised to a power. `pow()` can be used to raise [float] === Parameters -`base`: the number (`float`) +`base`: the number. Allowed data types: `float`. + +`exponent`: the power to which the base is raised. Allowed data types: `float`. -`exponent`: the power to which the base is raised (`float`) [float] === Returns -The result of the exponentiation (`double`) +The result of the exponentiation. Data type: `double`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Math/sq.adoc b/Language/Functions/Math/sq.adoc index cff891cf2..484d523e3 100644 --- a/Language/Functions/Math/sq.adoc +++ b/Language/Functions/Math/sq.adoc @@ -28,11 +28,12 @@ Calculates the square of a number: the number multiplied by itself. [float] === Parameters -`x`: the number, any data type +`x`: the number. Allowed data types: any data type. + [float] === Returns -The square of the number. (double) +The square of the number. Data type: `double`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Math/sqrt.adoc b/Language/Functions/Math/sqrt.adoc index f9e8236bd..25a918575 100644 --- a/Language/Functions/Math/sqrt.adoc +++ b/Language/Functions/Math/sqrt.adoc @@ -28,11 +28,12 @@ Calculates the square root of a number. [float] === Parameters -`x`: the number, any data type +`x`: the number. Allowed data types: any data type. + [float] === Returns -The number's square root. (double) +The number's square root. Data type: `double`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Random Numbers/random.adoc b/Language/Functions/Random Numbers/random.adoc index 9fee6dac1..c7c76903e 100644 --- a/Language/Functions/Random Numbers/random.adoc +++ b/Language/Functions/Random Numbers/random.adoc @@ -29,13 +29,13 @@ The random function generates pseudo-random numbers. [float] === Parameters -`min` - lower bound of the random value, inclusive (optional) +`min`: lower bound of the random value, inclusive (optional). + +`max`: upper bound of the random value, exclusive. -`max` - upper bound of the random value, exclusive [float] === Returns -A random number between min and max-1 (`long`) . +A random number between min and max-1. Data type: `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Random Numbers/randomSeed.adoc b/Language/Functions/Random Numbers/randomSeed.adoc index f215d6337..6e9292223 100644 --- a/Language/Functions/Random Numbers/randomSeed.adoc +++ b/Language/Functions/Random Numbers/randomSeed.adoc @@ -25,12 +25,15 @@ Conversely, it can occasionally be useful to use pseudo-random sequences that re [%hardbreaks] - +[float] +=== Syntax +`randomSeed(seed)` [float] === Parameters -`seed` - number to initialize the pseudo-random sequence (unsigned long). +`seed`: number to initialize the pseudo-random sequence. Allowed data types: `unsigned long`. + [float] === Returns diff --git a/Language/Functions/Time/delay.adoc b/Language/Functions/Time/delay.adoc index 631eecbdb..a7dce4953 100644 --- a/Language/Functions/Time/delay.adoc +++ b/Language/Functions/Time/delay.adoc @@ -28,7 +28,8 @@ Pauses the program for the amount of time (in milliseconds) specified as paramet [float] === Parameters -`ms`: the number of milliseconds to pause (`unsigned long`) +`ms`: the number of milliseconds to pause. Allowed data types: `unsigned long`. + [float] === Returns diff --git a/Language/Functions/Time/delayMicroseconds.adoc b/Language/Functions/Time/delayMicroseconds.adoc index 628b500a3..e86d37f2c 100644 --- a/Language/Functions/Time/delayMicroseconds.adoc +++ b/Language/Functions/Time/delayMicroseconds.adoc @@ -30,7 +30,8 @@ Currently, the largest value that will produce an accurate delay is 16383. This [float] === Parameters -`us`: the number of microseconds to pause (`unsigned int`) +`us`: the number of microseconds to pause. Allowed data types: `unsigned int`. + [float] === Returns diff --git a/Language/Functions/Time/micros.adoc b/Language/Functions/Time/micros.adoc index cadaa75ec..92f274ab6 100644 --- a/Language/Functions/Time/micros.adoc +++ b/Language/Functions/Time/micros.adoc @@ -28,11 +28,12 @@ Returns the number of microseconds since the Arduino board began running the cur [float] === Parameters -Nothing +None + [float] === Returns -Returns the number of microseconds since the Arduino board began running the current program.(unsigned long) +Returns the number of microseconds since the Arduino board began running the current program. Data type: `unsigned long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index c66cdeaaa..d031efded 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -25,9 +25,10 @@ Returns the number of milliseconds passed since the Arduino board began running === Parameters None + [float] === Returns -Number of milliseconds passed since the program started (unsigned long) +Number of milliseconds passed since the program started. Data type: `unsigned long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Trigonometry/cos.adoc b/Language/Functions/Trigonometry/cos.adoc index 07c6e86b1..f9f9fdc1c 100644 --- a/Language/Functions/Trigonometry/cos.adoc +++ b/Language/Functions/Trigonometry/cos.adoc @@ -28,11 +28,12 @@ Calculates the cosine of an angle (in radians). The result will be between -1 an [float] === Parameters -`rad`: The angle in Radians (float). +`rad`: The angle in radians. Allowed data types: `float`. + [float] === Returns -The cos of the angle (`double`). +The cos of the angle. Data type: `double`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Trigonometry/sin.adoc b/Language/Functions/Trigonometry/sin.adoc index 3d3237848..0cc7fd95b 100644 --- a/Language/Functions/Trigonometry/sin.adoc +++ b/Language/Functions/Trigonometry/sin.adoc @@ -28,11 +28,12 @@ Calculates the sine of an angle (in radians). The result will be between -1 and [float] === Parameters -`rad`: The angle in Radians (`float`). +`rad`: The angle in radians. Allowed data types: `float`. + [float] === Returns -The sine of the angle (`double`). +The sine of the angle. Data type: `double`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Trigonometry/tan.adoc b/Language/Functions/Trigonometry/tan.adoc index 277db9ff2..193730123 100644 --- a/Language/Functions/Trigonometry/tan.adoc +++ b/Language/Functions/Trigonometry/tan.adoc @@ -28,11 +28,12 @@ Calculates the tangent of an angle (in radians). The result will be between nega [float] === Parameters -`rad`: The angle in Radians (`float`). +`rad`: The angle in radians. Allowed data types: `float`. + [float] === Returns -The tangent of the angle (`double`). +The tangent of the angle. Data type: `double`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardBegin.adoc b/Language/Functions/USB/Keyboard/keyboardBegin.adoc index 8c8595f43..1e13ed48c 100644 --- a/Language/Functions/USB/Keyboard/keyboardBegin.adoc +++ b/Language/Functions/USB/Keyboard/keyboardBegin.adoc @@ -25,7 +25,8 @@ When used with a Leonardo or Due board, `Keyboard.begin()` starts emulating a ke [float] === Parameters -Nothing +None + [float] === Returns diff --git a/Language/Functions/USB/Keyboard/keyboardEnd.adoc b/Language/Functions/USB/Keyboard/keyboardEnd.adoc index e4110a160..134ebdc0b 100644 --- a/Language/Functions/USB/Keyboard/keyboardEnd.adoc +++ b/Language/Functions/USB/Keyboard/keyboardEnd.adoc @@ -25,7 +25,8 @@ Stops the keyboard emulation to a connected computer. To start keyboard emulatio [float] === Parameters -Nothing +None + [float] === Returns diff --git a/Language/Functions/USB/Keyboard/keyboardPress.adoc b/Language/Functions/USB/Keyboard/keyboardPress.adoc index 85703fde3..a20a84da4 100644 --- a/Language/Functions/USB/Keyboard/keyboardPress.adoc +++ b/Language/Functions/USB/Keyboard/keyboardPress.adoc @@ -22,16 +22,17 @@ It is necessary to call link:../keyboardbegin[Keyboard.begin()] before using `pr [float] === Syntax -`Keyboard.press()` +`Keyboard.press(key)` [float] === Parameters -`char` : the key to press +`key`: the key to press. Allowed data types: `char`. + [float] === Returns -`size_t` : number of key presses sent. +Number of key presses sent. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardPrint.adoc b/Language/Functions/USB/Keyboard/keyboardPrint.adoc index d9bcb5c97..1f5014d73 100644 --- a/Language/Functions/USB/Keyboard/keyboardPrint.adoc +++ b/Language/Functions/USB/Keyboard/keyboardPrint.adoc @@ -25,13 +25,16 @@ Sends a keystroke to a connected computer. `Keyboard.print(character)` + `Keyboard.print(characters)` + [float] === Parameters -`character` : a char or int to be sent to the computer as a keystroke characters : a string to be sent to the computer as a keystroke. +`character`: a char or int to be sent to the computer as a keystroke. + +`characters`: a string to be sent to the computer as a keystroke. + [float] === Returns -`size_t` : number of bytes sent. +Number of bytes sent. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc index 850223d9e..1ae3551ce 100644 --- a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc +++ b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc @@ -26,15 +26,16 @@ Sends a keystroke to a connected computer, followed by a newline and carriage re `Keyboard.println(character)`+ `Keyboard.println(characters)` + [float] === Parameters -`character` : a char or int to be sent to the computer as a keystroke, followed by newline and carriage return. +`character`: a char or int to be sent to the computer as a keystroke, followed by newline and carriage return. + +`characters`: a string to be sent to the computer as a keystroke, followed by a newline and carriage return. -`characters` : a string to be sent to the computer as a keystroke, followed by a newline and carriage return. [float] === Returns -`size_t` : number of bytes sent +Number of bytes sent. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardRelease.adoc b/Language/Functions/USB/Keyboard/keyboardRelease.adoc index 0769ec306..643e7de8e 100644 --- a/Language/Functions/USB/Keyboard/keyboardRelease.adoc +++ b/Language/Functions/USB/Keyboard/keyboardRelease.adoc @@ -25,11 +25,12 @@ Lets go of the specified key. See link:../keyboardpress[Keyboard.press()] for mo [float] === Parameters -`key` : the key to release. `char` +`key`: the key to release. Allowed data types: `char`. + [float] === Returns -`size_t` : the number of keys released +The number of keys released. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardReleaseAll.adoc b/Language/Functions/USB/Keyboard/keyboardReleaseAll.adoc index ce826c472..8952a280f 100644 --- a/Language/Functions/USB/Keyboard/keyboardReleaseAll.adoc +++ b/Language/Functions/USB/Keyboard/keyboardReleaseAll.adoc @@ -25,7 +25,8 @@ Lets go of all keys currently pressed. See link:../keyboardpress[Keyboard.press( [float] === Parameters -Nothing +None + [float] === Returns diff --git a/Language/Functions/USB/Keyboard/keyboardWrite.adoc b/Language/Functions/USB/Keyboard/keyboardWrite.adoc index 62e278df2..6ff2155a7 100644 --- a/Language/Functions/USB/Keyboard/keyboardWrite.adoc +++ b/Language/Functions/USB/Keyboard/keyboardWrite.adoc @@ -29,7 +29,7 @@ For a complete list of ASCII characters, see http://www.asciitable.com/[ASCIITab [float] === Parameters -`character` : a char or int to be sent to the computer. Can be sent in any notation that's acceptable for a char. For example, all of the below are acceptable and send the same value, 65 or ASCII A: +`character`: a char or int to be sent to the computer. Can be sent in any notation that's acceptable for a char. For example, all of the below are acceptable and send the same value, 65 or ASCII A: [source,arduino] ---- Keyboard.write(65); // sends ASCII value 65, or A @@ -38,9 +38,10 @@ Keyboard.write(0x41); // same thing in hexadecimal Keyboard.write(0b01000001); // same thing in binary (weird choice, but it works) ---- + [float] === Returns -`size_t` : number of bytes sent. +Number of bytes sent. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Mouse/mouseBegin.adoc b/Language/Functions/USB/Mouse/mouseBegin.adoc index 0ffc99d01..e9ca794f5 100644 --- a/Language/Functions/USB/Mouse/mouseBegin.adoc +++ b/Language/Functions/USB/Mouse/mouseBegin.adoc @@ -26,7 +26,8 @@ Begins emulating the mouse connected to a computer. `begin()` must be called bef [float] === Parameters -Nothing +None + [float] === Returns diff --git a/Language/Functions/USB/Mouse/mouseClick.adoc b/Language/Functions/USB/Mouse/mouseClick.adoc index f8bff9d59..37f8c2652 100644 --- a/Language/Functions/USB/Mouse/mouseClick.adoc +++ b/Language/Functions/USB/Mouse/mouseClick.adoc @@ -28,12 +28,13 @@ Sends a momentary click to the computer at the location of the cursor. This is t [float] === Parameters -`button`: which mouse button to press - `char` +`button`: which mouse button to press. Allowed data types: `char`. * `MOUSE_LEFT` (default) * `MOUSE_RIGHT` * `MOUSE_MIDDLE` + [float] === Returns Nothing diff --git a/Language/Functions/USB/Mouse/mouseEnd.adoc b/Language/Functions/USB/Mouse/mouseEnd.adoc index 0ca358c1b..89943fa9e 100644 --- a/Language/Functions/USB/Mouse/mouseEnd.adoc +++ b/Language/Functions/USB/Mouse/mouseEnd.adoc @@ -25,7 +25,8 @@ Stops emulating the mouse connected to a computer. To start control, use link:.. [float] === Parameters -Nothing +None + [float] === Returns diff --git a/Language/Functions/USB/Mouse/mouseIsPressed.adoc b/Language/Functions/USB/Mouse/mouseIsPressed.adoc index 0ebe22239..4f265d51a 100644 --- a/Language/Functions/USB/Mouse/mouseIsPressed.adoc +++ b/Language/Functions/USB/Mouse/mouseIsPressed.adoc @@ -27,17 +27,16 @@ Checks the current status of all mouse buttons, and reports if any are pressed o === Parameters When there is no value passed, it checks the status of the left mouse button. -`button`: which mouse button to check - `char` +`button`: which mouse button to check. Allowed data types: `char`. * `MOUSE_LEFT (default)` - * `MOUSE_RIGHT` - * `MOUSE_MIDDLE` + [float] === Returns -`bool` : reports whether a button is pressed or not. +Reports whether a button is pressed or not. Data type: `bool`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Mouse/mouseMove.adoc b/Language/Functions/USB/Mouse/mouseMove.adoc index 5c3780a00..852938b29 100644 --- a/Language/Functions/USB/Mouse/mouseMove.adoc +++ b/Language/Functions/USB/Mouse/mouseMove.adoc @@ -20,16 +20,16 @@ Moves the cursor on a connected computer. The motion onscreen is always relative [float] === Syntax -`Mouse.move(xVal, yVal, wheel);` +`Mouse.move(xVal, yVal, wheel)` [float] === Parameters -`xVal`: amount to move along the x-axis - `signed char` +`xVal`: amount to move along the x-axis. Allowed data types: `signed char`. + +`yVal`: amount to move along the y-axis. Allowed data types: `signed char`. + +`wheel`: amount to move scroll wheel. Allowed data types: `signed char`. -`yVal`: amount to move along the y-axis - `signed char` -`wheel`: amount to move scroll wheel - `signed char` [float] === Returns Nothing diff --git a/Language/Functions/USB/Mouse/mousePress.adoc b/Language/Functions/USB/Mouse/mousePress.adoc index 88df8d4cb..51d371ba1 100644 --- a/Language/Functions/USB/Mouse/mousePress.adoc +++ b/Language/Functions/USB/Mouse/mousePress.adoc @@ -30,14 +30,13 @@ Before using `Mouse.press()`, you need to start communication with link:../mouse [float] === Parameters -`button`: which mouse button to press - `char` +`button`: which mouse button to press. Allowed data types: `char`. * `MOUSE_LEFT (default)` - * `MOUSE_RIGHT` - * `MOUSE_MIDDLE` + [float] === Returns Nothing diff --git a/Language/Functions/USB/Mouse/mouseRelease.adoc b/Language/Functions/USB/Mouse/mouseRelease.adoc index f241b5d23..bfa720c1c 100644 --- a/Language/Functions/USB/Mouse/mouseRelease.adoc +++ b/Language/Functions/USB/Mouse/mouseRelease.adoc @@ -20,19 +20,19 @@ Sends a message that a previously pressed button (invoked through link:../mousep [float] === Syntax -`Mouse.release();` + -`Mouse.release(button);` +`Mouse.release()` + +`Mouse.release(button)` + [float] === Parameters -`button`: which mouse button to press - char +`button`: which mouse button to press. Allowed data types: `char`. * `MOUSE_LEFT` (default) - * `MOUSE_RIGHT` - * `MOUSE_MIDDLE` + [float] === Returns Nothing diff --git a/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc b/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc index f4bf119cd..8dbf51d92 100644 --- a/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc +++ b/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc @@ -33,6 +33,7 @@ The *Due, Zero and MKR Family* boards have 12-bit ADC capabilities that can be a === Parameters `bits`: determines the resolution (in bits) of the value returned by the `analogRead()` function. You can set this between 1 and 32. You can set resolutions higher than 12 but values returned by `analogRead()` will suffer approximation. See the note below for details. + [float] === Returns Nothing diff --git a/Language/Functions/Zero, Due, MKR Family/analogWriteResolution.adoc b/Language/Functions/Zero, Due, MKR Family/analogWriteResolution.adoc index fb170540f..3ef4e482f 100644 --- a/Language/Functions/Zero, Due, MKR Family/analogWriteResolution.adoc +++ b/Language/Functions/Zero, Due, MKR Family/analogWriteResolution.adoc @@ -54,6 +54,7 @@ By setting the write resolution to 12 bits, you can use `analogWrite()` with val === Parameters `bits`: determines the resolution (in bits) of the values used in the `analogWrite()` function. The value can range from 1 to 32. If you choose a resolution higher or lower than your board's hardware capabilities, the value used in `analogWrite()` will be either truncated if it's too high or padded with zeros if it's too low. See the note below for details. + [float] === Returns Nothing diff --git a/Language/Structure/Arithmetic Operators/addition.adoc b/Language/Structure/Arithmetic Operators/addition.adoc index ecdee00aa..e1c3877e0 100644 --- a/Language/Structure/Arithmetic Operators/addition.adoc +++ b/Language/Structure/Arithmetic Operators/addition.adoc @@ -24,17 +24,14 @@ subCategories: [ "Arithmetic Operators" ] [float] === Syntax -[source,arduino] ----- -sum = operand1 + operand2; ----- +`sum = operand1 + operand2;` [float] === Parameters -`sum` : variable. *Allowed data types:* int, float, double, byte, short, long + -`operand1` : variable or constant. *Allowed data types:* int, float, double, byte, short, long + -`operand2` : variable or constant. *Allowed data types:* int, float, double, byte, short, long -[%hardbreaks] +`sum`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/division.adoc b/Language/Structure/Arithmetic Operators/division.adoc index b9f0af39c..c7c4c2518 100644 --- a/Language/Structure/Arithmetic Operators/division.adoc +++ b/Language/Structure/Arithmetic Operators/division.adoc @@ -24,17 +24,14 @@ subCategories: [ "Arithmetic Operators" ] [float] === Syntax -[source,arduino] ----- -result = numerator / denominator; ----- +`result = numerator / denominator;` + [float] === Parameters -`result` : variable. *Allowed data types:* int, float, double, byte, short, long + -`numerator` : variable or constant. *Allowed data types:* int, float, double, byte, short, long + -`denominator` : *non zero* variable or constant. *Allowed data types:* int, float, double, byte, short, long -[%hardbreaks] +`result`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`numerator`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`denominator`: *non zero* variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/multiplication.adoc b/Language/Structure/Arithmetic Operators/multiplication.adoc index 5221b3852..135022ce7 100644 --- a/Language/Structure/Arithmetic Operators/multiplication.adoc +++ b/Language/Structure/Arithmetic Operators/multiplication.adoc @@ -24,17 +24,14 @@ subCategories: [ "Arithmetic Operators" ] [float] === Syntax -[source,arduino] ----- -product = operand1 * operand2; ----- +`product = operand1 * operand2;` + [float] === Parameters -`product` : variable. *Allowed data types:* int, float, double, byte, short, long + -`operand1` : variable or constant. *Allowed data types:* int, float, double, byte, short, long + -`operand2` : variable or constant. *Allowed data types:* int, float, double, byte, short, long -[%hardbreaks] +`product`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/remainder.adoc b/Language/Structure/Arithmetic Operators/remainder.adoc index c641f88ba..a6715a1ad 100644 --- a/Language/Structure/Arithmetic Operators/remainder.adoc +++ b/Language/Structure/Arithmetic Operators/remainder.adoc @@ -24,17 +24,13 @@ subCategories: [ "Arithmetic Operators" ] [float] === Syntax -[source,arduino] ----- -remainder = dividend % divisor; ----- +`remainder = dividend % divisor;` [float] === Parameters -`remainder` : variable. *Allowed data types:* int, float, double + -`dividend` : variable or constant. *Allowed data types:* int + -`divisor` : *non zero* variable or constant. *Allowed data types:* int -[%hardbreaks] +`remainder`: variable. Allowed data types: `int`, `float`, `double`. + +`dividend`: variable or constant. Allowed data types: `int`. + +`divisor`: *non zero* variable or constant. Allowed data types: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/subtraction.adoc b/Language/Structure/Arithmetic Operators/subtraction.adoc index 564a8b946..3a73fdac2 100644 --- a/Language/Structure/Arithmetic Operators/subtraction.adoc +++ b/Language/Structure/Arithmetic Operators/subtraction.adoc @@ -24,17 +24,14 @@ subCategories: [ "Arithmetic Operators" ] [float] === Syntax -[source,arduino] ----- -difference = operand1 - operand2; ----- +`difference = operand1 - operand2;` + [float] === Parameters -`difference` : variable. *Allowed data types:* int, float, double, byte, short, long + -`operand1` : variable or constant. *Allowed data types:* int, float, double, byte, short, long + -`operand2` : variable or constant. *Allowed data types:* int, float, double, byte, short, long -[%hardbreaks] +`difference`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitshiftLeft.adoc b/Language/Structure/Bitwise Operators/bitshiftLeft.adoc index 75392494d..5fc3c2098 100644 --- a/Language/Structure/Bitwise Operators/bitshiftLeft.adoc +++ b/Language/Structure/Bitwise Operators/bitshiftLeft.adoc @@ -24,15 +24,13 @@ The left shift operator `<<` causes the bits of the left operand to be shifted * [float] === Syntax -[source,arduino] ----- -variable << number_of_bits; ----- +`variable << number_of_bits;` + [float] === Parameters -`variable`: *Allowed data types:* byte, int, long + -`number_of_bits`: a number that is < = 32. *Allowed data types:* int +`variable`: Allowed data types: `byte`, `int`, `long`. + +`number_of_bits`: a number that is < = 32. Allowed data types: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitshiftRight.adoc b/Language/Structure/Bitwise Operators/bitshiftRight.adoc index f97197833..2d21f89c6 100644 --- a/Language/Structure/Bitwise Operators/bitshiftRight.adoc +++ b/Language/Structure/Bitwise Operators/bitshiftRight.adoc @@ -24,15 +24,13 @@ The right shift operator `>>` causes the bits of the left operand to be shifted [float] === Syntax -[source,arduino] ----- -variable >> number_of_bits; ----- +`variable >> number_of_bits;` + [float] === Parameters -`variable`: *Allowed data types:* byte, int, long + -`number_of_bits`: a number that is < = 32. *Allowed data types:* int +`variable`: Allowed data types: `byte`, `int`, `long`. + +`number_of_bits`: a number that is < = 32. Allowed data types: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Comparison Operators/equalTo.adoc b/Language/Structure/Comparison Operators/equalTo.adoc index 80e38b47e..23058df15 100644 --- a/Language/Structure/Comparison Operators/equalTo.adoc +++ b/Language/Structure/Comparison Operators/equalTo.adoc @@ -24,15 +24,13 @@ Compares the variable on the left with the value or variable on the right of the [float] === Syntax -[source,arduino] ----- -x == y; // is true if x is equal to y and it is false if x is not equal to y ----- +`x == y; // is true if x is equal to y and it is false if x is not equal to y` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Comparison Operators/greaterThan.adoc b/Language/Structure/Comparison Operators/greaterThan.adoc index e4f819e36..378c516c4 100644 --- a/Language/Structure/Comparison Operators/greaterThan.adoc +++ b/Language/Structure/Comparison Operators/greaterThan.adoc @@ -24,15 +24,13 @@ Compares the variable on the left with the value or variable on the right of the [float] === Syntax -[source,arduino] ----- -x > y; // is true if x is bigger than y and it is false if x is equal or smaller than y ----- +`x > y; // is true if x is bigger than y and it is false if x is equal or smaller than y` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Comparison Operators/greaterThanOrEqualTo.adoc b/Language/Structure/Comparison Operators/greaterThanOrEqualTo.adoc index 6ed4f1980..1520d172f 100644 --- a/Language/Structure/Comparison Operators/greaterThanOrEqualTo.adoc +++ b/Language/Structure/Comparison Operators/greaterThanOrEqualTo.adoc @@ -24,15 +24,13 @@ Compares the variable on the left with the value or variable on the right of the [float] === Syntax -[source,arduino] ----- -x >= y; // is true if x is bigger than or equal to y and it is false if x is smaller than y ----- +`x >= y; // is true if x is bigger than or equal to y and it is false if x is smaller than y` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Comparison Operators/lessThan.adoc b/Language/Structure/Comparison Operators/lessThan.adoc index 94f99099a..9e0ad052b 100644 --- a/Language/Structure/Comparison Operators/lessThan.adoc +++ b/Language/Structure/Comparison Operators/lessThan.adoc @@ -24,15 +24,13 @@ Compares the variable on the left with the value or variable on the right of the [float] === Syntax -[source,arduino] ----- -x < y; // is true if x is smaller than y and it is false if x is equal or bigger than y ----- +`x < y; // is true if x is smaller than y and it is false if x is equal or bigger than y` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Comparison Operators/lessThanOrEqualTo.adoc b/Language/Structure/Comparison Operators/lessThanOrEqualTo.adoc index 95080309a..1d3dee153 100644 --- a/Language/Structure/Comparison Operators/lessThanOrEqualTo.adoc +++ b/Language/Structure/Comparison Operators/lessThanOrEqualTo.adoc @@ -24,15 +24,13 @@ Compares the variable on the left with the value or variable on the right of the [float] === Syntax -[source,arduino] ----- -x <= y; // is true if x is smaller than or equal to y and it is false if x is greater than y ----- +`x <= y; // is true if x is smaller than or equal to y and it is false if x is greater than y` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Comparison Operators/notEqualTo.adoc b/Language/Structure/Comparison Operators/notEqualTo.adoc index 57a8263dc..6ecb34a2e 100644 --- a/Language/Structure/Comparison Operators/notEqualTo.adoc +++ b/Language/Structure/Comparison Operators/notEqualTo.adoc @@ -24,15 +24,13 @@ Compares the variable on the left with the value or variable on the right of the [float] === Syntax -[source,arduino] ----- -x != y; // is false if x is equal to y and it is true if x is not equal to y ----- +`x != y; // is false if x is equal to y and it is true if x is not equal to y` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundAddition.adoc b/Language/Structure/Compound Operators/compoundAddition.adoc index d30f2bc48..97aad457a 100644 --- a/Language/Structure/Compound Operators/compoundAddition.adoc +++ b/Language/Structure/Compound Operators/compoundAddition.adoc @@ -24,15 +24,13 @@ This is a convenient shorthand to perform addition on a variable with another co [float] === Syntax -[source,arduino] ----- -x += y; // equivalent to the expression x = x + y; ----- +`x += y; // equivalent to the expression x = x + y;` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc b/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc index a47a7f854..c37af3726 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc @@ -31,15 +31,13 @@ A review of the Bitwise AND `&` operator: [float] === Syntax -[source,arduino] ----- -x &= y; // equivalent to x = x & y; ----- +`x &= y; // equivalent to x = x & y;` + [float] === Parameters -`x`: variable. *Allowed data types:* char, int, long + -`y`: variable or constant. *Allowed data types:* char, int, long +`x`: variable. Allowed data types: `char`, `int`, `long`. + +`y`: variable or constant. Allowed data types: `char`, `int`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundBitwiseOr.adoc b/Language/Structure/Compound Operators/compoundBitwiseOr.adoc index d7f17e6db..c2b4bafd5 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseOr.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseOr.adoc @@ -27,15 +27,13 @@ A review of the Bitwise OR `|` operator: [float] === Syntax -[source,arduino] ----- -x |= y; // equivalent to x = x | y; ----- +`x |= y; // equivalent to x = x | y;` + [float] === Parameters -`x`: variable. *Allowed data types:* char, int, long + -`y`: variable or constant. *Allowed data types:* char, int, long +`x`: variable. Allowed data types: `char`, `int`, `long`. + +`y`: variable or constant. Allowed data types: `char`, `int`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundBitwiseXor.adoc b/Language/Structure/Compound Operators/compoundBitwiseXor.adoc index 75b4d87a0..95758430c 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseXor.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseXor.adoc @@ -27,15 +27,13 @@ A review of the Bitwise XOR `^` operator: [float] === Syntax -[source,arduino] ----- -x ^= y; // equivalent to x = x ^ y; ----- +`x ^= y; // equivalent to x = x ^ y;` + [float] === Parameters -`x`: variable. *Allowed data types:* char, int, long + -`y`: variable or constant. *Allowed data types:* char, int, long +`x`: variable. Allowed data types: `char`, `int`, `long`. + +`y`: variable or constant. Allowed data types: `char`, `int`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundDivision.adoc b/Language/Structure/Compound Operators/compoundDivision.adoc index d24ffe78b..9a5e73f5e 100644 --- a/Language/Structure/Compound Operators/compoundDivision.adoc +++ b/Language/Structure/Compound Operators/compoundDivision.adoc @@ -24,15 +24,13 @@ This is a convenient shorthand to perform division of a variable with another co [float] === Syntax -[source,arduino] ----- -x /= y; // equivalent to the expression x = x / y; ----- +`x /= y; // equivalent to the expression x = x / y;` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: *non zero* variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: *non zero* variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundMultiplication.adoc b/Language/Structure/Compound Operators/compoundMultiplication.adoc index dccd205fd..436d39958 100644 --- a/Language/Structure/Compound Operators/compoundMultiplication.adoc +++ b/Language/Structure/Compound Operators/compoundMultiplication.adoc @@ -24,15 +24,13 @@ This is a convenient shorthand to perform multiplication of a variable with anot [float] === Syntax -[source,arduino] ----- -x *= y; // equivalent to the expression x = x * y; ----- +`x *= y; // equivalent to the expression x = x * y;` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundRemainder.adoc b/Language/Structure/Compound Operators/compoundRemainder.adoc index ef098abcb..f60328063 100644 --- a/Language/Structure/Compound Operators/compoundRemainder.adoc +++ b/Language/Structure/Compound Operators/compoundRemainder.adoc @@ -24,15 +24,13 @@ This is a convenient shorthand to calculate the remainder when one integer is di [float] === Syntax -[source,arduino] ----- -x %= divisor; // equivalent to the expression x = x % divisor; ----- +`x %= divisor; // equivalent to the expression x = x % divisor;` + [float] === Parameters -`x`: variable. *Allowed data types:* int + -`divisor`: *non zero* variable or constant. *Allowed data types:* int +`x`: variable. Allowed data types: `int`. + +`divisor`: *non zero* variable or constant. Allowed data types: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundSubtraction.adoc b/Language/Structure/Compound Operators/compoundSubtraction.adoc index f580817e0..417edb0cd 100644 --- a/Language/Structure/Compound Operators/compoundSubtraction.adoc +++ b/Language/Structure/Compound Operators/compoundSubtraction.adoc @@ -24,15 +24,13 @@ This is a convenient shorthand to perform subtraction of a constant or a variabl [float] === Syntax -[source,arduino] ----- -x -= y; // equivalent to the expression x = x - y; ----- +`x -= y; // equivalent to the expression x = x - y;` + [float] === Parameters -`x`: variable. *Allowed data types:* int, float, double, byte, short, long + -`y`: variable or constant. *Allowed data types:* int, float, double, byte, short, long +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Compound Operators/decrement.adoc b/Language/Structure/Compound Operators/decrement.adoc index aec960a3e..8b9bdc84e 100644 --- a/Language/Structure/Compound Operators/decrement.adoc +++ b/Language/Structure/Compound Operators/decrement.adoc @@ -24,15 +24,14 @@ Decrements the value of a variable by 1. [float] === Syntax -[source,arduino] ----- -x--; // decrement x by one and returns the old value of x ---x; // decrement x by one and returns the new value of x ----- +`x--; // decrement x by one and returns the old value of x` + +`--x; // decrement x by one and returns the new value of x` + [float] === Parameters -`x`: variable. *Allowed data types:* integer, long (possibly unsigned) +`x`: variable. Allowed data types: `int`, `long` (possibly unsigned). + [float] === Returns diff --git a/Language/Structure/Compound Operators/increment.adoc b/Language/Structure/Compound Operators/increment.adoc index 3c87364bf..00c32070b 100644 --- a/Language/Structure/Compound Operators/increment.adoc +++ b/Language/Structure/Compound Operators/increment.adoc @@ -24,15 +24,13 @@ Increments the value of a variable by 1. [float] === Syntax -[source,arduino] ----- -x++; // increment x by one and returns the old value of x -++x; // increment x by one and returns the new value of x ----- +`x++; // increment x by one and returns the old value of x` + +`++x; // increment x by one and returns the new value of x` + [float] === Parameters -`x`: variable. *Allowed data types:* integer, long (possibly unsigned) +`x`: variable. Allowed data types: `int`, `long` (possibly unsigned). [float] === Returns diff --git a/Language/Structure/Control Structure/doWhile.adoc b/Language/Structure/Control Structure/doWhile.adoc index 0136f4d4d..6c79fa192 100644 --- a/Language/Structure/Control Structure/doWhile.adoc +++ b/Language/Structure/Control Structure/doWhile.adoc @@ -28,7 +28,11 @@ do { // statement block } while (condition); ---- -The `condition` is a boolean expression that evaluates to `true` or `false`. + + +[float] +=== Parameters +`condition`: a boolean expression that evaluates to `true` or `false`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 55a148548..3b4a8fdc2 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -39,6 +39,7 @@ else { // do Thing C } ---- + -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index 5b964929e..e37b222eb 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -30,8 +30,12 @@ for (initialization; condition; increment) { } ---- -The *initialization* happens first and exactly once. Each time through the loop, the *condition* is tested; if it's `true`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `false`, the loop ends. -[%hardbreaks] + +[float] +=== Parameters +`initialization`: happens first and exactly once. + +`condition`: each time through the loop, `condition` is tested; if it's `true`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `false`, the loop ends. + +`increment`: executed each time through the loop when `contition` is true. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Control Structure/if.adoc b/Language/Structure/Control Structure/if.adoc index b45fd1cae..1f637c298 100644 --- a/Language/Structure/Control Structure/if.adoc +++ b/Language/Structure/Control Structure/if.adoc @@ -28,9 +28,20 @@ if (condition) { } ---- + [float] === Parameters -condition: a boolean expression i.e., can be `true` or `false` +`condition`: a boolean expression (i.e., can be `true` or `false`). + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- [float] === Example Code diff --git a/Language/Structure/Control Structure/return.adoc b/Language/Structure/Control Structure/return.adoc index b3c09f29e..b098d79b2 100644 --- a/Language/Structure/Control Structure/return.adoc +++ b/Language/Structure/Control Structure/return.adoc @@ -23,17 +23,13 @@ Terminate a function and return a value from a function to the calling function, [float] === Syntax -[source,arduino] ----- -return; - -return value; // both forms are valid ----- +`return;` + +`return value;` [float] === Parameters -`value`: any variable or constant type +`value`: Allowed data types: any variable or constant type. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index c209f8565..959eba4d2 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -44,8 +44,9 @@ switch (var) { [float] === Parameters -`var`: a variable whose value to compare with various cases. *Allowed data types:* int, char + -`label1`, `label2`: constants. *Allowed data types:* int, char +`var`: a variable whose value to compare with various cases. Allowed data types: `int`, `char`. + +`label1`, `label2`: constants. Allowed data types: `int`, `char`. + [float] === Returns diff --git a/Language/Structure/Control Structure/while.adoc b/Language/Structure/Control Structure/while.adoc index 93bdc4831..b0def2329 100644 --- a/Language/Structure/Control Structure/while.adoc +++ b/Language/Structure/Control Structure/while.adoc @@ -28,7 +28,11 @@ while (condition) { // statement(s) } ---- -The `condition` is a boolean expression that evaluates to `true` or `false`. + + +[float] +=== Parameters +`condition`: a boolean expression that evaluates to `true` or `false`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Further Syntax/define.adoc b/Language/Structure/Further Syntax/define.adoc index 234f68433..4e92d28ee 100644 --- a/Language/Structure/Further Syntax/define.adoc +++ b/Language/Structure/Further Syntax/define.adoc @@ -29,12 +29,13 @@ In general, the link:../../../variables/variable-scope\--qualifiers/const[const] [float] === Syntax -[source,arduino] ----- -#define constantName value ----- -Note that the # is necessary. -[%hardbreaks] +`#define constantName value` + + +[float] +=== Parameters +`constantName`: the name of the macro to define. + +`value`: the value to assign to the macro. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Conversion/byteCast.adoc b/Language/Variables/Conversion/byteCast.adoc index 15ca5bdea..0bf99c76f 100644 --- a/Language/Variables/Conversion/byteCast.adoc +++ b/Language/Variables/Conversion/byteCast.adoc @@ -28,11 +28,12 @@ Converts a value to the link:../../data-types/byte[byte] data type. [float] === Parameters -`x`: a value of any type +`x`: a value. Allowed data types: any type. + [float] === Returns -`byte` +Data type: `byte`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Conversion/charCast.adoc b/Language/Variables/Conversion/charCast.adoc index 9b59805e6..80c3af81b 100644 --- a/Language/Variables/Conversion/charCast.adoc +++ b/Language/Variables/Conversion/charCast.adoc @@ -28,11 +28,12 @@ Converts a value to the link:../../data-types/char[char] data type. [float] === Parameters -`x`: a value of any type +`x`: a value. Allowed data types: any type. + [float] === Returns -`char` +Data type: `char`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Conversion/floatCast.adoc b/Language/Variables/Conversion/floatCast.adoc index bc0b30a32..b9510fbcb 100644 --- a/Language/Variables/Conversion/floatCast.adoc +++ b/Language/Variables/Conversion/floatCast.adoc @@ -28,11 +28,12 @@ Converts a value to the link:../../data-types/float[float] data type. [float] === Parameters -`x`: a value of any type +`x`: a value. Allowed data types: any type. + [float] === Returns -`float` +Data type: `float`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Conversion/intCast.adoc b/Language/Variables/Conversion/intCast.adoc index cf28b4a1e..419b3bebf 100644 --- a/Language/Variables/Conversion/intCast.adoc +++ b/Language/Variables/Conversion/intCast.adoc @@ -28,11 +28,12 @@ Converts a value to the link:../../data-types/int[int] data type. [float] === Parameters -`x`: a value of any type +`x`: a value. Allowed data types: any type. + [float] === Returns -`int` +Data type: `int`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Conversion/longCast.adoc b/Language/Variables/Conversion/longCast.adoc index 6ef310760..13c423df1 100644 --- a/Language/Variables/Conversion/longCast.adoc +++ b/Language/Variables/Conversion/longCast.adoc @@ -28,11 +28,12 @@ Converts a value to the link:../../data-types/long[long] data type. [float] === Parameters -`x`: a value of any type +`x`: a value. Allowed data types: any type. + [float] === Returns -`long` +Data type: `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Conversion/wordcast.adoc b/Language/Variables/Conversion/wordcast.adoc index cf1ac3ba4..c32ea70ca 100644 --- a/Language/Variables/Conversion/wordcast.adoc +++ b/Language/Variables/Conversion/wordcast.adoc @@ -26,16 +26,17 @@ Converts a value to the link:../../data-types/word[word] data type. `word(x)` + `word(h, l)` + [float] === Parameters -`x`: a value of any type +`x`: a value. Allowed data types: any type. + +`h`: the high-order (leftmost) byte of the word. + +`l`: the low-order (rightmost) byte of the word. -`h`: the high-order (leftmost) byte of the word -`l`: the low-order (rightmost) byte of the word [float] === Returns -`word` +Data type: `word`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/c_str.adoc b/Language/Variables/Data Types/String/Functions/c_str.adoc index cdc140022..24ec2e491 100644 --- a/Language/Variables/Data Types/String/Functions/c_str.adoc +++ b/Language/Variables/Data Types/String/Functions/c_str.adoc @@ -26,9 +26,11 @@ Converts the contents of a String as a C-style, null-terminated string. Note tha === Syntax `myString.c_str()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. + [float] === Returns diff --git a/Language/Variables/Data Types/String/Functions/charAt.adoc b/Language/Variables/Data Types/String/Functions/charAt.adoc index 39edc7eba..1db376bb6 100644 --- a/Language/Variables/Data Types/String/Functions/charAt.adoc +++ b/Language/Variables/Data Types/String/Functions/charAt.adoc @@ -26,11 +26,11 @@ Access a particular character of the String. === Syntax `myString.charAt(n)` + [float] === Parameters -`myString`: a variable of type String - -`n`: a variable of type unsigned int +`myString`: a variable of type `String`. + +`n`: a variable. Allowed data types: `unsigned int`. [float] diff --git a/Language/Variables/Data Types/String/Functions/compareTo.adoc b/Language/Variables/Data Types/String/Functions/compareTo.adoc index 17604d7c5..98149180f 100644 --- a/Language/Variables/Data Types/String/Functions/compareTo.adoc +++ b/Language/Variables/Data Types/String/Functions/compareTo.adoc @@ -26,20 +26,19 @@ Compares two Strings, testing whether one comes before or after the other, or wh === Syntax `myString.compareTo(myString2)` + [float] === Parameters -`myString`: a variable of type String - -`myString2`: another variable of type String +`myString`: a variable of type `String`. + +`myString2`: another variable of type `String`. [float] === Returns -`a negative number`: if myString comes before myString2 - -`0`: if String equals myString2 +`a negative number`: if myString comes before myString2. + +`0`: if String equals myString2. + +`a positive number`: if myString comes after myString2. -`a positive number`: if myString comes after myString2 -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/concat.adoc b/Language/Variables/Data Types/String/Functions/concat.adoc index fcc533ba8..6161f6a9a 100644 --- a/Language/Variables/Data Types/String/Functions/concat.adoc +++ b/Language/Variables/Data Types/String/Functions/concat.adoc @@ -26,16 +26,16 @@ Appends the parameter to a String. === Syntax `myString.concat(parameter)` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. + +`parameter`: Allowed data types: `String`, `string`, `char`, `byte`, `int`, `unsigned int`, `long`, `unsigned long`, `float`, `double`, `__FlashStringHelper`(`F()` macro). -`parameter`: *Allowed types are* String, string, char, byte, int, unsigned int, long, unsigned long, float, double, __FlashStringHelper(F() macro). [float] === Returns -`true`: success - +`true`: success. + `false`: failure (in which case the String is left unchanged). -- diff --git a/Language/Variables/Data Types/String/Functions/endsWith.adoc b/Language/Variables/Data Types/String/Functions/endsWith.adoc index dfdd1af0b..02d5b07fa 100644 --- a/Language/Variables/Data Types/String/Functions/endsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/endsWith.adoc @@ -26,18 +26,17 @@ Tests whether or not a String ends with the characters of another String. === Syntax `myString.endsWith(myString2)` + [float] === Parameters -`myString`: a variable of type String - -`myString2`: another variable of type String +`myString`: a variable of type `String`. + +`myString2`: another variable of type `String`. [float] === Returns -`true`: if myString ends with the characters of myString2 - -`false`: otherwise +`true`: if myString ends with the characters of myString2. + +`false`: otherwise. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/equals.adoc b/Language/Variables/Data Types/String/Functions/equals.adoc index 8273cca01..c784f2f81 100644 --- a/Language/Variables/Data Types/String/Functions/equals.adoc +++ b/Language/Variables/Data Types/String/Functions/equals.adoc @@ -26,16 +26,17 @@ Compares two Strings for equality. The comparison is case-sensitive, meaning the === Syntax `myString.equals(myString2)` + [float] === Parameters -`myString, myString2`: variables of type String +`myString, myString2`: variables of type `String`. [float] === Returns -`true`: if string equals string2 +`true`: if string equals string2. + +`false`: otherwise. -`false`: otherwise -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc b/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc index 544f97ed8..76c8ba689 100644 --- a/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc +++ b/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc @@ -26,16 +26,18 @@ Compares two Strings for equality. The comparison is not case-sensitive, meaning === Syntax `myString.equalsIgnoreCase(myString2)` + [float] === Parameters -`myString, myString2`: variables of type String +`myString`: variable of type `String`. + +`myString2`: variable of type `String`. [float] === Returns -`true`: if myString equals myString2 (ignoring case) +`true`: if myString equals myString2 (ignoring case). + +`false`: otherwise. -`false`: otherwise -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/getBytes.adoc b/Language/Variables/Data Types/String/Functions/getBytes.adoc index 6ae711607..7019ba3a3 100644 --- a/Language/Variables/Data Types/String/Functions/getBytes.adoc +++ b/Language/Variables/Data Types/String/Functions/getBytes.adoc @@ -26,17 +26,17 @@ Copies the String's characters to the supplied buffer. === Syntax `myString.getBytes(buf, len)` + [float] === Parameters -`myString`: a variable of type String - -`buf`: the buffer to copy the characters into (_byte []_) +`myString`: a variable of type `String`. + +`buf`: the buffer to copy the characters into. Allowed data types: array of `byte`s. + +`len`: the size of the buffer. Allowed data types: `unsigned int`. -`len`: the size of the buffer (_unsigned int_) [float] === Returns -None +Nothing -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/indexOf.adoc b/Language/Variables/Data Types/String/Functions/indexOf.adoc index 8eec575ef..aaba45ffc 100644 --- a/Language/Variables/Data Types/String/Functions/indexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/indexOf.adoc @@ -28,13 +28,13 @@ Locates a character or String within another String. By default, searches from t `myString.indexOf(val)` + `myString.indexOf(val, from)` + [float] === Parameters -`myString`: a variable of type String - -`val`: the value to search for - char or String +`myString`: a variable of type `String`. + +`val`: the value to search for. Allowed data types: `char`, `String`. + +`from`: the index to start the search from. -`from`: the index to start the search from [float] === Returns diff --git a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc index 6505ce15d..1a6700532 100644 --- a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc @@ -27,13 +27,12 @@ Locates a character or String within another String. By default, searches from t `myString.lastIndexOf(val)` + `myString.lastIndexOf(val, from)` + [float] === Parameters -`myString`: a variable of type String - -`val`: the value to search for - char or String - -`from`: the index to work backwards from +`myString`: a variable of type `String`. + +`val`: the value to search for. Allowed data types: `char`, `String`. + +`from`: the index to work backwards from. [float] diff --git a/Language/Variables/Data Types/String/Functions/length.adoc b/Language/Variables/Data Types/String/Functions/length.adoc index 10471ef06..d0a2703e6 100644 --- a/Language/Variables/Data Types/String/Functions/length.adoc +++ b/Language/Variables/Data Types/String/Functions/length.adoc @@ -26,9 +26,10 @@ Returns the length of the String, in characters. (Note that this doesn't include === Syntax `myString.length()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. [float] diff --git a/Language/Variables/Data Types/String/Functions/remove.adoc b/Language/Variables/Data Types/String/Functions/remove.adoc index a90e25708..02ea6a7a7 100644 --- a/Language/Variables/Data Types/String/Functions/remove.adoc +++ b/Language/Variables/Data Types/String/Functions/remove.adoc @@ -27,18 +27,17 @@ Modify in place a String removing chars from the provided index to the end of th `myString.remove(index)` + `myString.remove(index, count)` + [float] === Parameters -`myString`: a variable of type String - -`index`: a variable of type unsigned int - -`count`: a variable of type unsigned int +`myString`: a variable of type `String`. + +`index`: The position at which to start the remove process (zero indexed). Allowed data types: `unsigned int`. + +`count`: The number of characters to remove. Allowed data types: `unsigned int`. [float] === Returns -None +Nothing -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/replace.adoc b/Language/Variables/Data Types/String/Functions/replace.adoc index c4617685e..0905a7d5d 100644 --- a/Language/Variables/Data Types/String/Functions/replace.adoc +++ b/Language/Variables/Data Types/String/Functions/replace.adoc @@ -26,19 +26,18 @@ The String replace() function allows you to replace all instances of a given cha === Syntax `myString.replace(substring1, substring2)` + [float] === Parameters -`myString`: a variable of type String - -`substring1`: another variable of type String - -`substring2`: another variable of type String - +`myString`: a variable of type `String`. + +`substring1`: another variable of type `String`. + +`substring2`: another variable of type `String`. [float] === Returns -None +Nothing + -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/reserve.adoc b/Language/Variables/Data Types/String/Functions/reserve.adoc index a7ada643f..36b3c1552 100644 --- a/Language/Variables/Data Types/String/Functions/reserve.adoc +++ b/Language/Variables/Data Types/String/Functions/reserve.adoc @@ -26,16 +26,17 @@ The String reserve() function allows you to allocate a buffer in memory for mani === Syntax `myString.reserve(size)` + [float] === Parameters -`myString`: a variable of type String - -`size`: unsigned int declaring the number of bytes in memory to save for String manipulation +`myString`: a variable of type `String`. + +`size`: the number of bytes in memory to save for String manipulation. Allowed data types: `unsigned int`. [float] === Returns -None +Nothing + -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/setCharAt.adoc b/Language/Variables/Data Types/String/Functions/setCharAt.adoc index d05245a8d..d0dfc823a 100644 --- a/Language/Variables/Data Types/String/Functions/setCharAt.adoc +++ b/Language/Variables/Data Types/String/Functions/setCharAt.adoc @@ -26,18 +26,17 @@ Sets a character of the String. Has no effect on indices outside the existing le === Syntax `myString.setCharAt(index, c)` + [float] === Parameters -`myString`: a variable of type String - -`index`: the index to set the character at - -`c`: the character to store to the given location +`myString`: a variable of type `String`. + +`index`: the index to set the character at. + +`c`: the character to store to the given location. [float] === Returns -None +Nothing -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/startsWith.adoc b/Language/Variables/Data Types/String/Functions/startsWith.adoc index a18a1e308..76390ac91 100644 --- a/Language/Variables/Data Types/String/Functions/startsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/startsWith.adoc @@ -26,16 +26,17 @@ Tests whether or not a String starts with the characters of another String. === Syntax `myString.startsWith(myString2)` + [float] === Parameters -`myString, myString2`: a variable of type String +`myString, myString2`: a variable of type `String`. [float] === Returns -`true`: if myString starts with the characters of myString2 - +`true`: if myString starts with the characters of myString2. + `false`: otherwise + -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/substring.adoc b/Language/Variables/Data Types/String/Functions/substring.adoc index 29ff0f01f..5cf91d596 100644 --- a/Language/Variables/Data Types/String/Functions/substring.adoc +++ b/Language/Variables/Data Types/String/Functions/substring.adoc @@ -27,13 +27,12 @@ Get a substring of a String. The starting index is inclusive (the corresponding `myString.substring(from)` + `myString.substring(from, to)` + [float] === Parameters -`myString`: a variable of type String - -`from`: the index to start the substring at - -`to` (optional): the index to end the substring before +`myString`: a variable of type `String`. + +`from`: the index to start the substring at. + +`to` (optional): the index to end the substring before. [float] diff --git a/Language/Variables/Data Types/String/Functions/toCharArray.adoc b/Language/Variables/Data Types/String/Functions/toCharArray.adoc index 2d09464a7..bc36e4c19 100644 --- a/Language/Variables/Data Types/String/Functions/toCharArray.adoc +++ b/Language/Variables/Data Types/String/Functions/toCharArray.adoc @@ -26,17 +26,17 @@ Copies the String's characters to the supplied buffer. === Syntax `myString.toCharArray(buf, len)` + [float] === Parameters -`myString`: a variable of type String - -`buf`: the buffer to copy the characters into (_char []_) +`myString`: a variable of type `String`. + +`buf`: the buffer to copy the characters into. Allowed data types: array of `char`s. + +`len`: the size of the buffer. Allowed data types: `unsigned int`. -`len`: the size of the buffer (_unsigned int_) [float] === Returns -None +Nothing -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toDouble.adoc b/Language/Variables/Data Types/String/Functions/toDouble.adoc index 617585a88..622211837 100644 --- a/Language/Variables/Data Types/String/Functions/toDouble.adoc +++ b/Language/Variables/Data Types/String/Functions/toDouble.adoc @@ -26,16 +26,15 @@ Converts a valid String to a double. The input String should start with a digit. === Syntax `myString.toDouble()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. [float] === Returns -`double` - -If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. +If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. Data type: `double`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toFloat.adoc b/Language/Variables/Data Types/String/Functions/toFloat.adoc index d67b5bcff..52d3d3f20 100644 --- a/Language/Variables/Data Types/String/Functions/toFloat.adoc +++ b/Language/Variables/Data Types/String/Functions/toFloat.adoc @@ -26,16 +26,15 @@ Converts a valid String to a float. The input String should start with a digit. === Syntax `myString.toFloat()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. [float] === Returns -`float` - -If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. +If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. Data type: `float`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toInt.adoc b/Language/Variables/Data Types/String/Functions/toInt.adoc index a8e283ea8..f50acb697 100644 --- a/Language/Variables/Data Types/String/Functions/toInt.adoc +++ b/Language/Variables/Data Types/String/Functions/toInt.adoc @@ -26,16 +26,15 @@ Converts a valid String to an integer. The input String should start with an int === Syntax `myString.toInt()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. [float] === Returns -`long` - -If no valid conversion could be performed because the String doesn't start with a integer number, a zero is returned. +If no valid conversion could be performed because the String doesn't start with a integer number, a zero is returned. Data type: `long`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc index 1a1ff2649..d94279650 100644 --- a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc @@ -26,14 +26,15 @@ Get a lower-case version of a String. As of 1.0, toLowerCase() modifies the Stri === Syntax `myString.toLowerCase()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. [float] === Returns -None +Nothing -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc index 6216bd200..07beae25d 100644 --- a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc @@ -25,14 +25,15 @@ Get an upper-case version of a String. As of 1.0, toUpperCase() modifies the Str === Syntax `myString.toUpperCase()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type `String`. [float] === Returns -None +Nothing -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/trim.adoc b/Language/Variables/Data Types/String/Functions/trim.adoc index 0e1afd4d0..4b965dbcc 100644 --- a/Language/Variables/Data Types/String/Functions/trim.adoc +++ b/Language/Variables/Data Types/String/Functions/trim.adoc @@ -26,14 +26,15 @@ Get a version of the String with any leading and trailing whitespace removed. As === Syntax `myString.trim()` + [float] === Parameters -`myString`: a variable of type String +`myString`: a variable of type String. [float] === Returns -None +Nothing -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/append.adoc b/Language/Variables/Data Types/String/Operators/append.adoc index be267c431..808d8fe5d 100644 --- a/Language/Variables/Data Types/String/Operators/append.adoc +++ b/Language/Variables/Data Types/String/Operators/append.adoc @@ -25,18 +25,17 @@ It concatenates Strings with other data. [float] === Syntax -[source,arduino] ----- -myString1 += data ----- +`myString1 += data` + [float] === Parameters -`myString1` - a String variable +`myString1`: a String variable. + [float] === Returns -None +Nothing -- diff --git a/Language/Variables/Data Types/String/Operators/comparison.adoc b/Language/Variables/Data Types/String/Operators/comparison.adoc index 441efb2d2..bdd4e1262 100644 --- a/Language/Variables/Data Types/String/Operators/comparison.adoc +++ b/Language/Variables/Data Types/String/Operators/comparison.adoc @@ -22,20 +22,19 @@ Compares two Strings for equality. The comparison is case-sensitive, meaning the [float] === Syntax -[source,arduino] ----- -myString1 == myString2 ----- +`myString1 == myString2` [float] === Parameters -`myString1, myString2` - a String variable +`myString1`: a String variable. + +`myString2`: a String variable. + [float] === Returns -`true`: if myString1 equals myString2 - -`false`: otherwise +`true`: if myString1 equals myString2. + +`false`: otherwise. + -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/concatenation.adoc b/Language/Variables/Data Types/String/Operators/concatenation.adoc index 772256f8c..bcc3d6096 100644 --- a/Language/Variables/Data Types/String/Operators/concatenation.adoc +++ b/Language/Variables/Data Types/String/Operators/concatenation.adoc @@ -25,18 +25,19 @@ Combines, or concatenates two Strings into one new String. The second String is [float] === Syntax -[source,arduino] ----- -myString3 = myString1 + myString2 ----- +`myString3 = myString1 + myString2` + [float] === Parameters -`myString1, myString2, myString3` - a String variable +`myString1`: a String variable. + +`myString2`: a String variable. + +`myString3`: a String variable. + [float] === Returns -new String that is the combination of the original two Strings. +New String that is the combination of the original two Strings. -- diff --git a/Language/Variables/Data Types/String/Operators/differentFrom.adoc b/Language/Variables/Data Types/String/Operators/differentFrom.adoc index 2bfb6f5a4..b073f6b03 100644 --- a/Language/Variables/Data Types/String/Operators/differentFrom.adoc +++ b/Language/Variables/Data Types/String/Operators/differentFrom.adoc @@ -25,20 +25,19 @@ Compares two Strings for difference. The comparison is case-sensitive, meaning t [float] === Syntax -[source,arduino] ----- -myString1 != myString2 ----- +`myString1 != myString2` + [float] === Parameters -`myString1, myString2` - a String variable +`myString1: a String variable. + +`myString2`: a String variable. + [float] === Returns -`true`: if myString1 is different from myString2 - -`false`: otherwise +`true`: if myString1 is different from myString2. + +`false`: otherwise. -- diff --git a/Language/Variables/Data Types/String/Operators/elementAccess.adoc b/Language/Variables/Data Types/String/Operators/elementAccess.adoc index 31c491b58..4ca3a7eee 100644 --- a/Language/Variables/Data Types/String/Operators/elementAccess.adoc +++ b/Language/Variables/Data Types/String/Operators/elementAccess.adoc @@ -25,18 +25,15 @@ Allows you access to the individual characters of a String. [float] === Syntax -[source,arduino] ----- -char thisChar = myString1[n] ----- +`char thisChar = myString1[n]` + [float] === Parameters -`char thisChar` - a character variable - -`myString1` - a String variable +`thisChar`: Allowed data types: char. + +`myString1`: Allowed data types: String. + +`n`: a numeric variable. -`int n` - a numeric variable [float] === Returns diff --git a/Language/Variables/Data Types/String/Operators/greaterThan.adoc b/Language/Variables/Data Types/String/Operators/greaterThan.adoc index 526da157c..0c7de7f9f 100644 --- a/Language/Variables/Data Types/String/Operators/greaterThan.adoc +++ b/Language/Variables/Data Types/String/Operators/greaterThan.adoc @@ -26,20 +26,19 @@ Caution: String comparison operators can be confusing when you're comparing nume [float] === Syntax -[source,arduino] ----- -myString1 > myString2 ----- +`myString1 > myString2` + [float] === Parameters -`myString1, myString2` - a String variable +`myString1`: a String variable. + +`myString2`: a String variable. + [float] === Returns -`true`: if myString1 is greater than myString2 - -`false`: otherwise +`true`: if myString1 is greater than myString2. + +`false`: otherwise. -- diff --git a/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc b/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc index d83e415ac..da17d2671 100644 --- a/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc +++ b/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc @@ -22,21 +22,20 @@ Caution: String comparison operators can be confusing when you're comparing nume [float] === Syntax -[source,arduino] ----- -myString1 >= myString2 ----- +`myString1 >= myString2` + [float] === Parameters -`myString1, myString2`: variables of type String +`myString1`: variable of type String. + +`myString2: variable of type String. [float] === Returns -`true`: if myString1 is greater than or equal to myString2 +`true`: if myString1 is greater than or equal to myString2. + +`false`: otherwise. -`false`: otherwise -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/lessThan.adoc b/Language/Variables/Data Types/String/Operators/lessThan.adoc index 75eda2455..f145620cc 100644 --- a/Language/Variables/Data Types/String/Operators/lessThan.adoc +++ b/Language/Variables/Data Types/String/Operators/lessThan.adoc @@ -22,20 +22,20 @@ Caution: String comparison operators can be confusing when you're comparing nume [float] === Syntax -[source,arduino] ----- -myString1 < myString2 ----- +`myString1 < myString2` + [float] === Parameters -`myString1, myString2`: variables of type String +`myString1`: variable of type String. + +`myString2`: variable of type String. + [float] === Returns -`true`: if myString1 is less than myString2 +`true`: if myString1 is less than myString2. + +`false`: otherwise. -`false`: otherwise -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc b/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc index 20e24c3d1..13c04f623 100644 --- a/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc +++ b/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc @@ -27,20 +27,19 @@ Caution: String comparison operators can be confusing when you're comparing nume [float] === Syntax -[source,arduino] ----- -myString1 <= myString2 ----- +`myString1 <= myString2` + [float] === Parameters -`myString1, myString2`: variables of type String +`myString1`: variable of type String. + +`myString2`: variable of type String. + [float] === Returns -`true`: if myString1 is less than or equal to myString2 - -`false`: otherwise +`true`: if myString1 is less than or equal to myString2. + +`false`: otherwise. -- diff --git a/Language/Variables/Data Types/bool.adoc b/Language/Variables/Data Types/bool.adoc index 09a3cf6e7..27f66d74b 100644 --- a/Language/Variables/Data Types/bool.adoc +++ b/Language/Variables/Data Types/bool.adoc @@ -25,8 +25,8 @@ A `bool` holds one of two values, `true` or `false`. (Each `bool` variable occup [float] === Parameters -`var`: variable name + -`val`: the value to assign to that variable +`var`: variable name. + +`val`: the value to assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/byte.adoc b/Language/Variables/Data Types/byte.adoc index 9e3c6e8ef..4dca83539 100644 --- a/Language/Variables/Data Types/byte.adoc +++ b/Language/Variables/Data Types/byte.adoc @@ -23,8 +23,8 @@ A byte stores an 8-bit unsigned number, from 0 to 255. [float] === Parameters -`var`: variable name + -`val`: the value to assign to that variable +`var`: variable name. + +`val`: the value to assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/char.adoc b/Language/Variables/Data Types/char.adoc index 878a71c67..7244a893a 100644 --- a/Language/Variables/Data Types/char.adoc +++ b/Language/Variables/Data Types/char.adoc @@ -27,8 +27,8 @@ The size of the `char` datatype is at least 8 bits. It's recommended to only use [float] === Parameters -`var`: variable name + -`val`: the value to assign to that variable +`var`: variable name. + +`val`: the value to assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/double.adoc b/Language/Variables/Data Types/double.adoc index 8e29b325c..30aa83d8a 100644 --- a/Language/Variables/Data Types/double.adoc +++ b/Language/Variables/Data Types/double.adoc @@ -25,8 +25,8 @@ On the Arduino Due, doubles have 8-byte (64 bit) precision. [float] === Parameters -`var`: variable name + -`val`: the value to assign to that variable +`var`: variable name. + +`val`: the value to assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/float.adoc b/Language/Variables/Data Types/float.adoc index 0e64ac5e6..dbd235568 100644 --- a/Language/Variables/Data Types/float.adoc +++ b/Language/Variables/Data Types/float.adoc @@ -34,9 +34,8 @@ If doing math with floats, you need to add a decimal point, otherwise it will be [float] === Parameters -`var`: variable name + -`val`: the value you assign to that variable -[%hardbreaks] +`var`: variable name. + +`val`: the value you assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/int.adoc b/Language/Variables/Data Types/int.adoc index 5bd48b474..871013a81 100644 --- a/Language/Variables/Data Types/int.adoc +++ b/Language/Variables/Data Types/int.adoc @@ -28,10 +28,11 @@ The Arduino takes care of dealing with negative numbers for you, so that arithme === Syntax `int var = val;` + [float] === Parameters -`var`: variable name + -`val`: the value you assign to that variable +`var`: variable name. + +`val`: the value you assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/long.adoc b/Language/Variables/Data Types/long.adoc index 184097457..061c9c2c9 100644 --- a/Language/Variables/Data Types/long.adoc +++ b/Language/Variables/Data Types/long.adoc @@ -24,15 +24,14 @@ If doing math with integers, at least one of the numbers must be followed by an [float] === Syntax - `long var = val;` + [float] === Parameters -`var`: variable name + -`val`: the value assigned to the variable +`var`: variable name. + +`val`: the value assigned to the variable. -[%hardbreaks] -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/short.adoc b/Language/Variables/Data Types/short.adoc index 2d63b300f..3f81fdab0 100644 --- a/Language/Variables/Data Types/short.adoc +++ b/Language/Variables/Data Types/short.adoc @@ -26,10 +26,11 @@ On all Arduinos (ATMega and ARM based) a short stores a 16-bit (2-byte) value. T === Syntax `short var = val;` + [float] === Parameters -`var`: variable name + -`val`: the value you assign to that variable +`var`: variable name. + +`val`: the value you assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/size_t.adoc b/Language/Variables/Data Types/size_t.adoc index 1dd1308fc..7c772af14 100644 --- a/Language/Variables/Data Types/size_t.adoc +++ b/Language/Variables/Data Types/size_t.adoc @@ -23,8 +23,8 @@ subCategories: [ "Data Types" ] [float] === Parameters -`var`: variable name + -`val`: the value to assign to that variable +`var`: variable name. + +`val`: the value to assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/stringObject.adoc b/Language/Variables/Data Types/stringObject.adoc index bafbe4b05..80e320389 100644 --- a/Language/Variables/Data Types/stringObject.adoc +++ b/Language/Variables/Data Types/stringObject.adoc @@ -49,22 +49,21 @@ gives you the String "1101", which is the binary representation of 13. [float] === Syntax -[source,arduino] ----- -String(val) -String(val, base) -String(val, decimalPlaces) ----- +`String(val)` + +`String(val, base)` + +`String(val, decimalPlaces)` + [float] === Parameters -`val`: a variable to format as a String - *Allowed data types:* string, char, byte, int, long, unsigned int, unsigned long, float, double + -`base` (optional): the base in which to format an integral value + -`decimalPlaces` (*only if val is float or double*): the desired decimal places +`val`: a variable to format as a String. Allowed data types: string, char, byte, int, long, unsigned int, unsigned long, float, double. + +`base`: (optional) the base in which to format an integral value. + +`decimalPlaces`: *only if val is float or double*. The desired decimal places. + [float] === Returns -an instance of the String class. +An instance of the String class. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/unsignedChar.adoc b/Language/Variables/Data Types/unsignedChar.adoc index 229f34337..9225c34af 100644 --- a/Language/Variables/Data Types/unsignedChar.adoc +++ b/Language/Variables/Data Types/unsignedChar.adoc @@ -27,8 +27,8 @@ For consistency of Arduino programming style, the byte data type is to be prefer [float] === Parameters -`var`: variable name + -`val`: the value to assign to that variable +`var`: variable name. + +`val`: the value to assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/unsignedInt.adoc b/Language/Variables/Data Types/unsignedInt.adoc index 918850e05..50328763d 100644 --- a/Language/Variables/Data Types/unsignedInt.adoc +++ b/Language/Variables/Data Types/unsignedInt.adoc @@ -19,17 +19,22 @@ The Due stores a 4 byte (32-bit) value, ranging from 0 to 4,294,967,295 (2^32 - The difference between unsigned ints and (signed) ints, lies in the way the highest bit, sometimes referred to as the "sign" bit, is interpreted. In the Arduino int type (which is signed), if the high bit is a "1", the number is interpreted as a negative number, and the other 15 bits are interpreted with (http://en.wikipedia.org/wiki/2%27s_complement[2's complement math]). [%hardbreaks] --- -// OVERVIEW SECTION ENDS [float] === Syntax `unsigned int var = val;` + [float] === Parameters -`var`: variable name + -`val`: the value you assign to that variable +`var`: variable name. + +`val`: the value you assign to that variable. + +-- +// OVERVIEW SECTION ENDS + + + // HOW TO USE SECTION STARTS [#howtouse] diff --git a/Language/Variables/Data Types/unsignedLong.adoc b/Language/Variables/Data Types/unsignedLong.adoc index f696b2f08..efd69311c 100644 --- a/Language/Variables/Data Types/unsignedLong.adoc +++ b/Language/Variables/Data Types/unsignedLong.adoc @@ -17,14 +17,13 @@ Unsigned long variables are extended size variables for number storage, and stor [float] === Syntax - `unsigned long var = val;` + [float] === Parameters -`var`: variable name + -`val`: the value you assign to that variable -[%hardbreaks] +`var`: variable name. + +`val`: the value you assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/word.adoc b/Language/Variables/Data Types/word.adoc index 752e5e29d..40202e637 100644 --- a/Language/Variables/Data Types/word.adoc +++ b/Language/Variables/Data Types/word.adoc @@ -23,8 +23,8 @@ A word can store an unsigned number of at least 16 bits (from 0 to 65535). [float] === Parameters -`var`: variable name + -`val`: the value to assign to that variable +`var`: variable name. + +`val`: the value to assign to that variable. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index 1d5d639b3..4cbeb6db7 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -24,16 +24,15 @@ The `PROGMEM` keyword is a variable modifier, it should be used only with the da PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE, however if you are using an IDE version below 1.0 (2011), you'll first need to include the library at the top your sketch, like this: `#include ` +While `PROGMEM` could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array, (or another C++ data structure beyond our present discussion). + +Using `PROGMEM` is also a two-step procedure. After getting the data into Flash memory, it requires special methods (functions), also defined in the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library, to read the data from program memory back into SRAM, so we can do something useful with it. [%hardbreaks] [float] === Syntax - -const dataType variableName[] PROGMEM = {data0, data1, data3...}; - -`dataType` - any variable type + -`variableName` - the name for your array of data +`const dataType variableName[] PROGMEM = {data0, data1, data3...};` Note that because PROGMEM is a variable modifier, there is no hard and fast rule about where it should go, so the Arduino compiler accepts all of the definitions below, which are also synonymous. However experiments have indicated that, in various versions of Arduino (having to do with GCC version), PROGMEM may work in one location and not in another. The "string table" example below has been tested to work with Arduino 13. Earlier versions of the IDE may work better if PROGMEM is included after the variable name. @@ -42,10 +41,10 @@ Note that because PROGMEM is a variable modifier, there is no hard and fast rule `const dataType PROGMEM variableName[] = {}; // not this one` -While `PROGMEM` could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array, (or another C++ data structure beyond our present discussion). - -Using `PROGMEM` is also a two-step procedure. After getting the data into Flash memory, it requires special methods (functions), also defined in the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library, to read the data from program memory back into SRAM, so we can do something useful with it. - +[float] +=== Parameters +`dataType`: Allowed data types: any variable type. + +`variableName`: the name for your array of data. -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Utilities/sizeof.adoc b/Language/Variables/Utilities/sizeof.adoc index ae6f344e5..332e8637c 100644 --- a/Language/Variables/Utilities/sizeof.adoc +++ b/Language/Variables/Utilities/sizeof.adoc @@ -23,11 +23,12 @@ The `sizeof` operator returns the number of bytes in a variable type, or the num [float] === Parameters -`variable`: any variable type or array (e.g. int, float, byte) +`variable`: The thing to get the size of. Allowed data types: any variable type or array (e.g. `int`, `float`, `byte`). + [float] === Returns -The number of bytes in a variable or bytes occupied in an array. (size_t) +The number of bytes in a variable or bytes occupied in an array. Data type: `size_t`. -- // OVERVIEW SECTION ENDS From 2378d87dba4fb986377ec7ce5a0622187fc8ee43 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 7 May 2019 14:33:55 -0700 Subject: [PATCH 020/298] Swap and correct the documentation of isSpace() and isWhitespace() Although the documentation previously matched what you might expect these functions to do based on their names, the actual behavior of the functions is the reverse. In addition to this, isWhitespace() matches on horizontal tab as well as space, which was not mentioned in the isSpace() documentation. The decision was made to leave the implementation of the functions as-is to avoid causing breakage and to correct the documentation to match the actual behavior of the functions. More information: https://github.com/arduino/ArduinoCore-API/pull/27 --- Language/Functions/Characters/isSpace.adoc | 10 +++++----- Language/Functions/Characters/isWhitespace.adoc | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Language/Functions/Characters/isSpace.adoc b/Language/Functions/Characters/isSpace.adoc index fa6c8ab6b..2023af0e3 100644 --- a/Language/Functions/Characters/isSpace.adoc +++ b/Language/Functions/Characters/isSpace.adoc @@ -17,7 +17,7 @@ subCategories: [ "Characters" ] [float] === Description -Analyse if a char is the space character. Returns true if thisChar contains the space character. +Analyse if a char is a white-space character. Returns true if the argument is a space, form feed (`'\f'`), newline (`'\n'`), carriage return (`'\r'`), horizontal tab (`'\t'`), or vertical tab (`'\v'`). [%hardbreaks] @@ -34,7 +34,7 @@ isSpace(thisChar) [float] === Returns -`true`: if thisChar is a space. +`true`: if thisChar is a white-space character. -- // OVERVIEW SECTION ENDS @@ -50,11 +50,11 @@ isSpace(thisChar) [source,arduino] ---- -if (isSpace(myChar)) { // tests if myChar is the space character - Serial.println("The character is a space"); +if (isSpace(myChar)) { // tests if myChar is a white-space character + Serial.println("The character is white-space"); } else { - Serial.println("The character is not a space"); + Serial.println("The character is not white-space"); } ---- diff --git a/Language/Functions/Characters/isWhitespace.adoc b/Language/Functions/Characters/isWhitespace.adoc index c8b31ac4f..4583a4027 100644 --- a/Language/Functions/Characters/isWhitespace.adoc +++ b/Language/Functions/Characters/isWhitespace.adoc @@ -17,8 +17,7 @@ subCategories: [ "Characters" ] [float] === Description -Analyse if a char is a white space, that is space, formfeed ('\f'), newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v')). -Returns true if thisChar contains a white space. +Analyse if a char is a space character. Returns true if the argument is a space or horizontal tab (`'\t'`). [%hardbreaks] @@ -34,7 +33,7 @@ isWhitespace(thisChar) [float] === Returns -`true`: if thisChar is a white space. +`true`: if thisChar is a space character. -- // OVERVIEW SECTION ENDS @@ -50,11 +49,11 @@ isWhitespace(thisChar) [source,arduino] ---- -if (isWhitespace(myChar)) { // tests if myChar is a white space - Serial.println("The character is a white space"); +if (isWhitespace(myChar)) { // tests if myChar is a space character + Serial.println("The character is a space or tab"); } else { - Serial.println("The character is not a white space"); + Serial.println("The character is not a space or tab"); } ---- From b3c9429410c458b54b434eafe078fac49162114b Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 10 May 2019 23:29:08 -0700 Subject: [PATCH 021/298] Document analogReference() parameter values for megaAVR --- Language/Functions/Analog IO/analogReference.adoc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index ba1199b2b..fb9107d0f 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -36,6 +36,18 @@ Arduino SAMD Boards (Zero, etc.) * AR_INTERNAL2V23: a built-in 2.23V reference * AR_EXTERNAL: the voltage applied to the AREF pin is used as the reference +Arduino megaAVR Boards (Uno WiFi Rev2) + +* DEFAULT: a built-in 0.55V reference +* INTERNAL: a built-in 0.55V reference +* VDD: Vdd of the ATmega4809. 5V on the Uno WiFi Rev2 +* INTERNAL0V55: a built-in 0.55V reference +* INTERNAL1V1: a built-in 1.1V reference +* INTERNAL1V5: a built-in 1.5V reference +* INTERNAL2V5: a built-in 2.5V reference +* INTERNAL4V3: a built-in 4.3V reference +* EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference + Arduino SAM Boards (Due) * AR_DEFAULT: the default analog reference of 3.3V. This is the only supported option for the Due. From 7915211bd982b0a847a6457ad247f0ce8d5425e7 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 16 May 2019 14:25:44 -0700 Subject: [PATCH 022/298] Fix unterminated asciidoc blocks --- Language/Functions/USB/Keyboard/keyboardBegin.adoc | 1 + Language/Functions/USB/Keyboard/keyboardModifiers.adoc | 1 + Language/Variables/Data Types/String/Functions/reserve.adoc | 1 + 3 files changed, 3 insertions(+) diff --git a/Language/Functions/USB/Keyboard/keyboardBegin.adoc b/Language/Functions/USB/Keyboard/keyboardBegin.adoc index 8c8595f43..07b63d74a 100644 --- a/Language/Functions/USB/Keyboard/keyboardBegin.adoc +++ b/Language/Functions/USB/Keyboard/keyboardBegin.adoc @@ -67,4 +67,5 @@ void loop() { } ---- +-- // HOW TO USE SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index d6bd91df4..8a7e13605 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -64,6 +64,7 @@ The Leonardo's definitions for modifier keys are listed below: |KEY_F10 |0xCB |203 |KEY_F11 |0xCC |204 |KEY_F12 |0xCD |205 +|=== -- // OVERVIEW SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/reserve.adoc b/Language/Variables/Data Types/String/Functions/reserve.adoc index a7ada643f..4fac55164 100644 --- a/Language/Variables/Data Types/String/Functions/reserve.adoc +++ b/Language/Variables/Data Types/String/Functions/reserve.adoc @@ -70,6 +70,7 @@ void loop() { // nothing to do here } ---- +-- // HOW TO USE SECTION ENDS From c11cb671052daeb28591c07e0df7644f254dd5a1 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 4 Feb 2019 02:04:28 -0800 Subject: [PATCH 023/298] Emphasize that IO functions take Arduino pin numbers It's fairly common for users dabbling with bare microcontroller chips (e.g. "Arduino on a breadboard") to think that they can pass either the port/bit pin notation (e.g. PB5) or physical chip pin numbers to the Arduino IO functions. These changes are intended to emphasize that these functions only accept Arduino pin numbers as their pin parameter, without complicating the documentation for the users of standard Arduino boards. --- Language/Functions/Advanced IO/noTone.adoc | 2 +- Language/Functions/Advanced IO/pulseIn.adoc | 2 +- Language/Functions/Advanced IO/pulseInLong.adoc | 2 +- Language/Functions/Advanced IO/tone.adoc | 2 +- Language/Functions/Analog IO/analogWrite.adoc | 2 +- Language/Functions/Digital IO/digitalRead.adoc | 2 +- Language/Functions/Digital IO/digitalWrite.adoc | 2 +- Language/Functions/Digital IO/pinMode.adoc | 2 +- Language/Functions/External Interrupts/attachInterrupt.adoc | 2 +- Language/Functions/External Interrupts/detachInterrupt.adoc | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Language/Functions/Advanced IO/noTone.adoc b/Language/Functions/Advanced IO/noTone.adoc index 564f15e52..d30c3360d 100644 --- a/Language/Functions/Advanced IO/noTone.adoc +++ b/Language/Functions/Advanced IO/noTone.adoc @@ -27,7 +27,7 @@ Stops the generation of a square wave triggered by `tone()`. Has no effect if no [float] === Parameters -`pin`: the pin on which to stop generating the tone +`pin`: the Arduino pin on which to stop generating the tone [float] === Returns diff --git a/Language/Functions/Advanced IO/pulseIn.adoc b/Language/Functions/Advanced IO/pulseIn.adoc index 6fbebd607..74e1669a0 100644 --- a/Language/Functions/Advanced IO/pulseIn.adoc +++ b/Language/Functions/Advanced IO/pulseIn.adoc @@ -31,7 +31,7 @@ The timing of this function has been determined empirically and will probably sh [float] === Parameters -`pin`: the number of the pin on which you want to read the pulse. Allowed data types: `int`. + +`pin`: the number of the Arduino pin on which you want to read the pulse. Allowed data types: `int`. + `value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. Allowed data types: `int`. + `timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. diff --git a/Language/Functions/Advanced IO/pulseInLong.adoc b/Language/Functions/Advanced IO/pulseInLong.adoc index 9d948f197..a9b851168 100644 --- a/Language/Functions/Advanced IO/pulseInLong.adoc +++ b/Language/Functions/Advanced IO/pulseInLong.adoc @@ -33,7 +33,7 @@ The timing of this function has been determined empirically and will probably sh [float] === Parameters -`pin`: the number of the pin on which you want to read the pulse. Allowed data types: `int`. + +`pin`: the number of the Arduino pin on which you want to read the pulse. Allowed data types: `int`. + `value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. Allowed data types: `int`. + `timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index ef986a3f6..169f43f4c 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -35,7 +35,7 @@ It is not possible to generate tones lower than 31Hz. For technical details, see [float] === Parameters -`pin`: the pin on which to generate the tone. + +`pin`: the Arduino pin on which to generate the tone. + `frequency`: the frequency of the tone in hertz. Allowed data types: `unsigned int`. + `duration`: the duration of the tone in milliseconds (optional). Allowed data types: `unsigned long`. diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 6aee6cb59..39d2b6e11 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -33,7 +33,7 @@ The `analogWrite` function has nothing to do with the analog pins or the `analog [float] === Parameters -`pin`: the pin to write to. Allowed data types: `int`. + +`pin`: the Arduino pin to write to. Allowed data types: `int`. + `value`: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: `int`. diff --git a/Language/Functions/Digital IO/digitalRead.adoc b/Language/Functions/Digital IO/digitalRead.adoc index bedb99b3a..4db06e3d4 100644 --- a/Language/Functions/Digital IO/digitalRead.adoc +++ b/Language/Functions/Digital IO/digitalRead.adoc @@ -28,7 +28,7 @@ Reads the value from a specified digital pin, either `HIGH` or `LOW`. [float] === Parameters -`pin`: the number of the digital pin you want to read +`pin`: the Arduino pin number you want to read [float] diff --git a/Language/Functions/Digital IO/digitalWrite.adoc b/Language/Functions/Digital IO/digitalWrite.adoc index 9a3065dbc..35f5f075c 100644 --- a/Language/Functions/Digital IO/digitalWrite.adoc +++ b/Language/Functions/Digital IO/digitalWrite.adoc @@ -35,7 +35,7 @@ If you do not set the `pinMode()` to `OUTPUT`, and connect an LED to a pin, when [float] === Parameters -`pin`: the pin number. + +`pin`: the Arduino pin number. + `value`: `HIGH` or `LOW`. diff --git a/Language/Functions/Digital IO/pinMode.adoc b/Language/Functions/Digital IO/pinMode.adoc index 6ab7f7bde..c2b3c9e50 100644 --- a/Language/Functions/Digital IO/pinMode.adoc +++ b/Language/Functions/Digital IO/pinMode.adoc @@ -30,7 +30,7 @@ As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with [float] === Parameters -`pin`: the number of the pin whose mode you wish to set. + +`pin`: the Arduino pin number to set the mode of. + `mode`: `INPUT`, `OUTPUT`, or `INPUT_PULLUP`. See the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins] page for a more complete description of the functionality. diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 76d2e8436..0f5c21cf2 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -65,7 +65,7 @@ For more information on interrupts, see http://gammon.com.au/interrupts[Nick Gam [float] === Parameters `interrupt`: the number of the interrupt. Allowed data types: `int`. + -`pin`: the pin number. + +`pin`: the Arduino pin number. + `ISR`: the ISR to call when the interrupt occurs; this function must take no parameters and return nothing. This function is sometimes referred to as an interrupt service routine. + `mode`: defines when the interrupt should be triggered. Four constants are predefined as valid values: + diff --git a/Language/Functions/External Interrupts/detachInterrupt.adoc b/Language/Functions/External Interrupts/detachInterrupt.adoc index 993164063..f9e7cc395 100644 --- a/Language/Functions/External Interrupts/detachInterrupt.adoc +++ b/Language/Functions/External Interrupts/detachInterrupt.adoc @@ -31,7 +31,7 @@ Turns off the given interrupt. [float] === Parameters `interrupt`: the number of the interrupt to disable (see link:../attachinterrupt[attachInterrupt()] for more details). + -`pin`: the pin number of the interrupt to disable +`pin`: the Arduino pin number of the interrupt to disable [float] From b309ab7f11ce214fbfae37688a3dce950220fd1f Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 18 Feb 2019 20:48:23 -0800 Subject: [PATCH 024/298] Use Unix EOL in all files Use consistent EOL across all files, following the Unix EOL convention established by the reference example files. --- .../Functions/Characters/isUpperCase.adoc | 148 ++++----- .../Arithmetic Operators/addition.adoc | 178 +++++----- .../Arithmetic Operators/assignment.adoc | 140 ++++---- .../Arithmetic Operators/division.adoc | 172 +++++----- .../Arithmetic Operators/multiplication.adoc | 182 +++++----- .../Arithmetic Operators/subtraction.adoc | 182 +++++----- .../Bitwise Operators/bitshiftLeft.adoc | 242 +++++++------- .../Bitwise Operators/bitshiftRight.adoc | 194 +++++------ .../Bitwise Operators/bitwiseAnd.adoc | 166 +++++----- .../Bitwise Operators/bitwiseNot.adoc | 152 ++++----- .../Bitwise Operators/bitwiseOr.adoc | 162 ++++----- .../Bitwise Operators/bitwiseXor.adoc | 170 +++++----- .../Boolean Operators/logicalAnd.adoc | 128 ++++---- .../Boolean Operators/logicalNot.adoc | 144 ++++---- .../Boolean Operators/logicalOr.adoc | 132 ++++---- .../Compound Operators/compoundAddition.adoc | 136 ++++---- .../compoundBitwiseAnd.adoc | 238 +++++++------- .../Compound Operators/compoundBitwiseOr.adoc | 224 ++++++------- .../compoundBitwiseXor.adoc | 224 ++++++------- .../Compound Operators/compoundDivision.adoc | 142 ++++---- .../compoundMultiplication.adoc | 142 ++++---- .../Compound Operators/compoundRemainder.adoc | 156 ++++----- .../compoundSubtraction.adoc | 138 ++++---- .../Compound Operators/decrement.adoc | 148 ++++----- .../Compound Operators/increment.adoc | 144 ++++---- .../Structure/Control Structure/break.adoc | 130 ++++---- .../Structure/Control Structure/continue.adoc | 130 ++++---- .../Structure/Control Structure/doWhile.adoc | 148 ++++----- .../Structure/Control Structure/else.adoc | 164 ++++----- Language/Structure/Control Structure/for.adoc | 236 ++++++------- .../Structure/Control Structure/goto.adoc | 172 +++++----- Language/Structure/Control Structure/if.adoc | 212 ++++++------ .../Structure/Control Structure/return.adoc | 180 +++++----- .../Control Structure/switchCase.adoc | 202 ++++++------ .../Structure/Control Structure/while.adoc | 154 ++++----- .../Further Syntax/blockComment.adoc | 162 ++++----- Language/Structure/Further Syntax/define.adoc | 190 +++++------ .../Structure/Further Syntax/include.adoc | 170 +++++----- .../Structure/Further Syntax/semicolon.adoc | 128 ++++---- .../Further Syntax/singleLineComment.adoc | 140 ++++---- .../Pointer Access Operators/dereference.adoc | 142 ++++---- .../Pointer Access Operators/reference.adoc | 144 ++++---- Language/Structure/Sketch/loop.adoc | 138 ++++---- Language/Structure/Sketch/setup.adoc | 120 +++---- Language/Variables/Constants/constants.adoc | 262 +++++++-------- .../Constants/floatingPointConstants.adoc | 160 ++++----- .../Variables/Constants/integerConstants.adoc | 286 ++++++++-------- .../Data Types/String/Functions/c_str.adoc | 114 +++---- .../Data Types/String/Functions/charAt.adoc | 116 +++---- .../String/Functions/compareTo.adoc | 122 +++---- .../Data Types/String/Functions/concat.adoc | 118 +++---- .../Data Types/String/Functions/endsWith.adoc | 118 +++---- .../Data Types/String/Functions/equals.adoc | 116 +++---- .../String/Functions/equalsIgnoreCase.adoc | 118 +++---- .../Data Types/String/Functions/getBytes.adoc | 118 +++---- .../Data Types/String/Functions/indexOf.adoc | 122 +++---- .../String/Functions/lastIndexOf.adoc | 120 +++---- .../Data Types/String/Functions/length.adoc | 114 +++---- .../Data Types/String/Functions/remove.adoc | 146 ++++----- .../Data Types/String/Functions/replace.adoc | 118 +++---- .../Data Types/String/Functions/reserve.adoc | 176 +++++----- .../String/Functions/setCharAt.adoc | 118 +++---- .../String/Functions/startsWith.adoc | 116 +++---- .../String/Functions/substring.adoc | 120 +++---- .../String/Functions/toCharArray.adoc | 118 +++---- .../Data Types/String/Functions/toDouble.adoc | 114 +++---- .../Data Types/String/Functions/toFloat.adoc | 114 +++---- .../Data Types/String/Functions/toInt.adoc | 114 +++---- .../String/Functions/toLowerCase.adoc | 114 +++---- .../String/Functions/toUpperCase.adoc | 112 +++---- .../Data Types/String/Functions/trim.adoc | 114 +++---- .../Data Types/String/Operators/append.adoc | 118 +++---- .../String/Operators/comparison.adoc | 114 +++---- .../String/Operators/concatenation.adoc | 122 +++---- .../String/Operators/differentFrom.adoc | 122 +++---- .../String/Operators/elementAccess.adoc | 122 +++---- .../String/Operators/greaterThan.adoc | 124 +++---- .../Operators/greaterThanOrEqualTo.adoc | 116 +++---- .../Data Types/String/Operators/lessThan.adoc | 116 +++---- .../String/Operators/lessThanOrEqualTo.adoc | 126 +++---- .../Variables/Data Types/stringObject.adoc | 310 +++++++++--------- 81 files changed, 6117 insertions(+), 6117 deletions(-) diff --git a/Language/Functions/Characters/isUpperCase.adoc b/Language/Functions/Characters/isUpperCase.adoc index d03d3bacd..691271f4f 100644 --- a/Language/Functions/Characters/isUpperCase.adoc +++ b/Language/Functions/Characters/isUpperCase.adoc @@ -1,74 +1,74 @@ ---- -title: "isUpperCase()" -categories: [ "Functions" ] -subCategories: [ "Characters" ] ---- - -= isUpperCase(thisChar) - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Analyse if a char is upper case (that is, a letter in upper case). Returns true if thisChar is upper case. -[%hardbreaks] - - -[float] -=== Syntax -`isUpperCase(thisChar)` - - -[float] -=== Parameters -`thisChar`: variable. Allowed data types: `char`. - - -[float] -=== Returns -`true`: if thisChar is upper case. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -if (isUpperCase(myChar)) { // tests if myChar is an upper case letter - Serial.println("The character is upper case"); -} -else { - Serial.println("The character is not upper case"); -} ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../../variables/data-types/char[char] -* #LANGUAGE# link:../../../structure/control-structure/if[if (conditional operators)] -* #LANGUAGE# link:../../../structure/control-structure/while[while (conditional operators)] -* #LANGUAGE# link:../../communication/serial/read[read()] - --- -// SEE ALSO SECTION ENDS +--- +title: "isUpperCase()" +categories: [ "Functions" ] +subCategories: [ "Characters" ] +--- + += isUpperCase(thisChar) + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Analyse if a char is upper case (that is, a letter in upper case). Returns true if thisChar is upper case. +[%hardbreaks] + + +[float] +=== Syntax +`isUpperCase(thisChar)` + + +[float] +=== Parameters +`thisChar`: variable. Allowed data types: `char`. + + +[float] +=== Returns +`true`: if thisChar is upper case. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +if (isUpperCase(myChar)) { // tests if myChar is an upper case letter + Serial.println("The character is upper case"); +} +else { + Serial.println("The character is not upper case"); +} +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../../variables/data-types/char[char] +* #LANGUAGE# link:../../../structure/control-structure/if[if (conditional operators)] +* #LANGUAGE# link:../../../structure/control-structure/while[while (conditional operators)] +* #LANGUAGE# link:../../communication/serial/read[read()] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/addition.adoc b/Language/Structure/Arithmetic Operators/addition.adoc index e1c3877e0..ac1573e9b 100644 --- a/Language/Structure/Arithmetic Operators/addition.adoc +++ b/Language/Structure/Arithmetic Operators/addition.adoc @@ -1,89 +1,89 @@ ---- -title: "+" -title_expanded: "addition" -categories: [ "Structure" ] -subCategories: [ "Arithmetic Operators" ] ---- - - - - - -= + Addition - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Addition* is one of the four primary arithmetic operations. The operator `+` (plus) operates on two operands to produce the sum. -[%hardbreaks] - - -[float] -=== Syntax -`sum = operand1 + operand2;` - -[float] -=== Parameters -`sum`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 5; -int b = 10; -int c = 0; -c = a + b; // the variable 'c' gets a value of 15 after this statement is executed ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -1. The addition operation can overflow if the result is larger than that which can be stored in the data type (e.g. adding 1 to an integer with the value 32,767 gives -32,768). - -2. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. - -3. If the operands are of float / double data type and the variable that stores the sum is an integer, then only the integral part is stored and the fractional part of the number is lost. - -[source,arduino] ----- -float a = 5.5; -float b = 6.6; -int c = 0; -c = a + b; // the variable 'c' stores a value of 12 only as opposed to the expected sum of 12.1 ----- -[%hardbreaks] --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "+" +title_expanded: "addition" +categories: [ "Structure" ] +subCategories: [ "Arithmetic Operators" ] +--- + + + + + += + Addition + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Addition* is one of the four primary arithmetic operations. The operator `+` (plus) operates on two operands to produce the sum. +[%hardbreaks] + + +[float] +=== Syntax +`sum = operand1 + operand2;` + +[float] +=== Parameters +`sum`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 5; +int b = 10; +int c = 0; +c = a + b; // the variable 'c' gets a value of 15 after this statement is executed +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +1. The addition operation can overflow if the result is larger than that which can be stored in the data type (e.g. adding 1 to an integer with the value 32,767 gives -32,768). + +2. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. + +3. If the operands are of float / double data type and the variable that stores the sum is an integer, then only the integral part is stored and the fractional part of the number is lost. + +[source,arduino] +---- +float a = 5.5; +float b = 6.6; +int c = 0; +c = a + b; // the variable 'c' stores a value of 12 only as opposed to the expected sum of 12.1 +---- +[%hardbreaks] +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/assignment.adoc b/Language/Structure/Arithmetic Operators/assignment.adoc index c6d3ab862..0d1b00141 100644 --- a/Language/Structure/Arithmetic Operators/assignment.adoc +++ b/Language/Structure/Arithmetic Operators/assignment.adoc @@ -1,70 +1,70 @@ ---- -title: "=" -title_expanded: "assignment operator" -categories: [ "Structure" ] -subCategories: [ "Arithmetic Operators" ] ---- - - - - - -= = Assignment (single equal sign) - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The single equal sign `=` in the C++ programming language is called the assignment operator. It has a different meaning than in algebra class where it indicated an equation or equality. The assignment operator tells the microcontroller to evaluate whatever value or expression is on the right side of the equal sign, and store it in the variable to the left of the equal sign. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - - - -[source,arduino] ----- -int sensVal; // declare an integer variable named sensVal -sensVal = analogRead(0); // store the (digitized) input voltage at analog pin 0 in SensVal ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -1. The variable on the left side of the assignment operator ( = sign ) needs to be able to hold the value stored in it. If it is not large enough to hold a value, the value stored in the variable will be incorrect. - -2. Don't confuse the assignment operator [ = ] (single equal sign) with the comparison operator [ == ] (double equal signs), which evaluates whether two expressions are equal. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - -// SEE ALSO SECTION STARTS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../control-structure/if[if (conditional operators)] -* #LANGUAGE# link:../../../variables/data-types/char[char] -* #LANGUAGE# link:../../../variables/data-types/int[int] -* #LANGUAGE# link:../../../variables/data-types/long[long] - --- -// SEE ALSO SECTION ENDS +--- +title: "=" +title_expanded: "assignment operator" +categories: [ "Structure" ] +subCategories: [ "Arithmetic Operators" ] +--- + + + + + += = Assignment (single equal sign) + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The single equal sign `=` in the C++ programming language is called the assignment operator. It has a different meaning than in algebra class where it indicated an equation or equality. The assignment operator tells the microcontroller to evaluate whatever value or expression is on the right side of the equal sign, and store it in the variable to the left of the equal sign. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + + + +[source,arduino] +---- +int sensVal; // declare an integer variable named sensVal +sensVal = analogRead(0); // store the (digitized) input voltage at analog pin 0 in SensVal +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +1. The variable on the left side of the assignment operator ( = sign ) needs to be able to hold the value stored in it. If it is not large enough to hold a value, the value stored in the variable will be incorrect. + +2. Don't confuse the assignment operator [ = ] (single equal sign) with the comparison operator [ == ] (double equal signs), which evaluates whether two expressions are equal. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + +// SEE ALSO SECTION STARTS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../control-structure/if[if (conditional operators)] +* #LANGUAGE# link:../../../variables/data-types/char[char] +* #LANGUAGE# link:../../../variables/data-types/int[int] +* #LANGUAGE# link:../../../variables/data-types/long[long] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/division.adoc b/Language/Structure/Arithmetic Operators/division.adoc index c7c4c2518..7fd4fea5e 100644 --- a/Language/Structure/Arithmetic Operators/division.adoc +++ b/Language/Structure/Arithmetic Operators/division.adoc @@ -1,86 +1,86 @@ ---- -title: "/" -title_expanded: "division" -categories: [ "Structure" ] -subCategories: [ "Arithmetic Operators" ] ---- - - - - - -= / Division - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Division* is one of the four primary arithmetic operations. The operator `/` (slash) operates on two operands to produce the result. -[%hardbreaks] - - -[float] -=== Syntax -`result = numerator / denominator;` - - -[float] -=== Parameters -`result`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`numerator`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`denominator`: *non zero* variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 50; -int b = 10; -int c = 0; -c = a / b; // the variable 'c' gets a value of 5 after this statement is executed ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -1. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. - -2. If the operands are of float / double data type and the variable that stores the sum is an integer, then only the integral part is stored and the fractional part of the number is lost. - -[source,arduino] ----- -float a = 55.5; -float b = 6.6; -int c = 0; -c = a / b; // the variable 'c' stores a value of 8 only as opposed to the expected result of 8.409 ----- -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - -// SEE ALSO SECTION STARTS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "/" +title_expanded: "division" +categories: [ "Structure" ] +subCategories: [ "Arithmetic Operators" ] +--- + + + + + += / Division + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Division* is one of the four primary arithmetic operations. The operator `/` (slash) operates on two operands to produce the result. +[%hardbreaks] + + +[float] +=== Syntax +`result = numerator / denominator;` + + +[float] +=== Parameters +`result`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`numerator`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`denominator`: *non zero* variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 50; +int b = 10; +int c = 0; +c = a / b; // the variable 'c' gets a value of 5 after this statement is executed +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +1. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. + +2. If the operands are of float / double data type and the variable that stores the sum is an integer, then only the integral part is stored and the fractional part of the number is lost. + +[source,arduino] +---- +float a = 55.5; +float b = 6.6; +int c = 0; +c = a / b; // the variable 'c' stores a value of 8 only as opposed to the expected result of 8.409 +---- +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + +// SEE ALSO SECTION STARTS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/multiplication.adoc b/Language/Structure/Arithmetic Operators/multiplication.adoc index 135022ce7..6cc778fbf 100644 --- a/Language/Structure/Arithmetic Operators/multiplication.adoc +++ b/Language/Structure/Arithmetic Operators/multiplication.adoc @@ -1,91 +1,91 @@ ---- -title: "*" -title_expanded: "multiplication" -categories: [ "Structure" ] -subCategories: [ "Arithmetic Operators" ] ---- - - - - - -= * Multiplication - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Multiplication* is one of the four primary arithmetic operations. The operator `*` (asterisk) operates on two operands to produce the product. -[%hardbreaks] - - -[float] -=== Syntax -`product = operand1 * operand2;` - - -[float] -=== Parameters -`product`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 5; -int b = 10; -int c = 0; -c = a * b; // the variable 'c' gets a value of 50 after this statement is executed ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -1. The multiplication operation can overflow if the result is bigger than that which can be stored in the data type. - -2. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. - -3. If the operands are of float / double data type and the variable that stores the product is an integer, then only the integral part is stored and the fractional part of the number is lost. - -[source,arduino] ----- -float a = 5.5; -float b = 6.6; -int c = 0; -c = a * b; // the variable 'c' stores a value of 36 only as opposed to the expected product of 36.3 ----- -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION STARTS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "*" +title_expanded: "multiplication" +categories: [ "Structure" ] +subCategories: [ "Arithmetic Operators" ] +--- + + + + + += * Multiplication + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Multiplication* is one of the four primary arithmetic operations. The operator `*` (asterisk) operates on two operands to produce the product. +[%hardbreaks] + + +[float] +=== Syntax +`product = operand1 * operand2;` + + +[float] +=== Parameters +`product`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 5; +int b = 10; +int c = 0; +c = a * b; // the variable 'c' gets a value of 50 after this statement is executed +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +1. The multiplication operation can overflow if the result is bigger than that which can be stored in the data type. + +2. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. + +3. If the operands are of float / double data type and the variable that stores the product is an integer, then only the integral part is stored and the fractional part of the number is lost. + +[source,arduino] +---- +float a = 5.5; +float b = 6.6; +int c = 0; +c = a * b; // the variable 'c' stores a value of 36 only as opposed to the expected product of 36.3 +---- +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION STARTS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Arithmetic Operators/subtraction.adoc b/Language/Structure/Arithmetic Operators/subtraction.adoc index 3a73fdac2..2644f5269 100644 --- a/Language/Structure/Arithmetic Operators/subtraction.adoc +++ b/Language/Structure/Arithmetic Operators/subtraction.adoc @@ -1,91 +1,91 @@ ---- -title: "-" -title_expanded: "subtraction" -categories: [ "Structure" ] -subCategories: [ "Arithmetic Operators" ] ---- - - - - - -= - Subtraction - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Subtraction* is one of the four primary arithmetic operations. The operator `-` (minus) operates on two operands to produce the difference of the second from the first. -[%hardbreaks] - - -[float] -=== Syntax -`difference = operand1 - operand2;` - - -[float] -=== Parameters -`difference`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 5; -int b = 10; -int c = 0; -c = a - b; // the variable 'c' gets a value of -5 after this statement is executed ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -1. The subtraction operation can overflow if the result is smaller than that which can be stored in the data type (e.g. subtracting 1 from an integer with the value -32,768 gives 32,767). - -2. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. - -3. If the operands are of float / double data type and the variable that stores the difference is an integer, then only the integral part is stored and the fractional part of the number is lost. - -[source,arduino] ----- -float a = 5.5; -float b = 6.6; -int c = 0; -c = a - b; // the variable 'c' stores a value of -1 only as opposed to the expected difference of -1.1 ----- -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION STARTS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "-" +title_expanded: "subtraction" +categories: [ "Structure" ] +subCategories: [ "Arithmetic Operators" ] +--- + + + + + += - Subtraction + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Subtraction* is one of the four primary arithmetic operations. The operator `-` (minus) operates on two operands to produce the difference of the second from the first. +[%hardbreaks] + + +[float] +=== Syntax +`difference = operand1 - operand2;` + + +[float] +=== Parameters +`difference`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand1`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`operand2`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 5; +int b = 10; +int c = 0; +c = a - b; // the variable 'c' gets a value of -5 after this statement is executed +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +1. The subtraction operation can overflow if the result is smaller than that which can be stored in the data type (e.g. subtracting 1 from an integer with the value -32,768 gives 32,767). + +2. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. + +3. If the operands are of float / double data type and the variable that stores the difference is an integer, then only the integral part is stored and the fractional part of the number is lost. + +[source,arduino] +---- +float a = 5.5; +float b = 6.6; +int c = 0; +c = a - b; // the variable 'c' stores a value of -1 only as opposed to the expected difference of -1.1 +---- +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION STARTS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitshiftLeft.adoc b/Language/Structure/Bitwise Operators/bitshiftLeft.adoc index 5fc3c2098..5a4c97a5a 100644 --- a/Language/Structure/Bitwise Operators/bitshiftLeft.adoc +++ b/Language/Structure/Bitwise Operators/bitshiftLeft.adoc @@ -1,121 +1,121 @@ ---- -title: "<<" -title_expanded: bitshift left -categories: [ "Structure" ] -subCategories: [ "Bitwise Operators" ] ---- - - - - - -= << Bitshift Left - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The left shift operator `<<` causes the bits of the left operand to be shifted *left* by the number of positions specified by the right operand. -[%hardbreaks] - - -[float] -=== Syntax -`variable << number_of_bits;` - - -[float] -=== Parameters -`variable`: Allowed data types: `byte`, `int`, `long`. + -`number_of_bits`: a number that is < = 32. Allowed data types: `int`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 5; // binary: 0000000000000101 -int b = a << 3; // binary: 0000000000101000, or 40 in decimal ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -When you shift a value x by y bits (x << y), the leftmost y bits in x are lost, literally shifted out of existence: - -[source,arduino] ----- -int x = 5; // binary: 0000000000000101 -int y = 14; -int result = x << y; // binary: 0100000000000000 - the first 1 in 101 was discarded ----- - -If you are certain that none of the ones in a value are being shifted into oblivion, a simple way to think of the left-shift operator is that it multiplies the left operand by 2 raised to the right operand power. For example, to generate powers of 2, the following expressions can be employed: - -[source,arduino] ----- - Operation Result - --------- ------ - 1 << 0 1 - 1 << 1 2 - 1 << 2 4 - 1 << 3 8 - ... - 1 << 8 256 - 1 << 9 512 - 1 << 10 1024 - ... ----- - -The following example can be used to print out the value of a received byte to the serial monitor, using the left shift operator to move along the byte from bottom(LSB) to top (MSB), and print out its Binary value: - -[source,arduino] ----- -// Prints out Binary value (1 or 0) of byte -void printOut1(int c) { - for (int bits = 7; bits > -1; bits--) { - // Compare bits 7-0 in byte - if (c & (1 << bits)) { - Serial.print("1"); - } - else { - Serial.print("0"); - } - } -} ----- -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -//SEE ALSO SECTION STARTS -[#see_also] --- - -[float] -=== See also - -[role="language"] - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] - --- -//SEE ALSO SECTION ENDS - +--- +title: "<<" +title_expanded: bitshift left +categories: [ "Structure" ] +subCategories: [ "Bitwise Operators" ] +--- + + + + + += << Bitshift Left + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The left shift operator `<<` causes the bits of the left operand to be shifted *left* by the number of positions specified by the right operand. +[%hardbreaks] + + +[float] +=== Syntax +`variable << number_of_bits;` + + +[float] +=== Parameters +`variable`: Allowed data types: `byte`, `int`, `long`. + +`number_of_bits`: a number that is < = 32. Allowed data types: `int`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 5; // binary: 0000000000000101 +int b = a << 3; // binary: 0000000000101000, or 40 in decimal +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +When you shift a value x by y bits (x << y), the leftmost y bits in x are lost, literally shifted out of existence: + +[source,arduino] +---- +int x = 5; // binary: 0000000000000101 +int y = 14; +int result = x << y; // binary: 0100000000000000 - the first 1 in 101 was discarded +---- + +If you are certain that none of the ones in a value are being shifted into oblivion, a simple way to think of the left-shift operator is that it multiplies the left operand by 2 raised to the right operand power. For example, to generate powers of 2, the following expressions can be employed: + +[source,arduino] +---- + Operation Result + --------- ------ + 1 << 0 1 + 1 << 1 2 + 1 << 2 4 + 1 << 3 8 + ... + 1 << 8 256 + 1 << 9 512 + 1 << 10 1024 + ... +---- + +The following example can be used to print out the value of a received byte to the serial monitor, using the left shift operator to move along the byte from bottom(LSB) to top (MSB), and print out its Binary value: + +[source,arduino] +---- +// Prints out Binary value (1 or 0) of byte +void printOut1(int c) { + for (int bits = 7; bits > -1; bits--) { + // Compare bits 7-0 in byte + if (c & (1 << bits)) { + Serial.print("1"); + } + else { + Serial.print("0"); + } + } +} +---- +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +//SEE ALSO SECTION STARTS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] + +-- +//SEE ALSO SECTION ENDS + diff --git a/Language/Structure/Bitwise Operators/bitshiftRight.adoc b/Language/Structure/Bitwise Operators/bitshiftRight.adoc index 2d21f89c6..f2f98b840 100644 --- a/Language/Structure/Bitwise Operators/bitshiftRight.adoc +++ b/Language/Structure/Bitwise Operators/bitshiftRight.adoc @@ -1,97 +1,97 @@ ---- -title: ">>" -title_expanded: bitshift right -categories: [ "Structure" ] -subCategories: [ "Bitwise Operators" ] ---- - - - - - -= >> Bitshift Right - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The right shift operator `>>` causes the bits of the left operand to be shifted *right* by the number of positions specified by the right operand. -[%hardbreaks] - - -[float] -=== Syntax -`variable >> number_of_bits;` - - -[float] -=== Parameters -`variable`: Allowed data types: `byte`, `int`, `long`. + -`number_of_bits`: a number that is < = 32. Allowed data types: `int`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 40; // binary: 0000000000101000 -int b = a >> 3; // binary: 0000000000000101, or 5 in decimal ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -When you shift x right by y bits (x >> y), and the highest bit in x is a 1, the behavior depends on the exact data type of x. If x is of type int, the highest bit is the sign bit, determining whether x is negative or not, as we have discussed above. In that case, the sign bit is copied into lower bits, for esoteric historical reasons: - -[source,arduino] ----- -int x = -16; // binary: 1111111111110000 -int y = 3; -int result = x >> y; // binary: 1111111111111110 ----- -This behavior, called sign extension, is often not the behavior you want. Instead, you may wish zeros to be shifted in from the left. It turns out that the right shift rules are different for unsigned int expressions, so you can use a typecast to suppress ones being copied from the left: - -[source,arduino] ----- -int x = -16; // binary: 1111111111110000 -int y = 3; -int result = (unsigned int)x >> y; // binary: 0001111111111110 ----- -If you are careful to avoid sign extension, you can use the right-shift operator `>>` as a way to divide by powers of 2. For example: - -[source,arduino] ----- -int x = 1000; -int y = x >> 3; // integer division of 1000 by 8, causing y = 125. ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] - -[role="example"] -* #EXAMPLE# http://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] - --- -// SEE ALSO SECTION ENDS +--- +title: ">>" +title_expanded: bitshift right +categories: [ "Structure" ] +subCategories: [ "Bitwise Operators" ] +--- + + + + + += >> Bitshift Right + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The right shift operator `>>` causes the bits of the left operand to be shifted *right* by the number of positions specified by the right operand. +[%hardbreaks] + + +[float] +=== Syntax +`variable >> number_of_bits;` + + +[float] +=== Parameters +`variable`: Allowed data types: `byte`, `int`, `long`. + +`number_of_bits`: a number that is < = 32. Allowed data types: `int`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 40; // binary: 0000000000101000 +int b = a >> 3; // binary: 0000000000000101, or 5 in decimal +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +When you shift x right by y bits (x >> y), and the highest bit in x is a 1, the behavior depends on the exact data type of x. If x is of type int, the highest bit is the sign bit, determining whether x is negative or not, as we have discussed above. In that case, the sign bit is copied into lower bits, for esoteric historical reasons: + +[source,arduino] +---- +int x = -16; // binary: 1111111111110000 +int y = 3; +int result = x >> y; // binary: 1111111111111110 +---- +This behavior, called sign extension, is often not the behavior you want. Instead, you may wish zeros to be shifted in from the left. It turns out that the right shift rules are different for unsigned int expressions, so you can use a typecast to suppress ones being copied from the left: + +[source,arduino] +---- +int x = -16; // binary: 1111111111110000 +int y = 3; +int result = (unsigned int)x >> y; // binary: 0001111111111110 +---- +If you are careful to avoid sign extension, you can use the right-shift operator `>>` as a way to divide by powers of 2. For example: + +[source,arduino] +---- +int x = 1000; +int y = x >> 3; // integer division of 1000 by 8, causing y = 125. +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +[role="example"] +* #EXAMPLE# http://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitwiseAnd.adoc b/Language/Structure/Bitwise Operators/bitwiseAnd.adoc index 018779152..986a37fcc 100644 --- a/Language/Structure/Bitwise Operators/bitwiseAnd.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseAnd.adoc @@ -1,83 +1,83 @@ ---- -title: "&" -title_expanded: bitwise and -categories: [ "Structure" ] -subCategories: [ "Bitwise Operators" ] ---- - - - - - -= & Bitwise AND - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The bitwise AND operator in C++ is a single ampersand `&`, used between two other integer expressions. Bitwise AND operates on each bit position of the surrounding expressions independently, according to this rule: if both input bits are 1, the resulting output is 1, otherwise the output is 0. -[%hardbreaks] - -Another way of expressing this is: - - 0 0 1 1 operand1 - 0 1 0 1 operand2 - ---------- - 0 0 0 1 (operand1 & operand2) - returned result -[%hardbreaks] - -In Arduino, the type int is a 16-bit value, so using & between two int expressions causes 16 simultaneous AND operations to occur. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -In a code fragment like: - -[source,arduino] ----- -int a = 92; // in binary: 0000000001011100 -int b = 101; // in binary: 0000000001100101 -int c = a & b; // result: 0000000001000100, or 68 in decimal. ----- -Each of the 16 bits in a and b are processed by using the bitwise AND, and all 16 resulting bits are stored in c, resulting in the value 01000100 in binary, which is 68 in decimal. -[%hardbreaks] - -One of the most common uses of bitwise AND is to select a particular bit (or bits) from an integer value, often called masking. See below for an example (AVR architecture specific). - -[source,arduino] ----- -PORTD = PORTD & B00000011; // clear out bits 2 - 7, leave pins PD0 and PD1 untouched (xx & 11 == xx) ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - - -[role="language"] -* #LANGUAGE# link:../../boolean-operators/logicaland[&& Logical AND] - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] - --- -// SEE ALSO SECTION ENDS +--- +title: "&" +title_expanded: bitwise and +categories: [ "Structure" ] +subCategories: [ "Bitwise Operators" ] +--- + + + + + += & Bitwise AND + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The bitwise AND operator in C++ is a single ampersand `&`, used between two other integer expressions. Bitwise AND operates on each bit position of the surrounding expressions independently, according to this rule: if both input bits are 1, the resulting output is 1, otherwise the output is 0. +[%hardbreaks] + +Another way of expressing this is: + + 0 0 1 1 operand1 + 0 1 0 1 operand2 + ---------- + 0 0 0 1 (operand1 & operand2) - returned result +[%hardbreaks] + +In Arduino, the type int is a 16-bit value, so using & between two int expressions causes 16 simultaneous AND operations to occur. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +In a code fragment like: + +[source,arduino] +---- +int a = 92; // in binary: 0000000001011100 +int b = 101; // in binary: 0000000001100101 +int c = a & b; // result: 0000000001000100, or 68 in decimal. +---- +Each of the 16 bits in a and b are processed by using the bitwise AND, and all 16 resulting bits are stored in c, resulting in the value 01000100 in binary, which is 68 in decimal. +[%hardbreaks] + +One of the most common uses of bitwise AND is to select a particular bit (or bits) from an integer value, often called masking. See below for an example (AVR architecture specific). + +[source,arduino] +---- +PORTD = PORTD & B00000011; // clear out bits 2 - 7, leave pins PD0 and PD1 untouched (xx & 11 == xx) +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + + +[role="language"] +* #LANGUAGE# link:../../boolean-operators/logicaland[&& Logical AND] + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitwiseNot.adoc b/Language/Structure/Bitwise Operators/bitwiseNot.adoc index 446e507e8..7a35ec1a2 100644 --- a/Language/Structure/Bitwise Operators/bitwiseNot.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseNot.adoc @@ -1,76 +1,76 @@ ---- -title: "~" -title_expanded: bitwise not -categories: [ "Structure" ] -subCategories: [ "Bitwise Operators" ] ---- - - - - - -= ~ Bitwise NOT - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The bitwise NOT operator in C++ is the tilde character `~`. Unlike & and |, the bitwise NOT operator is applied to a single operand to its right. Bitwise NOT changes each bit to its opposite: 0 becomes 1, and 1 becomes 0. -[%hardbreaks] - -In other words: - - 0 1 operand1 - ----- - 1 0 ~operand1 -[%hardbreaks] --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 103; // binary: 0000000001100111 -int b = ~a; // binary: 1111111110011000 = -104 ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -You might be surprised to see a negative number like -104 as the result of this operation. This is because the highest bit in an int variable is the so-called sign bit. If the highest bit is 1, the number is interpreted as negative. This encoding of positive and negative numbers is referred to as two's complement. For more information, see the Wikipedia article on http://en.wikipedia.org/wiki/Twos_complement[two's complement^]. - -As an aside, it is interesting to note that for any integer x, ~x is the same as -x - 1. - -At times, the sign bit in a signed integer expression can cause some unwanted surprises. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - -// SEE ALSO BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] - --- -//SEE ALSO SECTION ENDS +--- +title: "~" +title_expanded: bitwise not +categories: [ "Structure" ] +subCategories: [ "Bitwise Operators" ] +--- + + + + + += ~ Bitwise NOT + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The bitwise NOT operator in C++ is the tilde character `~`. Unlike & and |, the bitwise NOT operator is applied to a single operand to its right. Bitwise NOT changes each bit to its opposite: 0 becomes 1, and 1 becomes 0. +[%hardbreaks] + +In other words: + + 0 1 operand1 + ----- + 1 0 ~operand1 +[%hardbreaks] +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 103; // binary: 0000000001100111 +int b = ~a; // binary: 1111111110011000 = -104 +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +You might be surprised to see a negative number like -104 as the result of this operation. This is because the highest bit in an int variable is the so-called sign bit. If the highest bit is 1, the number is interpreted as negative. This encoding of positive and negative numbers is referred to as two's complement. For more information, see the Wikipedia article on http://en.wikipedia.org/wiki/Twos_complement[two's complement^]. + +As an aside, it is interesting to note that for any integer x, ~x is the same as -x - 1. + +At times, the sign bit in a signed integer expression can cause some unwanted surprises. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] + +-- +//SEE ALSO SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitwiseOr.adoc b/Language/Structure/Bitwise Operators/bitwiseOr.adoc index 3b2d84c70..14d894b8a 100644 --- a/Language/Structure/Bitwise Operators/bitwiseOr.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseOr.adoc @@ -1,81 +1,81 @@ ---- -title: "|" -title_expanded: bitwise or -categories: [ "Structure" ] -subCategories: [ "Bitwise Operators" ] ---- - - - - - -= | Bitwise OR - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The bitwise OR operator in C++ is the vertical bar symbol, |. Like the & operator, | operates independently each bit in its two surrounding integer expressions, but what it does is different (of course). The bitwise OR of two bits is 1 if either or both of the input bits is 1, otherwise it is 0. -[%hardbreaks] - -In other words: - - 0 0 1 1 operand1 - 0 1 0 1 operand2 - ---------- - 0 1 1 1 (operand1 | operand2) - returned result -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 92; // in binary: 0000000001011100 -int b = 101; // in binary: 0000000001100101 -int c = a | b; // result: 0000000001111101, or 125 in decimal. ----- -[%hardbreaks] - -One of the most common uses of the Bitwise OR is to set multiple bits in a bit-packed number. - -[source,arduino] ----- -// Note: This code is AVR architecture specific -// set direction bits for pins 2 to 7, leave PD0 and PD1 untouched (xx | 00 == xx) -// same as pinMode(pin, OUTPUT) for pins 2 to 7 on Uno or Nano -DDRD = DDRD | B11111100; ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - - -[role="language"] -* #LANGUAGE# link:../../boolean-operators/logicalor[|| Logical OR] - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] - --- -// SEE ALSO SECTION ENDS +--- +title: "|" +title_expanded: bitwise or +categories: [ "Structure" ] +subCategories: [ "Bitwise Operators" ] +--- + + + + + += | Bitwise OR + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The bitwise OR operator in C++ is the vertical bar symbol, |. Like the & operator, | operates independently each bit in its two surrounding integer expressions, but what it does is different (of course). The bitwise OR of two bits is 1 if either or both of the input bits is 1, otherwise it is 0. +[%hardbreaks] + +In other words: + + 0 0 1 1 operand1 + 0 1 0 1 operand2 + ---------- + 0 1 1 1 (operand1 | operand2) - returned result +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 92; // in binary: 0000000001011100 +int b = 101; // in binary: 0000000001100101 +int c = a | b; // result: 0000000001111101, or 125 in decimal. +---- +[%hardbreaks] + +One of the most common uses of the Bitwise OR is to set multiple bits in a bit-packed number. + +[source,arduino] +---- +// Note: This code is AVR architecture specific +// set direction bits for pins 2 to 7, leave PD0 and PD1 untouched (xx | 00 == xx) +// same as pinMode(pin, OUTPUT) for pins 2 to 7 on Uno or Nano +DDRD = DDRD | B11111100; +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + + +[role="language"] +* #LANGUAGE# link:../../boolean-operators/logicalor[|| Logical OR] + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Bitwise Operators/bitwiseXor.adoc b/Language/Structure/Bitwise Operators/bitwiseXor.adoc index affe474bd..d4677dbf9 100644 --- a/Language/Structure/Bitwise Operators/bitwiseXor.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseXor.adoc @@ -1,85 +1,85 @@ ---- -title: "^" -title_expanded: bitwise xor -categories: [ "Structure" ] -subCategories: [ "Bitwise Operators" ] ---- - - - - - -= ^ Bitwise XOR - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -There is a somewhat unusual operator in C++ called bitwise EXCLUSIVE OR, also known as bitwise XOR. (In English this is usually pronounced "eks-or".) The bitwise XOR operator is written using the caret symbol `^`. A bitwise XOR operation results in a 1 only if the input bits are different, else it results in a 0. -[%hardbreaks] - -Precisely, - - 0 0 1 1 operand1 - 0 1 0 1 operand2 - ---------- - 0 1 1 0 (operand1 ^ operand2) - returned result -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int x = 12; // binary: 1100 -int y = 10; // binary: 1010 -int z = x ^ y; // binary: 0110, or decimal 6 ----- -[%hardbreaks] - -The ^ operator is often used to toggle (i.e. change from 0 to 1, or 1 to 0) some of the bits in an integer expression. In a bitwise XOR operation if there is a 1 in the mask bit, that bit is inverted; if there is a 0, the bit is not inverted and stays the same. - -[source,arduino] ----- -// Note: This code uses registers specific to AVR microcontrollers (Uno, Nano, Leonardo, Mega, etc.) -// it will not compile for other architectures -void setup() { - DDRB = DDRB | B00100000; // set PB5 (pin 13 on Uno/Nano, pin 9 on Leonardo/Micro, pin 11 on Mega) as OUTPUT - Serial.begin(9600); -} - -void loop() { - PORTB = PORTB ^ B00100000; // invert PB5, leave others untouched - delay(100); -} ----- - - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] - --- -// SEE ALSO SECTION ENDS +--- +title: "^" +title_expanded: bitwise xor +categories: [ "Structure" ] +subCategories: [ "Bitwise Operators" ] +--- + + + + + += ^ Bitwise XOR + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +There is a somewhat unusual operator in C++ called bitwise EXCLUSIVE OR, also known as bitwise XOR. (In English this is usually pronounced "eks-or".) The bitwise XOR operator is written using the caret symbol `^`. A bitwise XOR operation results in a 1 only if the input bits are different, else it results in a 0. +[%hardbreaks] + +Precisely, + + 0 0 1 1 operand1 + 0 1 0 1 operand2 + ---------- + 0 1 1 0 (operand1 ^ operand2) - returned result +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int x = 12; // binary: 1100 +int y = 10; // binary: 1010 +int z = x ^ y; // binary: 0110, or decimal 6 +---- +[%hardbreaks] + +The ^ operator is often used to toggle (i.e. change from 0 to 1, or 1 to 0) some of the bits in an integer expression. In a bitwise XOR operation if there is a 1 in the mask bit, that bit is inverted; if there is a 0, the bit is not inverted and stays the same. + +[source,arduino] +---- +// Note: This code uses registers specific to AVR microcontrollers (Uno, Nano, Leonardo, Mega, etc.) +// it will not compile for other architectures +void setup() { + DDRB = DDRB | B00100000; // set PB5 (pin 13 on Uno/Nano, pin 9 on Leonardo/Micro, pin 11 on Mega) as OUTPUT + Serial.begin(9600); +} + +void loop() { + PORTB = PORTB ^ B00100000; // invert PB5, leave others untouched + delay(100); +} +---- + + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/playground/Code/BitMath[BitMath Tutorial^] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Boolean Operators/logicalAnd.adoc b/Language/Structure/Boolean Operators/logicalAnd.adoc index 69bd81114..b46a749cf 100644 --- a/Language/Structure/Boolean Operators/logicalAnd.adoc +++ b/Language/Structure/Boolean Operators/logicalAnd.adoc @@ -1,64 +1,64 @@ ---- -title: "&&" -title_expanded: logical and -categories: [ "Structure" ] -subCategories: [ "Boolean Operators" ] ---- - - - - - -= && Logical AND - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Logical AND* results in `true` *only* if both operands are `true`. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -This operator can be used inside the condition of an link:../../control-structure/if[if] statement. - -[source,arduino] ----- -if (digitalRead(2) == HIGH && digitalRead(3) == HIGH) { // if BOTH the switches read HIGH - // statements -} ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Make sure you don't mistake the boolean AND operator, && (double ampersand) for the bitwise AND operator & (single ampersand). They are entirely different beasts. - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../bitwise-operators/bitwiseand[& (Bitwise AND)] - --- -// SEE ALSO SECTION ENDS +--- +title: "&&" +title_expanded: logical and +categories: [ "Structure" ] +subCategories: [ "Boolean Operators" ] +--- + + + + + += && Logical AND + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Logical AND* results in `true` *only* if both operands are `true`. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +This operator can be used inside the condition of an link:../../control-structure/if[if] statement. + +[source,arduino] +---- +if (digitalRead(2) == HIGH && digitalRead(3) == HIGH) { // if BOTH the switches read HIGH + // statements +} +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Make sure you don't mistake the boolean AND operator, && (double ampersand) for the bitwise AND operator & (single ampersand). They are entirely different beasts. + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../bitwise-operators/bitwiseand[& (Bitwise AND)] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Boolean Operators/logicalNot.adoc b/Language/Structure/Boolean Operators/logicalNot.adoc index b4c1a7a8b..7fa92071e 100644 --- a/Language/Structure/Boolean Operators/logicalNot.adoc +++ b/Language/Structure/Boolean Operators/logicalNot.adoc @@ -1,72 +1,72 @@ ---- -title: "!" -title_expanded: logical not -categories: [ "Structure" ] -subCategories: [ "Boolean Operators" ] ---- - - - - - -= ! Logical NOT - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Logical NOT* results in a `true` if the operand is `false` and vice versa. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -This operator can be used inside the condition of an link:../../control-structure/if/[if] statement. - -[source,arduino] ----- -if (!x) { // if x is not true - // statements -} ----- - -It can be used to invert the boolean value. -[source,arduino] ----- -x = !y; // the inverted value of y is stored in x ----- - - -[%hardbreaks] - -[float] -=== Notes and Warnings -The bitwise not ~ (tilde) looks much different than the boolean not ! (exclamation point or "bang" as the programmers say) but you still have to be sure which one you want where. - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../bitwise-operators/bitwisenot[~ Bitwise NOT] - --- -// SEE ALSO SECTION ENDS +--- +title: "!" +title_expanded: logical not +categories: [ "Structure" ] +subCategories: [ "Boolean Operators" ] +--- + + + + + += ! Logical NOT + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Logical NOT* results in a `true` if the operand is `false` and vice versa. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +This operator can be used inside the condition of an link:../../control-structure/if/[if] statement. + +[source,arduino] +---- +if (!x) { // if x is not true + // statements +} +---- + +It can be used to invert the boolean value. +[source,arduino] +---- +x = !y; // the inverted value of y is stored in x +---- + + +[%hardbreaks] + +[float] +=== Notes and Warnings +The bitwise not ~ (tilde) looks much different than the boolean not ! (exclamation point or "bang" as the programmers say) but you still have to be sure which one you want where. + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../bitwise-operators/bitwisenot[~ Bitwise NOT] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Boolean Operators/logicalOr.adoc b/Language/Structure/Boolean Operators/logicalOr.adoc index 4b2fc8727..5032e7aae 100644 --- a/Language/Structure/Boolean Operators/logicalOr.adoc +++ b/Language/Structure/Boolean Operators/logicalOr.adoc @@ -1,66 +1,66 @@ ---- -title: "||" -title_expanded: logical or -categories: [ "Structure" ] -subCategories: [ "Boolean Operators" ] ---- - - - - - -= || Logical OR - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Logical OR* results in a `true` if either of the two operands is `true`. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -This operator can be used inside the condition of an link:../../control-structure/if[if] statement. - -[source,arduino] ----- -if (x > 0 || y > 0) { // if either x or y is greater than zero - // statements -} ----- - -[%hardbreaks] - -[float] -=== Notes and Warnings -Do not confuse the boolean || (double pipe) operator with the bitwise OR operator | (single pipe). -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../bitwise-operators/bitwiseor[| Bitwise OR] - --- -// SEE ALSO SECTION ENDS +--- +title: "||" +title_expanded: logical or +categories: [ "Structure" ] +subCategories: [ "Boolean Operators" ] +--- + + + + + += || Logical OR + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Logical OR* results in a `true` if either of the two operands is `true`. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +This operator can be used inside the condition of an link:../../control-structure/if[if] statement. + +[source,arduino] +---- +if (x > 0 || y > 0) { // if either x or y is greater than zero + // statements +} +---- + +[%hardbreaks] + +[float] +=== Notes and Warnings +Do not confuse the boolean || (double pipe) operator with the bitwise OR operator | (single pipe). +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../bitwise-operators/bitwiseor[| Bitwise OR] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundAddition.adoc b/Language/Structure/Compound Operators/compoundAddition.adoc index 97aad457a..e5be622f6 100644 --- a/Language/Structure/Compound Operators/compoundAddition.adoc +++ b/Language/Structure/Compound Operators/compoundAddition.adoc @@ -1,68 +1,68 @@ ---- -title: "+=" -title_expanded: compound addition -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= += Compound Addition - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -This is a convenient shorthand to perform addition on a variable with another constant or variable. -[%hardbreaks] - - -[float] -=== Syntax -`x += y; // equivalent to the expression x = x + y;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -x = 2; -x += 4; // x now contains 6 ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../arithmetic-operators/addition[Normal Addition] - --- -// SEE ALSO SECTION ENDS +--- +title: "+=" +title_expanded: compound addition +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += += Compound Addition + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This is a convenient shorthand to perform addition on a variable with another constant or variable. +[%hardbreaks] + + +[float] +=== Syntax +`x += y; // equivalent to the expression x = x + y;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +x = 2; +x += 4; // x now contains 6 +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../arithmetic-operators/addition[Normal Addition] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc b/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc index c37af3726..2e33d7317 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc @@ -1,119 +1,119 @@ ---- -title: "&=" -title_expanded: compound bitwise and -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= &= Compound Bitwise AND - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The compound bitwise AND operator `&=` is often used with a variable and a constant to force particular bits in a variable to the LOW state (to 0). This is often referred to in programming guides as "clearing" or "resetting" bits. -[%hardbreaks] - -A review of the Bitwise AND `&` operator: - - 0 0 1 1 operand1 - 0 1 0 1 operand2 - ---------- - 0 0 0 1 (operand1 & operand2) - returned result -[%hardbreaks] - -[float] -=== Syntax -`x &= y; // equivalent to x = x & y;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `char`, `int`, `long`. + -`y`: variable or constant. Allowed data types: `char`, `int`, `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -Bits that are "bitwise ANDed" with 0 are cleared to 0 so, if myByte is a byte variable, - -[source,arduino] ----- -myByte & B00000000 = 0; ----- - -Bits that are "bitwise ANDed" with 1 are unchanged so, - -[source,arduino] ----- -myByte & B11111111 = myByte; ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero (hmmm something philosophical there?) - -Consequently - to clear (set to zero) bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise AND operator (&=) with the constant B11111100 - - 1 0 1 0 1 0 1 0 variable - 1 1 1 1 1 1 0 0 mask - ---------------------- - 1 0 1 0 1 0 0 0 - - bits unchanged - bits cleared - -Here is the same representation with the variable's bits replaced with the symbol x - - x x x x x x x x variable - 1 1 1 1 1 1 0 0 mask - ---------------------- - x x x x x x 0 0 - - bits unchanged - bits cleared - -So if: - -[source,arduino] ----- -myByte = B10101010; -myByte &= B11111100; // results in B10101000 ----- - -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../bitwise-operators/bitwiseand[& Bitwise AND] - --- -// SEE ALSO SECTION ENDS +--- +title: "&=" +title_expanded: compound bitwise and +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += &= Compound Bitwise AND + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The compound bitwise AND operator `&=` is often used with a variable and a constant to force particular bits in a variable to the LOW state (to 0). This is often referred to in programming guides as "clearing" or "resetting" bits. +[%hardbreaks] + +A review of the Bitwise AND `&` operator: + + 0 0 1 1 operand1 + 0 1 0 1 operand2 + ---------- + 0 0 0 1 (operand1 & operand2) - returned result +[%hardbreaks] + +[float] +=== Syntax +`x &= y; // equivalent to x = x & y;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `char`, `int`, `long`. + +`y`: variable or constant. Allowed data types: `char`, `int`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +Bits that are "bitwise ANDed" with 0 are cleared to 0 so, if myByte is a byte variable, + +[source,arduino] +---- +myByte & B00000000 = 0; +---- + +Bits that are "bitwise ANDed" with 1 are unchanged so, + +[source,arduino] +---- +myByte & B11111111 = myByte; +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero (hmmm something philosophical there?) + +Consequently - to clear (set to zero) bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise AND operator (&=) with the constant B11111100 + + 1 0 1 0 1 0 1 0 variable + 1 1 1 1 1 1 0 0 mask + ---------------------- + 1 0 1 0 1 0 0 0 + + bits unchanged + bits cleared + +Here is the same representation with the variable's bits replaced with the symbol x + + x x x x x x x x variable + 1 1 1 1 1 1 0 0 mask + ---------------------- + x x x x x x 0 0 + + bits unchanged + bits cleared + +So if: + +[source,arduino] +---- +myByte = B10101010; +myByte &= B11111100; // results in B10101000 +---- + +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../bitwise-operators/bitwiseand[& Bitwise AND] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundBitwiseOr.adoc b/Language/Structure/Compound Operators/compoundBitwiseOr.adoc index c2b4bafd5..815d98771 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseOr.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseOr.adoc @@ -1,112 +1,112 @@ ---- -title: "|=" -title_expanded: compound bitwise or -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - -= |= Compound Bitwise OR - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The compound bitwise OR operator `|=` is often used with a variable and a constant to "set" (set to 1) particular bits in a variable. -[%hardbreaks] - -A review of the Bitwise OR `|` operator: - - 0 0 1 1 operand1 - 0 1 0 1 operand2 - ---------- - 0 1 1 1 (operand1 | operand2) - returned result -[%hardbreaks] - -[float] -=== Syntax -`x |= y; // equivalent to x = x | y;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `char`, `int`, `long`. + -`y`: variable or constant. Allowed data types: `char`, `int`, `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -Bits that are "bitwise ORed" with 0 are unchanged, so if myByte is a byte variable, -[source,arduino] ----- -myByte | B00000000 = myByte; ----- - -Bits that are "bitwise ORed" with 1 are set to 1 so: -[source,arduino] ----- -myByte | B11111111 = B11111111; ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero. -[%hardbreaks] - -Consequently - to set bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise OR operator (|=) with the constant B00000011 - - 1 0 1 0 1 0 1 0 variable - 0 0 0 0 0 0 1 1 mask - ---------------------- - 1 0 1 0 1 0 1 1 - - bits unchanged - bits set - - -Here is the same representation with the variables bits replaced with the symbol x - - x x x x x x x x variable - 0 0 0 0 0 0 1 1 mask - ---------------------- - x x x x x x 1 1 - - bits unchanged - bits set - -So if: -[source,arduino] ----- -myByte = B10101010; -myByte |= B00000011 == B10101011; ----- - --- -// HOW TO USE SECTION ENDS - - - - -//SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../bitwise-operators/bitwiseor[| Bitwise OR] - --- -// SEE ALSO SECTION ENDS +--- +title: "|=" +title_expanded: compound bitwise or +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + += |= Compound Bitwise OR + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The compound bitwise OR operator `|=` is often used with a variable and a constant to "set" (set to 1) particular bits in a variable. +[%hardbreaks] + +A review of the Bitwise OR `|` operator: + + 0 0 1 1 operand1 + 0 1 0 1 operand2 + ---------- + 0 1 1 1 (operand1 | operand2) - returned result +[%hardbreaks] + +[float] +=== Syntax +`x |= y; // equivalent to x = x | y;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `char`, `int`, `long`. + +`y`: variable or constant. Allowed data types: `char`, `int`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +Bits that are "bitwise ORed" with 0 are unchanged, so if myByte is a byte variable, +[source,arduino] +---- +myByte | B00000000 = myByte; +---- + +Bits that are "bitwise ORed" with 1 are set to 1 so: +[source,arduino] +---- +myByte | B11111111 = B11111111; +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero. +[%hardbreaks] + +Consequently - to set bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise OR operator (|=) with the constant B00000011 + + 1 0 1 0 1 0 1 0 variable + 0 0 0 0 0 0 1 1 mask + ---------------------- + 1 0 1 0 1 0 1 1 + + bits unchanged + bits set + + +Here is the same representation with the variables bits replaced with the symbol x + + x x x x x x x x variable + 0 0 0 0 0 0 1 1 mask + ---------------------- + x x x x x x 1 1 + + bits unchanged + bits set + +So if: +[source,arduino] +---- +myByte = B10101010; +myByte |= B00000011 == B10101011; +---- + +-- +// HOW TO USE SECTION ENDS + + + + +//SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../bitwise-operators/bitwiseor[| Bitwise OR] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundBitwiseXor.adoc b/Language/Structure/Compound Operators/compoundBitwiseXor.adoc index 95758430c..267d44fd9 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseXor.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseXor.adoc @@ -1,112 +1,112 @@ ---- -title: "^=" -title_expanded: compound bitwise xor -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - -= ^= Compound Bitwise XOR - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The compound bitwise XOR operator `^=` is often used with a variable and a constant to toggle (invert) particular bits in a variable. -[%hardbreaks] - -A review of the Bitwise XOR `^` operator: - - 0 0 1 1 operand1 - 0 1 0 1 operand2 - ---------- - 0 1 1 0 (operand1 ^ operand2) - returned result -[%hardbreaks] - -[float] -=== Syntax -`x ^= y; // equivalent to x = x ^ y;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `char`, `int`, `long`. + -`y`: variable or constant. Allowed data types: `char`, `int`, `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -Bits that are "bitwise XORed" with 0 are left unchanged. So if myByte is a byte variable, -[source,arduino] ----- -myByte ^ B00000000 = myByte; ----- - -Bits that are "bitwise XORed" with 1 are toggled so: -[source,arduino] ----- -myByte ^ B11111111 = ~myByte; ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero. -[%hardbreaks] - -Consequently - to toggle bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise XOR operator (^=) with the constant B00000011 - - 1 0 1 0 1 0 1 0 variable - 0 0 0 0 0 0 1 1 mask - ---------------------- - 1 0 1 0 1 0 0 1 - - bits unchanged - bits toggled - - -Here is the same representation with the variables bits replaced with the symbol x. ~x represents the complement of x. - - x x x x x x x x variable - 0 0 0 0 0 0 1 1 mask - ---------------------- - x x x x x x ~x ~x - - bits unchanged - bits set - -So if: -[source,arduino] ----- -myByte = B10101010; -myByte ^= B00000011 == B10101001; ----- - --- -// HOW TO USE SECTION ENDS - - - - -//SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../bitwise-operators/bitwisexor[^ Bitwise XOR] - --- -// SEE ALSO SECTION ENDS +--- +title: "^=" +title_expanded: compound bitwise xor +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + += ^= Compound Bitwise XOR + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The compound bitwise XOR operator `^=` is often used with a variable and a constant to toggle (invert) particular bits in a variable. +[%hardbreaks] + +A review of the Bitwise XOR `^` operator: + + 0 0 1 1 operand1 + 0 1 0 1 operand2 + ---------- + 0 1 1 0 (operand1 ^ operand2) - returned result +[%hardbreaks] + +[float] +=== Syntax +`x ^= y; // equivalent to x = x ^ y;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `char`, `int`, `long`. + +`y`: variable or constant. Allowed data types: `char`, `int`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +Bits that are "bitwise XORed" with 0 are left unchanged. So if myByte is a byte variable, +[source,arduino] +---- +myByte ^ B00000000 = myByte; +---- + +Bits that are "bitwise XORed" with 1 are toggled so: +[source,arduino] +---- +myByte ^ B11111111 = ~myByte; +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero. +[%hardbreaks] + +Consequently - to toggle bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise XOR operator (^=) with the constant B00000011 + + 1 0 1 0 1 0 1 0 variable + 0 0 0 0 0 0 1 1 mask + ---------------------- + 1 0 1 0 1 0 0 1 + + bits unchanged + bits toggled + + +Here is the same representation with the variables bits replaced with the symbol x. ~x represents the complement of x. + + x x x x x x x x variable + 0 0 0 0 0 0 1 1 mask + ---------------------- + x x x x x x ~x ~x + + bits unchanged + bits set + +So if: +[source,arduino] +---- +myByte = B10101010; +myByte ^= B00000011 == B10101001; +---- + +-- +// HOW TO USE SECTION ENDS + + + + +//SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../bitwise-operators/bitwisexor[^ Bitwise XOR] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundDivision.adoc b/Language/Structure/Compound Operators/compoundDivision.adoc index 9a5e73f5e..019ef5952 100644 --- a/Language/Structure/Compound Operators/compoundDivision.adoc +++ b/Language/Structure/Compound Operators/compoundDivision.adoc @@ -1,71 +1,71 @@ ---- -title: "/=" -title_expanded: compound division -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= /= Compound Division - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -This is a convenient shorthand to perform division of a variable with another constant or variable. -[%hardbreaks] - - -[float] -=== Syntax -`x /= y; // equivalent to the expression x = x / y;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`y`: *non zero* variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -x = 2; -x /= 2; // x now contains 1 ----- -[%hardbreaks] - - --- -// HOW TO USE SECTION ENDS - - - -//SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../arithmetic-operators/division[Normal Division] - --- -// SEE ALSO SECTION ENDS +--- +title: "/=" +title_expanded: compound division +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += /= Compound Division + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This is a convenient shorthand to perform division of a variable with another constant or variable. +[%hardbreaks] + + +[float] +=== Syntax +`x /= y; // equivalent to the expression x = x / y;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: *non zero* variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +x = 2; +x /= 2; // x now contains 1 +---- +[%hardbreaks] + + +-- +// HOW TO USE SECTION ENDS + + + +//SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../arithmetic-operators/division[Normal Division] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundMultiplication.adoc b/Language/Structure/Compound Operators/compoundMultiplication.adoc index 436d39958..b2ec543ab 100644 --- a/Language/Structure/Compound Operators/compoundMultiplication.adoc +++ b/Language/Structure/Compound Operators/compoundMultiplication.adoc @@ -1,71 +1,71 @@ ---- -title: "*=" -title_expanded: compound multiplication -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= *= Compound Multiplication - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -This is a convenient shorthand to perform multiplication of a variable with another constant or variable. -[%hardbreaks] - - -[float] -=== Syntax -`x *= y; // equivalent to the expression x = x * y;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -x = 2; -x *= 2; // x now contains 4 ----- - - --- -// HOW TO USE SECTION ENDS - - - - -//SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../arithmetic-operators/multiplication[Normal Multiplication] - --- -// SEE ALSO SECTION ENDS +--- +title: "*=" +title_expanded: compound multiplication +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += *= Compound Multiplication + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This is a convenient shorthand to perform multiplication of a variable with another constant or variable. +[%hardbreaks] + + +[float] +=== Syntax +`x *= y; // equivalent to the expression x = x * y;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +x = 2; +x *= 2; // x now contains 4 +---- + + +-- +// HOW TO USE SECTION ENDS + + + + +//SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../arithmetic-operators/multiplication[Normal Multiplication] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundRemainder.adoc b/Language/Structure/Compound Operators/compoundRemainder.adoc index f60328063..e4722c298 100644 --- a/Language/Structure/Compound Operators/compoundRemainder.adoc +++ b/Language/Structure/Compound Operators/compoundRemainder.adoc @@ -1,78 +1,78 @@ ---- -title: "%=" -title_expanded: compound remainder -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= %= Compound Remainder - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -This is a convenient shorthand to calculate the remainder when one integer is divided by another and assign it back to the variable the calculation was done on. -[%hardbreaks] - - -[float] -=== Syntax -`x %= divisor; // equivalent to the expression x = x % divisor;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `int`. + -`divisor`: *non zero* variable or constant. Allowed data types: `int`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int x = 7; -x %= 5; // x now contains 2 ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -1. The compound remainder operator does not work on floats. - -2. If the *first* operand is negative, the result is negative (or zero). -Therefore, the result of `x %= 10` will not always be between 0 and 9 if `x` can be negative. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - -//SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../arithmetic-operators/remainder[Remainder] - --- -// SEE ALSO SECTION ENDS +--- +title: "%=" +title_expanded: compound remainder +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += %= Compound Remainder + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This is a convenient shorthand to calculate the remainder when one integer is divided by another and assign it back to the variable the calculation was done on. +[%hardbreaks] + + +[float] +=== Syntax +`x %= divisor; // equivalent to the expression x = x % divisor;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `int`. + +`divisor`: *non zero* variable or constant. Allowed data types: `int`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int x = 7; +x %= 5; // x now contains 2 +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +1. The compound remainder operator does not work on floats. + +2. If the *first* operand is negative, the result is negative (or zero). +Therefore, the result of `x %= 10` will not always be between 0 and 9 if `x` can be negative. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + +//SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../arithmetic-operators/remainder[Remainder] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/compoundSubtraction.adoc b/Language/Structure/Compound Operators/compoundSubtraction.adoc index 417edb0cd..22ca964a4 100644 --- a/Language/Structure/Compound Operators/compoundSubtraction.adoc +++ b/Language/Structure/Compound Operators/compoundSubtraction.adoc @@ -1,69 +1,69 @@ ---- -title: "-=" -title_expanded: compound subtraction -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= -= Compound Subtraction - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -This is a convenient shorthand to perform subtraction of a constant or a variable from a variable. -[%hardbreaks] - - -[float] -=== Syntax -`x -= y; // equivalent to the expression x = x - y;` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + -`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -x = 20; -x -= 2; // x now contains 18 ----- - - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../arithmetic-operators/subtraction[Normal Subtraction] - --- -// SEE ALSO SECTION ENDS +--- +title: "-=" +title_expanded: compound subtraction +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += -= Compound Subtraction + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This is a convenient shorthand to perform subtraction of a constant or a variable from a variable. +[%hardbreaks] + + +[float] +=== Syntax +`x -= y; // equivalent to the expression x = x - y;` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +`y`: variable or constant. Allowed data types: `int`, `float`, `double`, `byte`, `short`, `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +x = 20; +x -= 2; // x now contains 18 +---- + + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../arithmetic-operators/subtraction[Normal Subtraction] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/decrement.adoc b/Language/Structure/Compound Operators/decrement.adoc index 8b9bdc84e..752b1d182 100644 --- a/Language/Structure/Compound Operators/decrement.adoc +++ b/Language/Structure/Compound Operators/decrement.adoc @@ -1,74 +1,74 @@ ---- -title: "--" -title_expanded: decrement -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= -- Decrement - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Decrements the value of a variable by 1. -[%hardbreaks] - - -[float] -=== Syntax -`x--; // decrement x by one and returns the old value of x` + -`--x; // decrement x by one and returns the new value of x` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `int`, `long` (possibly unsigned). - - -[float] -=== Returns -The original or newly decremented value of the variable. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -x = 2; -y = --x; // x now contains 1, y contains 1 -y = x--; // x contains 0, but y still contains 1 ----- - --- -// HOW TO USE SECTION ENDS - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "--" +title_expanded: decrement +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += -- Decrement + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Decrements the value of a variable by 1. +[%hardbreaks] + + +[float] +=== Syntax +`x--; // decrement x by one and returns the old value of x` + +`--x; // decrement x by one and returns the new value of x` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `int`, `long` (possibly unsigned). + + +[float] +=== Returns +The original or newly decremented value of the variable. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +x = 2; +y = --x; // x now contains 1, y contains 1 +y = x--; // x contains 0, but y still contains 1 +---- + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Compound Operators/increment.adoc b/Language/Structure/Compound Operators/increment.adoc index 00c32070b..b9dd49b7b 100644 --- a/Language/Structure/Compound Operators/increment.adoc +++ b/Language/Structure/Compound Operators/increment.adoc @@ -1,72 +1,72 @@ ---- -title: "++" -title_expanded: increment -categories: [ "Structure" ] -subCategories: [ "Compound Operators" ] ---- - - - - - -= ++ Increment - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Increments the value of a variable by 1. -[%hardbreaks] - - -[float] -=== Syntax -`x++; // increment x by one and returns the old value of x` + -`++x; // increment x by one and returns the new value of x` - - -[float] -=== Parameters -`x`: variable. Allowed data types: `int`, `long` (possibly unsigned). - -[float] -=== Returns -The original or newly incremented value of the variable. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -x = 2; -y = ++x; // x now contains 3, y contains 3 -y = x++; // x contains 4, but y still contains 3 ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "++" +title_expanded: increment +categories: [ "Structure" ] +subCategories: [ "Compound Operators" ] +--- + + + + + += ++ Increment + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Increments the value of a variable by 1. +[%hardbreaks] + + +[float] +=== Syntax +`x++; // increment x by one and returns the old value of x` + +`++x; // increment x by one and returns the new value of x` + + +[float] +=== Parameters +`x`: variable. Allowed data types: `int`, `long` (possibly unsigned). + +[float] +=== Returns +The original or newly incremented value of the variable. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +x = 2; +y = ++x; // x now contains 3, y contains 3 +y = x++; // x contains 4, but y still contains 3 +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/break.adoc b/Language/Structure/Control Structure/break.adoc index 8d6a33087..63bb798ca 100644 --- a/Language/Structure/Control Structure/break.adoc +++ b/Language/Structure/Control Structure/break.adoc @@ -1,65 +1,65 @@ ---- -title: break -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= break - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -[%hardbreaks] -`break` is used to exit from a link:../for[for], link:../while[while] or link:../dowhile[do...while] loop, bypassing the normal loop condition. It is also used to exit from a link:../switchcase[switch case] statement. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- -[float] -=== Example Code -In the following code, the control exits the `for` loop when the sensor value exceeds the threshold. -[source,arduino] ----- -int threshold = 40; -for (int x = 0; x < 255; x++) { - analogWrite(PWMpin, x); - sens = analogRead(sensorPin); - if (sens > threshold) { // bail out on sensor detect - x = 0; - break; - } - delay(50); -} ----- - --- -// HOW TO USE SECTION ENDS - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: break +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += break + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +[%hardbreaks] +`break` is used to exit from a link:../for[for], link:../while[while] or link:../dowhile[do...while] loop, bypassing the normal loop condition. It is also used to exit from a link:../switchcase[switch case] statement. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- +[float] +=== Example Code +In the following code, the control exits the `for` loop when the sensor value exceeds the threshold. +[source,arduino] +---- +int threshold = 40; +for (int x = 0; x < 255; x++) { + analogWrite(PWMpin, x); + sens = analogRead(sensorPin); + if (sens > threshold) { // bail out on sensor detect + x = 0; + break; + } + delay(50); +} +---- + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/continue.adoc b/Language/Structure/Control Structure/continue.adoc index 9aa491c33..505a28679 100644 --- a/Language/Structure/Control Structure/continue.adoc +++ b/Language/Structure/Control Structure/continue.adoc @@ -1,65 +1,65 @@ ---- -title: continue -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= continue - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -[%hardbreaks] -The `continue` statement skips the rest of the current iteration of a loop (link:../for[for], link:../while[while], or link:../dowhile[do...while]). It continues by checking the conditional expression of the loop, and proceeding with any subsequent iterations. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -The following code writes the value of 0 to 255 to the `PWMpin`, but skips the values in the range of 41 to 119. -[source,arduino] ----- -for (int x = 0; x <= 255; x ++) { - if (x > 40 && x < 120) { // create jump in values - continue; - } - - analogWrite(PWMpin, x); - delay(50); -} ----- - - --- -// HOW TO USE SECTION ENDS - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: continue +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += continue + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +[%hardbreaks] +The `continue` statement skips the rest of the current iteration of a loop (link:../for[for], link:../while[while], or link:../dowhile[do...while]). It continues by checking the conditional expression of the loop, and proceeding with any subsequent iterations. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +The following code writes the value of 0 to 255 to the `PWMpin`, but skips the values in the range of 41 to 119. +[source,arduino] +---- +for (int x = 0; x <= 255; x ++) { + if (x > 40 && x < 120) { // create jump in values + continue; + } + + analogWrite(PWMpin, x); + delay(50); +} +---- + + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/doWhile.adoc b/Language/Structure/Control Structure/doWhile.adoc index 6c79fa192..672ff5919 100644 --- a/Language/Structure/Control Structure/doWhile.adoc +++ b/Language/Structure/Control Structure/doWhile.adoc @@ -1,74 +1,74 @@ ---- -title: do...while -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= do...while loop - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -[%hardbreaks] -The `do...while` loop works in the same manner as the link:../while[while] loop, with the exception that the condition is tested at the end of the loop, so the do loop will always run at least once. - -[float] -=== Syntax -[source,arduino] ----- -do { - // statement block -} while (condition); ----- - - -[float] -=== Parameters -`condition`: a boolean expression that evaluates to `true` or `false`. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int x = 0; -do { - delay(50); // wait for sensors to stabilize - x = readSensors(); // check the sensors -} while (x < 100); ----- - - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: do...while +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += do...while loop + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +[%hardbreaks] +The `do...while` loop works in the same manner as the link:../while[while] loop, with the exception that the condition is tested at the end of the loop, so the do loop will always run at least once. + +[float] +=== Syntax +[source,arduino] +---- +do { + // statement block +} while (condition); +---- + + +[float] +=== Parameters +`condition`: a boolean expression that evaluates to `true` or `false`. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int x = 0; +do { + delay(50); // wait for sensors to stabilize + x = readSensors(); // check the sensors +} while (x < 100); +---- + + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 3b4a8fdc2..cbc4f5010 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -1,82 +1,82 @@ ---- -title: else -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= if...else - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The `if...else` allows greater control over the flow of code than the basic link:../if[if] statement, by allowing multiple tests to be grouped together. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can proceed another `if` test, so that multiple, mutually exclusive tests can be run at the same time. -[%hardbreaks] - -Each test will proceed to the next one until a true test is encountered. When a true test is found, its associated block of code is run, and the program then skips to the line following the entire if/else construction. If no test proves to be true, the default `else` block is executed, if one is present, and sets the default behavior. -[%hardbreaks] - -Note that an `else if` block may be used with or without a terminating `else` block and vice versa. An unlimited number of such `else if` branches is allowed. - -[float] -=== Syntax -[source,arduino] ----- -if (condition1) { - // do Thing A -} -else if (condition2) { - // do Thing B -} -else { - // do Thing C -} ----- - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- -[float] -=== Example Code -Below is an extract from a code for temperature sensor system -[source,arduino] ----- -if (temperature >= 70) { - //Danger! Shut down the system -} -else if (temperature >= 60 && temperature < 70) { - //Warning! User attention required -} -else { - //Safe! Continue usual tasks... -} ----- - --- -// HOW TO USE SECTION ENDS - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: else +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += if...else + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The `if...else` allows greater control over the flow of code than the basic link:../if[if] statement, by allowing multiple tests to be grouped together. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can proceed another `if` test, so that multiple, mutually exclusive tests can be run at the same time. +[%hardbreaks] + +Each test will proceed to the next one until a true test is encountered. When a true test is found, its associated block of code is run, and the program then skips to the line following the entire if/else construction. If no test proves to be true, the default `else` block is executed, if one is present, and sets the default behavior. +[%hardbreaks] + +Note that an `else if` block may be used with or without a terminating `else` block and vice versa. An unlimited number of such `else if` branches is allowed. + +[float] +=== Syntax +[source,arduino] +---- +if (condition1) { + // do Thing A +} +else if (condition2) { + // do Thing B +} +else { + // do Thing C +} +---- + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- +[float] +=== Example Code +Below is an extract from a code for temperature sensor system +[source,arduino] +---- +if (temperature >= 70) { + //Danger! Shut down the system +} +else if (temperature >= 60 && temperature < 70) { + //Warning! User attention required +} +else { + //Safe! Continue usual tasks... +} +---- + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index e37b222eb..ef56739ba 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -1,118 +1,118 @@ ---- -title: for -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= for loop - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The `for` statement is used to repeat a block of statements enclosed in curly braces. An increment counter is usually used to increment and terminate the loop. The `for` statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins. -[%hardbreaks] - - -[float] -=== Syntax -[source,arduino] ----- -for (initialization; condition; increment) { - // statement(s); -} ----- - - -[float] -=== Parameters -`initialization`: happens first and exactly once. + -`condition`: each time through the loop, `condition` is tested; if it's `true`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `false`, the loop ends. + -`increment`: executed each time through the loop when `contition` is true. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -[source,arduino] ----- -// Dim an LED using a PWM pin -int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10 - -void setup() { - // no setup needed -} - -void loop() { - for (int i = 0; i <= 255; i++) { - analogWrite(PWMpin, i); - delay(10); - } -} ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -The C++ `for` loop is much more flexible than `for` loops found in some other computer languages, including BASIC. Any or all of the three header elements may be omitted, although the semicolons are required. Also the statements for initialization, condition, and increment can be any valid C++ statements with unrelated variables, and use any C++ datatypes including floats. These types of unusual `for` statements may provide solutions to some rare programming problems. -[%hardbreaks] - -For example, using a multiplication in the increment line will generate a logarithmic progression: - -[source,arduino] ----- -for (int x = 2; x < 100; x = x * 1.5) { - println(x); -} ----- - -Generates: 2,3,4,6,9,13,19,28,42,63,94 -[%hardbreaks] - -Another example, fade an LED up and down with one `for` loop: - -[source,arduino] ----- -void loop() { - int x = 1; - for (int i = 0; i > -1; i = i + x) { - analogWrite(PWMpin, i); - if (i == 255) { - x = -1; // switch direction at peak - } - delay(10); - } -} ----- - - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: for +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += for loop + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The `for` statement is used to repeat a block of statements enclosed in curly braces. An increment counter is usually used to increment and terminate the loop. The `for` statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins. +[%hardbreaks] + + +[float] +=== Syntax +[source,arduino] +---- +for (initialization; condition; increment) { + // statement(s); +} +---- + + +[float] +=== Parameters +`initialization`: happens first and exactly once. + +`condition`: each time through the loop, `condition` is tested; if it's `true`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `false`, the loop ends. + +`increment`: executed each time through the loop when `contition` is true. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +[source,arduino] +---- +// Dim an LED using a PWM pin +int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10 + +void setup() { + // no setup needed +} + +void loop() { + for (int i = 0; i <= 255; i++) { + analogWrite(PWMpin, i); + delay(10); + } +} +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +The C++ `for` loop is much more flexible than `for` loops found in some other computer languages, including BASIC. Any or all of the three header elements may be omitted, although the semicolons are required. Also the statements for initialization, condition, and increment can be any valid C++ statements with unrelated variables, and use any C++ datatypes including floats. These types of unusual `for` statements may provide solutions to some rare programming problems. +[%hardbreaks] + +For example, using a multiplication in the increment line will generate a logarithmic progression: + +[source,arduino] +---- +for (int x = 2; x < 100; x = x * 1.5) { + println(x); +} +---- + +Generates: 2,3,4,6,9,13,19,28,42,63,94 +[%hardbreaks] + +Another example, fade an LED up and down with one `for` loop: + +[source,arduino] +---- +void loop() { + int x = 1; + for (int i = 0; i > -1; i = i + x) { + analogWrite(PWMpin, i); + if (i == 255) { + x = -1; // switch direction at peak + } + delay(10); + } +} +---- + + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/goto.adoc b/Language/Structure/Control Structure/goto.adoc index 2e3e0e1e6..57de782cf 100644 --- a/Language/Structure/Control Structure/goto.adoc +++ b/Language/Structure/Control Structure/goto.adoc @@ -1,86 +1,86 @@ ---- -title: goto -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= goto - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Transfers program flow to a labeled point in the program -[%hardbreaks] - - -[float] -=== Syntax -[source,arduino] ----- -label: - -goto label; // sends program flow to the label ----- - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -for (byte r = 0; r < 255; r++) { - for (byte g = 255; g > 0; g--) { - for (byte b = 0; b < 255; b++) { - if (analogRead(0) > 250) { - goto bailout; - } - // more statements ... - } - } -} - -bailout: -// more statements ... ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -The use of `goto` is discouraged in C++ programming, and some authors of C++ programming books claim that the `goto` statement is never necessary, but used judiciously, it can simplify certain programs. The reason that many programmers frown upon the use of goto is that with the unrestrained use of `goto` statements, it is easy to create a program with undefined program flow, which can never be debugged. - -With that said, there are instances where a `goto` statement can come in handy, and simplify coding. One of these situations is to break out of deeply nested link:../for[for] loops, or link:../if[if] logic blocks, on a certain condition. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: goto +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += goto + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Transfers program flow to a labeled point in the program +[%hardbreaks] + + +[float] +=== Syntax +[source,arduino] +---- +label: + +goto label; // sends program flow to the label +---- + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +for (byte r = 0; r < 255; r++) { + for (byte g = 255; g > 0; g--) { + for (byte b = 0; b < 255; b++) { + if (analogRead(0) > 250) { + goto bailout; + } + // more statements ... + } + } +} + +bailout: +// more statements ... +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +The use of `goto` is discouraged in C++ programming, and some authors of C++ programming books claim that the `goto` statement is never necessary, but used judiciously, it can simplify certain programs. The reason that many programmers frown upon the use of goto is that with the unrestrained use of `goto` statements, it is easy to create a program with undefined program flow, which can never be debugged. + +With that said, there are instances where a `goto` statement can come in handy, and simplify coding. One of these situations is to break out of deeply nested link:../for[for] loops, or link:../if[if] logic blocks, on a certain condition. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/if.adoc b/Language/Structure/Control Structure/if.adoc index 1f637c298..f1a79934e 100644 --- a/Language/Structure/Control Structure/if.adoc +++ b/Language/Structure/Control Structure/if.adoc @@ -1,106 +1,106 @@ ---- -title: if -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= if - - -// OVERVIEW SECTION STARTS -[#overview] --- -[float] -=== Description -The `if` statement checks for a condition and executes the proceeding statement or set of statements if the condition is 'true'. -[%hardbreaks] - -[float] -=== Syntax -[source,arduino] ----- -if (condition) { - //statement(s) -} ----- - - -[float] -=== Parameters -`condition`: a boolean expression (i.e., can be `true` or `false`). - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -The brackets may be omitted after an if statement. If this is done, the next line (defined by the semicolon) becomes the only conditional statement. -[%hardbreaks] - -[source,arduino] ----- -if (x > 120) digitalWrite(LEDpin, HIGH); - -if (x > 120) -digitalWrite(LEDpin, HIGH); - -if (x > 120) {digitalWrite(LEDpin, HIGH);} - -if (x > 120) { - digitalWrite(LEDpin1, HIGH); - digitalWrite(LEDpin2, HIGH); -} -// all are correct ----- -[%hardbreaks] - - -[float] -=== Notes and Warnings -The statements being evaluated inside the parentheses require the use of one or more operators shown below. -[%hardbreaks] - -*Comparison Operators:* - - x == y (x is equal to y) - x != y (x is not equal to y) - x < y (x is less than y) - x > y (x is greater than y) - x <= y (x is less than or equal to y) - x >= y (x is greater than or equal to y) - - -Beware of accidentally using the single equal sign (e.g. `if (x = 10)` ). The single equal sign is the assignment operator, and sets `x` to 10 (puts the value 10 into the variable `x`). Instead use the double equal sign (e.g. `if (x == 10)` ), which is the comparison operator, and tests _whether_ `x` is equal to 10 or not. The latter statement is only true if `x` equals 10, but the former statement will always be true. - -This is because C++ evaluates the statement `if (x=10)` as follows: 10 is assigned to `x` (remember that the single equal sign is the (http://arduino.cc/en/Reference/Assignment[assignment operator^])), so `x` now contains 10. Then the 'if' conditional evaluates 10, which always evaluates to `TRUE`, since any non-zero number evaluates to TRUE. Consequently, `if (x = 10)` will always evaluate to `TRUE`, which is not the desired result when using an 'if' statement. Additionally, the variable `x` will be set to 10, which is also not a desired action. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: if +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += if + + +// OVERVIEW SECTION STARTS +[#overview] +-- +[float] +=== Description +The `if` statement checks for a condition and executes the proceeding statement or set of statements if the condition is 'true'. +[%hardbreaks] + +[float] +=== Syntax +[source,arduino] +---- +if (condition) { + //statement(s) +} +---- + + +[float] +=== Parameters +`condition`: a boolean expression (i.e., can be `true` or `false`). + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +The brackets may be omitted after an if statement. If this is done, the next line (defined by the semicolon) becomes the only conditional statement. +[%hardbreaks] + +[source,arduino] +---- +if (x > 120) digitalWrite(LEDpin, HIGH); + +if (x > 120) +digitalWrite(LEDpin, HIGH); + +if (x > 120) {digitalWrite(LEDpin, HIGH);} + +if (x > 120) { + digitalWrite(LEDpin1, HIGH); + digitalWrite(LEDpin2, HIGH); +} +// all are correct +---- +[%hardbreaks] + + +[float] +=== Notes and Warnings +The statements being evaluated inside the parentheses require the use of one or more operators shown below. +[%hardbreaks] + +*Comparison Operators:* + + x == y (x is equal to y) + x != y (x is not equal to y) + x < y (x is less than y) + x > y (x is greater than y) + x <= y (x is less than or equal to y) + x >= y (x is greater than or equal to y) + + +Beware of accidentally using the single equal sign (e.g. `if (x = 10)` ). The single equal sign is the assignment operator, and sets `x` to 10 (puts the value 10 into the variable `x`). Instead use the double equal sign (e.g. `if (x == 10)` ), which is the comparison operator, and tests _whether_ `x` is equal to 10 or not. The latter statement is only true if `x` equals 10, but the former statement will always be true. + +This is because C++ evaluates the statement `if (x=10)` as follows: 10 is assigned to `x` (remember that the single equal sign is the (http://arduino.cc/en/Reference/Assignment[assignment operator^])), so `x` now contains 10. Then the 'if' conditional evaluates 10, which always evaluates to `TRUE`, since any non-zero number evaluates to TRUE. Consequently, `if (x = 10)` will always evaluate to `TRUE`, which is not the desired result when using an 'if' statement. Additionally, the variable `x` will be set to 10, which is also not a desired action. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/return.adoc b/Language/Structure/Control Structure/return.adoc index b098d79b2..abd53be57 100644 --- a/Language/Structure/Control Structure/return.adoc +++ b/Language/Structure/Control Structure/return.adoc @@ -1,90 +1,90 @@ ---- -title: return -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= return - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Terminate a function and return a value from a function to the calling function, if desired. -[%hardbreaks] - - -[float] -=== Syntax -`return;` + -`return value;` - - -[float] -=== Parameters -`value`: Allowed data types: any variable or constant type. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -A function to compare a sensor input to a threshold - -[source,arduino] ----- -int checkSensor() { - if (analogRead(0) > 400) { - return 1; - } - else { - return 0; - } -} ----- - -The return keyword is handy to test a section of code without having to "comment out" large sections of possibly buggy code. -[source,arduino] ----- -void loop() { - // brilliant code idea to test here - - return; - - // the rest of a dysfunctional sketch here - // this code will never be executed -} ----- -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: return +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += return + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Terminate a function and return a value from a function to the calling function, if desired. +[%hardbreaks] + + +[float] +=== Syntax +`return;` + +`return value;` + + +[float] +=== Parameters +`value`: Allowed data types: any variable or constant type. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +A function to compare a sensor input to a threshold + +[source,arduino] +---- +int checkSensor() { + if (analogRead(0) > 400) { + return 1; + } + else { + return 0; + } +} +---- + +The return keyword is handy to test a section of code without having to "comment out" large sections of possibly buggy code. +[source,arduino] +---- +void loop() { + // brilliant code idea to test here + + return; + + // the rest of a dysfunctional sketch here + // this code will never be executed +} +---- +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index 959eba4d2..faa4a60a7 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -1,101 +1,101 @@ ---- -title: switch...case -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= switch...case statement - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Like link:../if[if] statements, link:../switchcase[switch case] controls the flow of programs by allowing programmers to specify different code that should be executed in various conditions. In particular, a switch statement compares the value of a variable to the values specified in case statements. When a case statement is found whose value matches that of the variable, the code in that case statement is run. -[%hardbreaks] - -The link:../break[break] keyword exits the switch statement, and is typically used at the end of each case. Without a break statement, the switch statement will continue executing the following expressions ("falling-through") until a break, or the end of the switch statement is reached. -[%hardbreaks] - - -[float] -=== Syntax -[source,arduino] ----- -switch (var) { - case label1: - // statements - break; - case label2: - // statements - break; - default: - // statements - break; -} ----- - - -[float] -=== Parameters -`var`: a variable whose value to compare with various cases. Allowed data types: `int`, `char`. + -`label1`, `label2`: constants. Allowed data types: `int`, `char`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -switch (var) { - case 1: - //do something when var equals 1 - break; - case 2: - //do something when var equals 2 - break; - default: - // if nothing else matches, do the default - // default is optional - break; -} - ----- -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTIN BEGINS -[#see_also] --- - -[float] -=== See also -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: switch...case +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += switch...case statement + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Like link:../if[if] statements, link:../switchcase[switch case] controls the flow of programs by allowing programmers to specify different code that should be executed in various conditions. In particular, a switch statement compares the value of a variable to the values specified in case statements. When a case statement is found whose value matches that of the variable, the code in that case statement is run. +[%hardbreaks] + +The link:../break[break] keyword exits the switch statement, and is typically used at the end of each case. Without a break statement, the switch statement will continue executing the following expressions ("falling-through") until a break, or the end of the switch statement is reached. +[%hardbreaks] + + +[float] +=== Syntax +[source,arduino] +---- +switch (var) { + case label1: + // statements + break; + case label2: + // statements + break; + default: + // statements + break; +} +---- + + +[float] +=== Parameters +`var`: a variable whose value to compare with various cases. Allowed data types: `int`, `char`. + +`label1`, `label2`: constants. Allowed data types: `int`, `char`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +switch (var) { + case 1: + //do something when var equals 1 + break; + case 2: + //do something when var equals 2 + break; + default: + // if nothing else matches, do the default + // default is optional + break; +} + +---- +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTIN BEGINS +[#see_also] +-- + +[float] +=== See also +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Control Structure/while.adoc b/Language/Structure/Control Structure/while.adoc index b0def2329..491cceb88 100644 --- a/Language/Structure/Control Structure/while.adoc +++ b/Language/Structure/Control Structure/while.adoc @@ -1,77 +1,77 @@ ---- -title: while -categories: [ "Structure" ] -subCategories: [ "Control Structure" ] ---- - - - - - -= while loop - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -[%hardbreaks] -A `while` loop will loop continuously, and infinitely, until the expression inside the parenthesis, () becomes false. Something must change the tested variable, or the while loop will never exit. This could be in your code, such as an incremented variable, or an external condition, such as testing a sensor. - -[float] -=== Syntax -[source,arduino] ----- -while (condition) { - // statement(s) -} ----- - - -[float] -=== Parameters -`condition`: a boolean expression that evaluates to `true` or `false`. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -var = 0; -while (var < 200) { - // do something repetitive 200 times - var++; -} ----- - --- -// HOW TO USE SECTION ENDS - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - -[role="example"] -* #EXAMPLE# https://arduino.cc/en/Tutorial/WhileLoop[While Loop^] - --- -// SEE ALSO SECTION ENDS +--- +title: while +categories: [ "Structure" ] +subCategories: [ "Control Structure" ] +--- + + + + + += while loop + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +[%hardbreaks] +A `while` loop will loop continuously, and infinitely, until the expression inside the parenthesis, () becomes false. Something must change the tested variable, or the while loop will never exit. This could be in your code, such as an incremented variable, or an external condition, such as testing a sensor. + +[float] +=== Syntax +[source,arduino] +---- +while (condition) { + // statement(s) +} +---- + + +[float] +=== Parameters +`condition`: a boolean expression that evaluates to `true` or `false`. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +var = 0; +while (var < 200) { + // do something repetitive 200 times + var++; +} +---- + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +[role="example"] +* #EXAMPLE# https://arduino.cc/en/Tutorial/WhileLoop[While Loop^] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Further Syntax/blockComment.adoc b/Language/Structure/Further Syntax/blockComment.adoc index 92be3dfea..d8c200c9a 100644 --- a/Language/Structure/Further Syntax/blockComment.adoc +++ b/Language/Structure/Further Syntax/blockComment.adoc @@ -1,81 +1,81 @@ ---- -title: "/* */" -title_expanded: block comment -categories: [ "Structure" ] -subCategories: [ "Further Syntax" ] ---- - - - - - -= /* */ Block Comment - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Comments* are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don't take up any space in the microcontroller's flash memory. Comments' only purpose is to help you understand (or remember), or to inform others about how your program works. -[%hardbreaks] - -The beginning of a *block comment* or a *multi-line comment* is marked by the symbol `/\*` and the symbol `*/` marks its end. This type of a comment is called so as this can extend over more than one line; once the compiler reads the `/\*` it ignores whatever follows until it enounters a `*/`. - -// NOTE TO THE EDITOR: The '\' before the '*' in certain places are to escape the '*' from making the text bolder. -// In places were '\' is not used before '*', it is not actually required. --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -[source,arduino] ----- -/* This is a valid comment */ - -/* - Blink - Turns on an LED on for one second, then off for one second, repeatedly. - - This example code is in the public domain. - (Another valid comment) -*/ - -/* - if (gwb == 0) { // single line comment is OK inside a multi-line comment - x = 3; /* but not another multi-line comment - this is invalid */ - } -// don't forget the "closing" comment - they have to be balanced! -*/ ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -When experimenting with code, "commenting out" parts of your program is a convenient way to remove lines that may be buggy. This leaves the lines in the code, but turns them into comments, so the compiler just ignores them. This can be especially useful when trying to locate a problem, or when a program refuses to compile and the compiler error is cryptic or unhelpful. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "/* */" +title_expanded: block comment +categories: [ "Structure" ] +subCategories: [ "Further Syntax" ] +--- + + + + + += /* */ Block Comment + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Comments* are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don't take up any space in the microcontroller's flash memory. Comments' only purpose is to help you understand (or remember), or to inform others about how your program works. +[%hardbreaks] + +The beginning of a *block comment* or a *multi-line comment* is marked by the symbol `/\*` and the symbol `*/` marks its end. This type of a comment is called so as this can extend over more than one line; once the compiler reads the `/\*` it ignores whatever follows until it enounters a `*/`. + +// NOTE TO THE EDITOR: The '\' before the '*' in certain places are to escape the '*' from making the text bolder. +// In places were '\' is not used before '*', it is not actually required. +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +[source,arduino] +---- +/* This is a valid comment */ + +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. + (Another valid comment) +*/ + +/* + if (gwb == 0) { // single line comment is OK inside a multi-line comment + x = 3; /* but not another multi-line comment - this is invalid */ + } +// don't forget the "closing" comment - they have to be balanced! +*/ +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +When experimenting with code, "commenting out" parts of your program is a convenient way to remove lines that may be buggy. This leaves the lines in the code, but turns them into comments, so the compiler just ignores them. This can be especially useful when trying to locate a problem, or when a program refuses to compile and the compiler error is cryptic or unhelpful. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Further Syntax/define.adoc b/Language/Structure/Further Syntax/define.adoc index 4e92d28ee..3f65ce054 100644 --- a/Language/Structure/Further Syntax/define.adoc +++ b/Language/Structure/Further Syntax/define.adoc @@ -1,95 +1,95 @@ ---- -title: "#define" -title_expanded: define -categories: [ "Structure" ] -subCategories: [ "Further Syntax" ] ---- - - - - - -= #define - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -`#define` is a useful C++ component that allows the programmer to give a name to a constant value before the program is compiled. Defined constants in arduino don't take up any program memory space on the chip. The compiler will replace references to these constants with the defined value at compile time. -[%hardbreaks] - -This can have some unwanted side effects though, if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text). -[%hardbreaks] - -In general, the link:../../../variables/variable-scope\--qualifiers/const[const] keyword is preferred for defining constants and should be used instead of #define. -[%hardbreaks] - -[float] -=== Syntax -`#define constantName value` - - -[float] -=== Parameters -`constantName`: the name of the macro to define. + -`value`: the value to assign to the macro. - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -#define ledPin 3 -// The compiler will replace any mention of ledPin with the value 3 at compile time. ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -There is no semicolon after the #define statement. If you include one, the compiler will throw cryptic errors further down the page. - -[source,arduino] ----- -#define ledPin 3; // this is an error ----- - -Similarly, including an equal sign after the #define statement will also generate a cryptic compiler error further down the page. - -[source,arduino] ----- -#define ledPin = 3 // this is also an error ----- -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] -* #LANGUAGE# link:../../../variables/variable-scope\--qualifiers/const[const] -* #LANGUAGE# link:../../../variables/constants/constants[Constants] - --- -// SEE ALSO SECTION ENDS +--- +title: "#define" +title_expanded: define +categories: [ "Structure" ] +subCategories: [ "Further Syntax" ] +--- + + + + + += #define + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +`#define` is a useful C++ component that allows the programmer to give a name to a constant value before the program is compiled. Defined constants in arduino don't take up any program memory space on the chip. The compiler will replace references to these constants with the defined value at compile time. +[%hardbreaks] + +This can have some unwanted side effects though, if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text). +[%hardbreaks] + +In general, the link:../../../variables/variable-scope\--qualifiers/const[const] keyword is preferred for defining constants and should be used instead of #define. +[%hardbreaks] + +[float] +=== Syntax +`#define constantName value` + + +[float] +=== Parameters +`constantName`: the name of the macro to define. + +`value`: the value to assign to the macro. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +#define ledPin 3 +// The compiler will replace any mention of ledPin with the value 3 at compile time. +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +There is no semicolon after the #define statement. If you include one, the compiler will throw cryptic errors further down the page. + +[source,arduino] +---- +#define ledPin 3; // this is an error +---- + +Similarly, including an equal sign after the #define statement will also generate a cryptic compiler error further down the page. + +[source,arduino] +---- +#define ledPin = 3 // this is also an error +---- +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../../variables/variable-scope\--qualifiers/const[const] +* #LANGUAGE# link:../../../variables/constants/constants[Constants] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Further Syntax/include.adoc b/Language/Structure/Further Syntax/include.adoc index f26c05049..f2fb9db86 100644 --- a/Language/Structure/Further Syntax/include.adoc +++ b/Language/Structure/Further Syntax/include.adoc @@ -1,85 +1,85 @@ ---- -title: "#include" -title_expanded: include -categories: [ "Structure" ] -subCategories: [ "Further Syntax" ] ---- - - - - - -= #include - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -`#include` is used to include outside libraries in your sketch. This gives the programmer access to a large group of standard C libraries (groups of pre-made functions), and also libraries written especially for Arduino. -[%hardbreaks] - -The main reference page for AVR C libraries (AVR is a reference to the Atmel chips on which the Arduino is based) is http://www.nongnu.org/avr-libc/user-manual/modules.html[here^]. -[%hardbreaks] - -Note that `#include`, similar to link:../define[`#define`], has no semicolon terminator, and the compiler will yield cryptic error messages if you add one. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -This example includes the Servo library so that its functions may be used to control a Servo motor. - - -[source,arduino] ----- -#include - -Servo myservo; // create servo object to control a servo - -void setup() { - myservo.attach(9); // attaches the servo on pin 9 to the servo object -} - -void loop() { - for (int pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees - // in steps of 1 degree - myservo.write(pos); // tell servo to go to position in variable 'pos' - delay(15); // waits 15ms for the servo to reach the position - } - for (int pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees - myservo.write(pos); // tell servo to go to position in variable 'pos' - delay(15); // waits 15ms for the servo to reach the position - } -} ----- - - --- -// HOW TO USE SECTION ENDS - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - - --- -// SEE ALSO SECTION ENDS +--- +title: "#include" +title_expanded: include +categories: [ "Structure" ] +subCategories: [ "Further Syntax" ] +--- + + + + + += #include + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +`#include` is used to include outside libraries in your sketch. This gives the programmer access to a large group of standard C libraries (groups of pre-made functions), and also libraries written especially for Arduino. +[%hardbreaks] + +The main reference page for AVR C libraries (AVR is a reference to the Atmel chips on which the Arduino is based) is http://www.nongnu.org/avr-libc/user-manual/modules.html[here^]. +[%hardbreaks] + +Note that `#include`, similar to link:../define[`#define`], has no semicolon terminator, and the compiler will yield cryptic error messages if you add one. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +This example includes the Servo library so that its functions may be used to control a Servo motor. + + +[source,arduino] +---- +#include + +Servo myservo; // create servo object to control a servo + +void setup() { + myservo.attach(9); // attaches the servo on pin 9 to the servo object +} + +void loop() { + for (int pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees + // in steps of 1 degree + myservo.write(pos); // tell servo to go to position in variable 'pos' + delay(15); // waits 15ms for the servo to reach the position + } + for (int pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees + myservo.write(pos); // tell servo to go to position in variable 'pos' + delay(15); // waits 15ms for the servo to reach the position + } +} +---- + + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Further Syntax/semicolon.adoc b/Language/Structure/Further Syntax/semicolon.adoc index 74e379e29..6a9a1d2ba 100644 --- a/Language/Structure/Further Syntax/semicolon.adoc +++ b/Language/Structure/Further Syntax/semicolon.adoc @@ -1,64 +1,64 @@ ---- -title: ";" -title_expanded: semicolon -categories: [ "Structure" ] -subCategories: [ "Further Syntax" ] ---- - - - - - -= ; Semicolon - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Used to end a statement. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int a = 13; ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Forgetting to end a line in a semicolon will result in a compiler error. The error text may be obvious, and refer to a missing semicolon, or it may not. If an impenetrable or seemingly illogical compiler error comes up, one of the first things to check is a missing semicolon, in the immediate vicinity, preceding the line at which the compiler complained. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: ";" +title_expanded: semicolon +categories: [ "Structure" ] +subCategories: [ "Further Syntax" ] +--- + + + + + += ; Semicolon + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Used to end a statement. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int a = 13; +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Forgetting to end a line in a semicolon will result in a compiler error. The error text may be obvious, and refer to a missing semicolon, or it may not. If an impenetrable or seemingly illogical compiler error comes up, one of the first things to check is a missing semicolon, in the immediate vicinity, preceding the line at which the compiler complained. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Further Syntax/singleLineComment.adoc b/Language/Structure/Further Syntax/singleLineComment.adoc index c3b85231e..3bf2f8ae0 100644 --- a/Language/Structure/Further Syntax/singleLineComment.adoc +++ b/Language/Structure/Further Syntax/singleLineComment.adoc @@ -1,70 +1,70 @@ ---- -title: "//" -title_expanded: single line comment -categories: [ "Structure" ] -subCategories: [ "Further Syntax" ] ---- - - - - - -= // Single Line Comment - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -*Comments* are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don't take up any space in the microcontroller's flash memory. Comments' only purpose is to help you understand (or remember), or to inform others about how your program works. -[%hardbreaks] - -A *single line comment* begins with `//` (two adjacent slashes). This comment ends automatically at the end of a line. whatever follows `//` till the end of a line will be ignored by the compiler. --- -// OVERVIEW SECTION ENDS - - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -There are two different ways of marking a line as a comment: - -[source,arduino] ----- -// pin 13 has an LED connected on most Arduino boards. -// give it a name: -int led = 13; -digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -When experimenting with code, "commenting out" parts of your program is a convenient way to remove lines that may be buggy. This leaves the lines in the code, but turns them into comments, so the compiler just ignores them. This can be especially useful when trying to locate a problem, or when a program refuses to compile and the compiler error is cryptic or unhelpful. -[%hardbreaks] - - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "//" +title_expanded: single line comment +categories: [ "Structure" ] +subCategories: [ "Further Syntax" ] +--- + + + + + += // Single Line Comment + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +*Comments* are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don't take up any space in the microcontroller's flash memory. Comments' only purpose is to help you understand (or remember), or to inform others about how your program works. +[%hardbreaks] + +A *single line comment* begins with `//` (two adjacent slashes). This comment ends automatically at the end of a line. whatever follows `//` till the end of a line will be ignored by the compiler. +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +There are two different ways of marking a line as a comment: + +[source,arduino] +---- +// pin 13 has an LED connected on most Arduino boards. +// give it a name: +int led = 13; +digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +When experimenting with code, "commenting out" parts of your program is a convenient way to remove lines that may be buggy. This leaves the lines in the code, but turns them into comments, so the compiler just ignores them. This can be especially useful when trying to locate a problem, or when a program refuses to compile and the compiler error is cryptic or unhelpful. +[%hardbreaks] + + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Pointer Access Operators/dereference.adoc b/Language/Structure/Pointer Access Operators/dereference.adoc index 39cf88746..6785e5c9d 100644 --- a/Language/Structure/Pointer Access Operators/dereference.adoc +++ b/Language/Structure/Pointer Access Operators/dereference.adoc @@ -1,71 +1,71 @@ ---- -title: "*" -title_expanded: dereference operator -categories: [ "Structure" ] -subCategories: [ "Pointer Access Operators" ] ---- - - - - - -= * Dereference Operator - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Dereferencing is one of the features specifically for use with pointers. The asterisk operator `*` is used for this purpose. If `p` is a pointer, then `*p` represents the value contained in the address pointed by `p`. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int *p; // declare a pointer to an int data type -int i = 5; -int result = 0; -p = &i; // now 'p' contains the address of 'i' -result = *p; // 'result' gets the value at the address pointed by 'p' - // i.e., it gets the value of 'i' which is 5 ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Pointers are one of the complicated subjects for beginners in learning C, and it is possible to write the vast majority of Arduino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and and knowledge of manipulating pointers is handy to have in one's toolkit. -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - -[role="definition"] -* #DEFINITION# https://en.wikipedia.org/wiki/Pointer_%28computer_programming%29[Pointers^] - --- -// SEE ALSO SECTION ENDS +--- +title: "*" +title_expanded: dereference operator +categories: [ "Structure" ] +subCategories: [ "Pointer Access Operators" ] +--- + + + + + += * Dereference Operator + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Dereferencing is one of the features specifically for use with pointers. The asterisk operator `*` is used for this purpose. If `p` is a pointer, then `*p` represents the value contained in the address pointed by `p`. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int *p; // declare a pointer to an int data type +int i = 5; +int result = 0; +p = &i; // now 'p' contains the address of 'i' +result = *p; // 'result' gets the value at the address pointed by 'p' + // i.e., it gets the value of 'i' which is 5 +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Pointers are one of the complicated subjects for beginners in learning C, and it is possible to write the vast majority of Arduino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and and knowledge of manipulating pointers is handy to have in one's toolkit. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +[role="definition"] +* #DEFINITION# https://en.wikipedia.org/wiki/Pointer_%28computer_programming%29[Pointers^] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Pointer Access Operators/reference.adoc b/Language/Structure/Pointer Access Operators/reference.adoc index 2d8d6d24f..eaf220b23 100644 --- a/Language/Structure/Pointer Access Operators/reference.adoc +++ b/Language/Structure/Pointer Access Operators/reference.adoc @@ -1,72 +1,72 @@ ---- -title: "&" -title_expanded: reference operator -categories: [ "Structure" ] -subCategories: [ "Pointer Access Operators" ] ---- - - - - - -= & Reference Operator - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Referencing is one of the features specifically for use with pointers. The ampersand operator `&` is used for this purpose. If `x` is a variable, then `&x` represents the address of the variable `x`. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int *p; // declare a pointer to an int data type -int i = 5; -int result = 0; -p = &i; // now 'p' contains the address of 'i' -result = *p; // 'result' gets the value at the address pointed by 'p' - // i.e., it gets the value of 'i' which is 5 ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Pointers are one of the complicated subjects for beginners in learning C, and it is possible to write the vast majority of Arduino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and knowledge of manipulating pointers is handy to have in one's toolkit. -[%hardbreaks] - - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - -[role="definition"] -* #DEFINITION# https://en.wikipedia.org/wiki/Pointer_%28computer_programming%29[Pointers^] - --- -// SEE ALSO SECTION ENDS +--- +title: "&" +title_expanded: reference operator +categories: [ "Structure" ] +subCategories: [ "Pointer Access Operators" ] +--- + + + + + += & Reference Operator + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Referencing is one of the features specifically for use with pointers. The ampersand operator `&` is used for this purpose. If `x` is a variable, then `&x` represents the address of the variable `x`. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int *p; // declare a pointer to an int data type +int i = 5; +int result = 0; +p = &i; // now 'p' contains the address of 'i' +result = *p; // 'result' gets the value at the address pointed by 'p' + // i.e., it gets the value of 'i' which is 5 +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Pointers are one of the complicated subjects for beginners in learning C, and it is possible to write the vast majority of Arduino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and knowledge of manipulating pointers is handy to have in one's toolkit. +[%hardbreaks] + + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +[role="definition"] +* #DEFINITION# https://en.wikipedia.org/wiki/Pointer_%28computer_programming%29[Pointers^] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Sketch/loop.adoc b/Language/Structure/Sketch/loop.adoc index f4ef12eed..8586e44c0 100644 --- a/Language/Structure/Sketch/loop.adoc +++ b/Language/Structure/Sketch/loop.adoc @@ -1,69 +1,69 @@ ---- -title: loop() -categories: [ "Functions" ] -subCategories: [ "Sketch" ] ---- - - - - - -= loop() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -After creating a link:../setup[setup()] function, which initializes and sets the initial values, the `loop()` function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -[source,arduino] ----- -int buttonPin = 3; - -// setup initializes serial and the button pin -void setup() { - Serial.begin(9600); - pinMode(buttonPin, INPUT); -} - -// loop checks the button pin each time, -// and will send serial if it is pressed -void loop() { - if (digitalRead(buttonPin) == HIGH) { - Serial.write('H'); - } - else { - Serial.write('L'); - } - - delay(1000); -} ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - --- -// SEE ALSO SECTION ENDS +--- +title: loop() +categories: [ "Functions" ] +subCategories: [ "Sketch" ] +--- + + + + + += loop() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +After creating a link:../setup[setup()] function, which initializes and sets the initial values, the `loop()` function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +[source,arduino] +---- +int buttonPin = 3; + +// setup initializes serial and the button pin +void setup() { + Serial.begin(9600); + pinMode(buttonPin, INPUT); +} + +// loop checks the button pin each time, +// and will send serial if it is pressed +void loop() { + if (digitalRead(buttonPin) == HIGH) { + Serial.write('H'); + } + else { + Serial.write('L'); + } + + delay(1000); +} +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Structure/Sketch/setup.adoc b/Language/Structure/Sketch/setup.adoc index 9e101838e..3b46b5523 100644 --- a/Language/Structure/Sketch/setup.adoc +++ b/Language/Structure/Sketch/setup.adoc @@ -1,60 +1,60 @@ ---- -title: setup() -categories: [ "Functions" ] -subCategories: [ "Sketch" ] ---- - - - - - -= setup() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The `setup()` function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The `setup()` function will only run once, after each powerup or reset of the Arduino board. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -int buttonPin = 3; - -void setup() { - Serial.begin(9600); - pinMode(buttonPin, INPUT); -} - -void loop() { - // ... -} ----- - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - --- -// SEE ALSO SECTION ENDS +--- +title: setup() +categories: [ "Functions" ] +subCategories: [ "Sketch" ] +--- + + + + + += setup() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The `setup()` function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The `setup()` function will only run once, after each powerup or reset of the Arduino board. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +int buttonPin = 3; + +void setup() { + Serial.begin(9600); + pinMode(buttonPin, INPUT); +} + +void loop() { + // ... +} +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Constants/constants.adoc b/Language/Variables/Constants/constants.adoc index 2271882f9..32650ad60 100644 --- a/Language/Variables/Constants/constants.adoc +++ b/Language/Variables/Constants/constants.adoc @@ -1,131 +1,131 @@ ---- -title: constants -categories: [ "Variables" ] -subCategories: [ "Constants" ] ---- - -= Constants - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -== Description -Constants are predefined expressions in the Arduino language. They are used to make the programs easier to read. We classify constants in groups: - -[float] -== Defining Logical Levels: true and false (Boolean Constants) -There are two constants used to represent truth and falsity in the Arduino language: `true`, and `false`. - -[float] -=== false -`false` is the easier of the two to define. false is defined as 0 (zero). -[%hardbreaks] - -[float] -=== true -`true` is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. -[%hardbreaks] - -Note that the `true` and `false` constants are typed in lowercase unlike `HIGH`, `LOW`, `INPUT`, and `OUTPUT`. -[%hardbreaks] - -[float] -== Defining Pin Levels: HIGH and LOW -When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: `HIGH` and `LOW`. - -[float] -=== HIGH -The meaning of `HIGH` (in reference to a pin) is somewhat different depending on whether a pin is set to an `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with link:../../../functions/digital-io/pinmode[pinMode()], and read with link:../../../functions/digital-io/digitalread[digitalRead()], the Arduino (ATmega) will report `HIGH` if: - - - a voltage greater than 3.0V is present at the pin (5V boards) - - a voltage greater than 2.0V volts is present at the pin (3.3V boards) -[%hardbreaks] - -A pin may also be configured as an INPUT with `pinMode()`, and subsequently made HIGH with link:../../../functions/digital-io/digitalwrite[digitalWrite()]. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can done alternatively by passing `INPUT_PULLUP` as argument to the `pinMode()` funtion, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. -[%hardbreaks] - -When a pin is configured to OUTPUT with `pinMode()`, and set to `HIGH` with `digitalWrite()`, the pin is at: - - - 5 volts (5V boards) - - 3.3 volts (3.3V boards) - -In this state it can source current, e.g. light an LED that is connected through a series resistor to ground. -[%hardbreaks] - -[float] -=== LOW -The meaning of `LOW` also has a different meaning depending on whether a pin is set to `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with `pinMode()`, and read with `digitalRead()`, the Arduino (ATmega) will report LOW if: - - - a voltage less than 1.5V is present at the pin (5V boards) - - a voltage less than 1.0V (Approx) is present at the pin (3.3V boards) - -When a pin is configured to `OUTPUT` with `pinMode()`, and set to `LOW` with `digitalWrite()`, the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts). -[%hardbreaks] - -[float] -== Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT -Digital pins can be used as `INPUT`, `INPUT_PULLUP`, or `OUTPUT`. Changing a pin with `pinMode()` changes the electrical behavior of the pin. - -[float] -=== Pins Configured as INPUT -Arduino (ATmega) pins configured as `INPUT` with `pinMode()` are said to be in a _high-impedance_ state. Pins configured as `INPUT` make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor. -[%hardbreaks] - -If you have your pin configured as an `INPUT`, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not not draw too much current when the switch is closed. See the http://arduino.cc/en/Tutorial/DigitalReadSerial[Digital Read Serial^] tutorial for more information. -[%hardbreaks] - -If a pull-down resistor is used, the input pin will be `LOW` when the switch is open and `HIGH` when the switch is closed. -[%hardbreaks] - -If a pull-up resistor is used, the input pin will be `HIGH` when the switch is open and `LOW` when the switch is closed. -[%hardbreaks] - -[float] -=== Pins Configured as INPUT_PULLUP -The ATmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the `INPUT_PULLUP` argument in `pinMode()`. -[%hardbreaks] - -See the http://arduino.cc/en/Tutorial/InputPullupSerial[Input Pullup Serial^] tutorial for an example of this in use. -[%hardbreaks] - -Pins configured as inputs with either `INPUT` or `INPUT_PULLUP` can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V). -[%hardbreaks] - -[float] -=== Pins Configured as OUTPUT -Pins configured as `OUTPUT` with `pinMode()` are said to be in a _low-impedance_ state. This means that they can provide a substantial amount of current to other circuits. ATmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry. -[%hardbreaks] - -Pins configured as outputs can be damaged or destroyed if they are connected to either the ground or positive power rails. -[%hardbreaks] - -[float] -== Defining built-ins: LED_BUILTIN -Most Arduino boards have a pin connected to an on-board LED in series with a resistor. The constant `LED_BUILTIN` is the number of the pin to which the on-board LED is connected. Most boards have this LED connected to digital pin 13. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - --- -// HOW TO USE SECTION ENDS - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: constants +categories: [ "Variables" ] +subCategories: [ "Constants" ] +--- + += Constants + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +== Description +Constants are predefined expressions in the Arduino language. They are used to make the programs easier to read. We classify constants in groups: + +[float] +== Defining Logical Levels: true and false (Boolean Constants) +There are two constants used to represent truth and falsity in the Arduino language: `true`, and `false`. + +[float] +=== false +`false` is the easier of the two to define. false is defined as 0 (zero). +[%hardbreaks] + +[float] +=== true +`true` is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. +[%hardbreaks] + +Note that the `true` and `false` constants are typed in lowercase unlike `HIGH`, `LOW`, `INPUT`, and `OUTPUT`. +[%hardbreaks] + +[float] +== Defining Pin Levels: HIGH and LOW +When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: `HIGH` and `LOW`. + +[float] +=== HIGH +The meaning of `HIGH` (in reference to a pin) is somewhat different depending on whether a pin is set to an `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with link:../../../functions/digital-io/pinmode[pinMode()], and read with link:../../../functions/digital-io/digitalread[digitalRead()], the Arduino (ATmega) will report `HIGH` if: + + - a voltage greater than 3.0V is present at the pin (5V boards) + - a voltage greater than 2.0V volts is present at the pin (3.3V boards) +[%hardbreaks] + +A pin may also be configured as an INPUT with `pinMode()`, and subsequently made HIGH with link:../../../functions/digital-io/digitalwrite[digitalWrite()]. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can done alternatively by passing `INPUT_PULLUP` as argument to the `pinMode()` funtion, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. +[%hardbreaks] + +When a pin is configured to OUTPUT with `pinMode()`, and set to `HIGH` with `digitalWrite()`, the pin is at: + + - 5 volts (5V boards) + - 3.3 volts (3.3V boards) + +In this state it can source current, e.g. light an LED that is connected through a series resistor to ground. +[%hardbreaks] + +[float] +=== LOW +The meaning of `LOW` also has a different meaning depending on whether a pin is set to `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with `pinMode()`, and read with `digitalRead()`, the Arduino (ATmega) will report LOW if: + + - a voltage less than 1.5V is present at the pin (5V boards) + - a voltage less than 1.0V (Approx) is present at the pin (3.3V boards) + +When a pin is configured to `OUTPUT` with `pinMode()`, and set to `LOW` with `digitalWrite()`, the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts). +[%hardbreaks] + +[float] +== Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT +Digital pins can be used as `INPUT`, `INPUT_PULLUP`, or `OUTPUT`. Changing a pin with `pinMode()` changes the electrical behavior of the pin. + +[float] +=== Pins Configured as INPUT +Arduino (ATmega) pins configured as `INPUT` with `pinMode()` are said to be in a _high-impedance_ state. Pins configured as `INPUT` make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor. +[%hardbreaks] + +If you have your pin configured as an `INPUT`, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not not draw too much current when the switch is closed. See the http://arduino.cc/en/Tutorial/DigitalReadSerial[Digital Read Serial^] tutorial for more information. +[%hardbreaks] + +If a pull-down resistor is used, the input pin will be `LOW` when the switch is open and `HIGH` when the switch is closed. +[%hardbreaks] + +If a pull-up resistor is used, the input pin will be `HIGH` when the switch is open and `LOW` when the switch is closed. +[%hardbreaks] + +[float] +=== Pins Configured as INPUT_PULLUP +The ATmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the `INPUT_PULLUP` argument in `pinMode()`. +[%hardbreaks] + +See the http://arduino.cc/en/Tutorial/InputPullupSerial[Input Pullup Serial^] tutorial for an example of this in use. +[%hardbreaks] + +Pins configured as inputs with either `INPUT` or `INPUT_PULLUP` can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V). +[%hardbreaks] + +[float] +=== Pins Configured as OUTPUT +Pins configured as `OUTPUT` with `pinMode()` are said to be in a _low-impedance_ state. This means that they can provide a substantial amount of current to other circuits. ATmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry. +[%hardbreaks] + +Pins configured as outputs can be damaged or destroyed if they are connected to either the ground or positive power rails. +[%hardbreaks] + +[float] +== Defining built-ins: LED_BUILTIN +Most Arduino boards have a pin connected to an on-board LED in series with a resistor. The constant `LED_BUILTIN` is the number of the pin to which the on-board LED is connected. Most boards have this LED connected to digital pin 13. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +-- +// HOW TO USE SECTION ENDS + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Constants/floatingPointConstants.adoc b/Language/Variables/Constants/floatingPointConstants.adoc index b595af718..43e248203 100644 --- a/Language/Variables/Constants/floatingPointConstants.adoc +++ b/Language/Variables/Constants/floatingPointConstants.adoc @@ -1,80 +1,80 @@ ---- -title: Floating Point Constants -categories: [ "Variables" ] -subCategories: [ "Constants" ] ---- - - - - - -= Floating Point Constants - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Similar to integer constants, floating point constants are used to make code more readable. Floating point constants are swapped at compile time for the value to which the expression evaluates. -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -n = 0.005; // 0.005 is a floating point constant ----- -[%hardbreaks] - -[float] -=== Notes and Warnings -Floating point constants can also be expressed in a variety of scientific notation. 'E' and 'e' are both accepted as valid exponent indicators. -[%hardbreaks] - -|=== -|floating-point constant |evaluates to: |also evaluates to: - -|10.0 -|10 -| - -|2.34E5 -|2.34 * 10^5 -|234000 - -|67e-12 -|67.0 * 10^-12 -|0.000000000067 - -|=== -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: Floating Point Constants +categories: [ "Variables" ] +subCategories: [ "Constants" ] +--- + + + + + += Floating Point Constants + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Similar to integer constants, floating point constants are used to make code more readable. Floating point constants are swapped at compile time for the value to which the expression evaluates. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +n = 0.005; // 0.005 is a floating point constant +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +Floating point constants can also be expressed in a variety of scientific notation. 'E' and 'e' are both accepted as valid exponent indicators. +[%hardbreaks] + +|=== +|floating-point constant |evaluates to: |also evaluates to: + +|10.0 +|10 +| + +|2.34E5 +|2.34 * 10^5 +|234000 + +|67e-12 +|67.0 * 10^-12 +|0.000000000067 + +|=== +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Constants/integerConstants.adoc b/Language/Variables/Constants/integerConstants.adoc index c7ad5bada..d34e50370 100644 --- a/Language/Variables/Constants/integerConstants.adoc +++ b/Language/Variables/Constants/integerConstants.adoc @@ -1,143 +1,143 @@ ---- -title: Integer Constants -categories: [ "Variables" ] -subCategories: [ "Constants" ] ---- - - - - - -= Integer Constants - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Integer constants are numbers that are used directly in a sketch, like 123. By default, these numbers are treated as link:../../data-types/int[int] but you can change this with the U and L modifiers (see below). -[%hardbreaks] - -Normally, integer constants are treated as base 10 (decimal) integers, but special notation (formatters) may be used to enter numbers in other bases. -[%hardbreaks] - -|=== -|Base |Example |Formatter |Comment - -|10 (decimal) -|123 -|none -| - -|2 (binary) -|B1111011 -|leading 'B' -|only works with 8 bit values (0 to 255) characters 0&1 valid - -|8 (octal) -|0173 -|leading "0" -|characters 0-7 valid - -|16 (hexadecimal) -|0x7B -|leading "0x" -|characters 0-9, A-F, a-f valid -|=== -[%hardbreaks] - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- -[float] -== Decimal (base 10) -This is the common-sense math with which you are acquainted. Constants without other prefixes are assumed to be in decimal format. - -[float] -=== Example Code: -[source,arduino] ----- -n = 101; // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1) ----- -[%hardbreaks] - -[float] -== Binary (base 2) -Only the characters 0 and 1 are valid. - -[float] -=== Example Code: -[source,arduino] ----- -n = B101; // same as 5 decimal ((1 * 2^2) + (0 * 2^1) + 1) ----- - -The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it is convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as: -[source,arduino] ----- -myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte` ----- -[%hardbreaks] - -[float] -== Octal (base 8) -Only the characters 0 through 7 are valid. Octal values are indicated by the prefix "0" (zero). - -[float] -=== Example Code: -[source,arduino] ----- -n = 0101; // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) ----- -It is possible to generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal. -[%hardbreaks] - -[float] -== Hexadecimal (base 16) -Valid characters are 0 through 9 and letters A through F; A has the value 10, B is 11, up to F, which is 15. Hex values are indicated by the prefix "0x". Note that A-F may be upper (A-F) or lower case (a-f). - -[float] -=== Example Code: -[source,arduino] ----- -n = 0x101; // same as 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) ----- -[%hardbreaks] - - -[float] -=== Notes and Warnings -*U & L formatters:* - -By default, an integer constant is treated as an int with the attendant limitations in values. To specify an integer constant with another data type, follow it with: - - - a 'u' or 'U' to force the constant into an unsigned data format. Example: 33u - - a 'l' or 'L' to force the constant into a long data format. Example: 100000L - - a 'ul' or 'UL' to force the constant into an unsigned long constant. Example: 32767ul - -[%hardbreaks] - --- -// HOW TO USE SECTION ENDS - - - - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: Integer Constants +categories: [ "Variables" ] +subCategories: [ "Constants" ] +--- + + + + + += Integer Constants + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Integer constants are numbers that are used directly in a sketch, like 123. By default, these numbers are treated as link:../../data-types/int[int] but you can change this with the U and L modifiers (see below). +[%hardbreaks] + +Normally, integer constants are treated as base 10 (decimal) integers, but special notation (formatters) may be used to enter numbers in other bases. +[%hardbreaks] + +|=== +|Base |Example |Formatter |Comment + +|10 (decimal) +|123 +|none +| + +|2 (binary) +|B1111011 +|leading 'B' +|only works with 8 bit values (0 to 255) characters 0&1 valid + +|8 (octal) +|0173 +|leading "0" +|characters 0-7 valid + +|16 (hexadecimal) +|0x7B +|leading "0x" +|characters 0-9, A-F, a-f valid +|=== +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- +[float] +== Decimal (base 10) +This is the common-sense math with which you are acquainted. Constants without other prefixes are assumed to be in decimal format. + +[float] +=== Example Code: +[source,arduino] +---- +n = 101; // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1) +---- +[%hardbreaks] + +[float] +== Binary (base 2) +Only the characters 0 and 1 are valid. + +[float] +=== Example Code: +[source,arduino] +---- +n = B101; // same as 5 decimal ((1 * 2^2) + (0 * 2^1) + 1) +---- + +The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it is convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as: +[source,arduino] +---- +myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte` +---- +[%hardbreaks] + +[float] +== Octal (base 8) +Only the characters 0 through 7 are valid. Octal values are indicated by the prefix "0" (zero). + +[float] +=== Example Code: +[source,arduino] +---- +n = 0101; // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) +---- +It is possible to generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal. +[%hardbreaks] + +[float] +== Hexadecimal (base 16) +Valid characters are 0 through 9 and letters A through F; A has the value 10, B is 11, up to F, which is 15. Hex values are indicated by the prefix "0x". Note that A-F may be upper (A-F) or lower case (a-f). + +[float] +=== Example Code: +[source,arduino] +---- +n = 0x101; // same as 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) +---- +[%hardbreaks] + + +[float] +=== Notes and Warnings +*U & L formatters:* + +By default, an integer constant is treated as an int with the attendant limitations in values. To specify an integer constant with another data type, follow it with: + + - a 'u' or 'U' to force the constant into an unsigned data format. Example: 33u + - a 'l' or 'L' to force the constant into a long data format. Example: 100000L + - a 'ul' or 'UL' to force the constant into an unsigned long constant. Example: 32767ul + +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/c_str.adoc b/Language/Variables/Data Types/String/Functions/c_str.adoc index 24ec2e491..825f61e06 100644 --- a/Language/Variables/Data Types/String/Functions/c_str.adoc +++ b/Language/Variables/Data Types/String/Functions/c_str.adoc @@ -1,57 +1,57 @@ ---- -title: "c_str()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= c_str() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Converts the contents of a String as a C-style, null-terminated string. Note that this gives direct access to the internal String buffer and should be used with care. In particular, you should never modify the string through the pointer returned. When you modify the String object, or when it is destroyed, any pointer previously returned by c_str() becomes invalid and should not be used any longer. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.c_str()` - - -[float] -=== Parameters -`myString`: a variable of type `String`. - - -[float] -=== Returns -A pointer to the C-style version of the invoking String. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "c_str()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += c_str() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Converts the contents of a String as a C-style, null-terminated string. Note that this gives direct access to the internal String buffer and should be used with care. In particular, you should never modify the string through the pointer returned. When you modify the String object, or when it is destroyed, any pointer previously returned by c_str() becomes invalid and should not be used any longer. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.c_str()` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + + +[float] +=== Returns +A pointer to the C-style version of the invoking String. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/charAt.adoc b/Language/Variables/Data Types/String/Functions/charAt.adoc index 1db376bb6..a546ddd01 100644 --- a/Language/Variables/Data Types/String/Functions/charAt.adoc +++ b/Language/Variables/Data Types/String/Functions/charAt.adoc @@ -1,58 +1,58 @@ ---- -title: "charAt()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= charAt() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Access a particular character of the String. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.charAt(n)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`n`: a variable. Allowed data types: `unsigned int`. - - -[float] -=== Returns -The n'th character of the String. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "charAt()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += charAt() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Access a particular character of the String. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.charAt(n)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`n`: a variable. Allowed data types: `unsigned int`. + + +[float] +=== Returns +The n'th character of the String. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/compareTo.adoc b/Language/Variables/Data Types/String/Functions/compareTo.adoc index 98149180f..e03885872 100644 --- a/Language/Variables/Data Types/String/Functions/compareTo.adoc +++ b/Language/Variables/Data Types/String/Functions/compareTo.adoc @@ -1,61 +1,61 @@ ---- -title: "compareTo()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= compareTo() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Compares two Strings, testing whether one comes before or after the other, or whether they're equal. The strings are compared character by character, using the ASCII values of the characters. That means, for example, that 'a' comes before 'b' but after 'A'. Numbers come before letters. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.compareTo(myString2)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`myString2`: another variable of type `String`. - - -[float] -=== Returns -`a negative number`: if myString comes before myString2. + -`0`: if String equals myString2. + -`a positive number`: if myString comes after myString2. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "compareTo()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += compareTo() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Compares two Strings, testing whether one comes before or after the other, or whether they're equal. The strings are compared character by character, using the ASCII values of the characters. That means, for example, that 'a' comes before 'b' but after 'A'. Numbers come before letters. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.compareTo(myString2)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`myString2`: another variable of type `String`. + + +[float] +=== Returns +`a negative number`: if myString comes before myString2. + +`0`: if String equals myString2. + +`a positive number`: if myString comes after myString2. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/concat.adoc b/Language/Variables/Data Types/String/Functions/concat.adoc index 6161f6a9a..95c35f550 100644 --- a/Language/Variables/Data Types/String/Functions/concat.adoc +++ b/Language/Variables/Data Types/String/Functions/concat.adoc @@ -1,59 +1,59 @@ ---- -title: "concat()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= concat() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Appends the parameter to a String. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.concat(parameter)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`parameter`: Allowed data types: `String`, `string`, `char`, `byte`, `int`, `unsigned int`, `long`, `unsigned long`, `float`, `double`, `__FlashStringHelper`(`F()` macro). - - -[float] -=== Returns -`true`: success. + -`false`: failure (in which case the String is left unchanged). - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "concat()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += concat() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Appends the parameter to a String. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.concat(parameter)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`parameter`: Allowed data types: `String`, `string`, `char`, `byte`, `int`, `unsigned int`, `long`, `unsigned long`, `float`, `double`, `__FlashStringHelper`(`F()` macro). + + +[float] +=== Returns +`true`: success. + +`false`: failure (in which case the String is left unchanged). + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/endsWith.adoc b/Language/Variables/Data Types/String/Functions/endsWith.adoc index 02d5b07fa..7b456df76 100644 --- a/Language/Variables/Data Types/String/Functions/endsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/endsWith.adoc @@ -1,59 +1,59 @@ ---- -title: "endsWith()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= endsWith() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Tests whether or not a String ends with the characters of another String. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.endsWith(myString2)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`myString2`: another variable of type `String`. - - -[float] -=== Returns -`true`: if myString ends with the characters of myString2. + -`false`: otherwise. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "endsWith()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += endsWith() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Tests whether or not a String ends with the characters of another String. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.endsWith(myString2)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`myString2`: another variable of type `String`. + + +[float] +=== Returns +`true`: if myString ends with the characters of myString2. + +`false`: otherwise. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/equals.adoc b/Language/Variables/Data Types/String/Functions/equals.adoc index c784f2f81..2de11b4ea 100644 --- a/Language/Variables/Data Types/String/Functions/equals.adoc +++ b/Language/Variables/Data Types/String/Functions/equals.adoc @@ -1,58 +1,58 @@ ---- -title: "equals()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= equals() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Compares two Strings for equality. The comparison is case-sensitive, meaning the String "hello" is not equal to the String "HELLO". - -[%hardbreaks] - - -[float] -=== Syntax -`myString.equals(myString2)` - - -[float] -=== Parameters -`myString, myString2`: variables of type `String`. - - -[float] -=== Returns -`true`: if string equals string2. + -`false`: otherwise. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "equals()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += equals() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Compares two Strings for equality. The comparison is case-sensitive, meaning the String "hello" is not equal to the String "HELLO". + +[%hardbreaks] + + +[float] +=== Syntax +`myString.equals(myString2)` + + +[float] +=== Parameters +`myString, myString2`: variables of type `String`. + + +[float] +=== Returns +`true`: if string equals string2. + +`false`: otherwise. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc b/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc index 76c8ba689..d95953703 100644 --- a/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc +++ b/Language/Variables/Data Types/String/Functions/equalsIgnoreCase.adoc @@ -1,59 +1,59 @@ ---- -title: "equalsIgnoreCase()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= equalsIgnoreCase() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Compares two Strings for equality. The comparison is not case-sensitive, meaning the String("hello") is equal to the String("HELLO"). - -[%hardbreaks] - - -[float] -=== Syntax -`myString.equalsIgnoreCase(myString2)` - - -[float] -=== Parameters -`myString`: variable of type `String`. + -`myString2`: variable of type `String`. - - -[float] -=== Returns -`true`: if myString equals myString2 (ignoring case). + -`false`: otherwise. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "equalsIgnoreCase()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += equalsIgnoreCase() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Compares two Strings for equality. The comparison is not case-sensitive, meaning the String("hello") is equal to the String("HELLO"). + +[%hardbreaks] + + +[float] +=== Syntax +`myString.equalsIgnoreCase(myString2)` + + +[float] +=== Parameters +`myString`: variable of type `String`. + +`myString2`: variable of type `String`. + + +[float] +=== Returns +`true`: if myString equals myString2 (ignoring case). + +`false`: otherwise. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/getBytes.adoc b/Language/Variables/Data Types/String/Functions/getBytes.adoc index 7019ba3a3..ac758819e 100644 --- a/Language/Variables/Data Types/String/Functions/getBytes.adoc +++ b/Language/Variables/Data Types/String/Functions/getBytes.adoc @@ -1,59 +1,59 @@ ---- -title: "getBytes()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= getBytes() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Copies the String's characters to the supplied buffer. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.getBytes(buf, len)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`buf`: the buffer to copy the characters into. Allowed data types: array of `byte`s. + -`len`: the size of the buffer. Allowed data types: `unsigned int`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "getBytes()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += getBytes() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Copies the String's characters to the supplied buffer. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.getBytes(buf, len)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`buf`: the buffer to copy the characters into. Allowed data types: array of `byte`s. + +`len`: the size of the buffer. Allowed data types: `unsigned int`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/indexOf.adoc b/Language/Variables/Data Types/String/Functions/indexOf.adoc index aaba45ffc..58df9db78 100644 --- a/Language/Variables/Data Types/String/Functions/indexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/indexOf.adoc @@ -1,61 +1,61 @@ ---- -title: "indexOf()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= indexOf() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Locates a character or String within another String. By default, searches from the beginning of the String, but can also start from a given index, allowing for the locating of all instances of the character or String. - - -[%hardbreaks] - - -[float] -=== Syntax -`myString.indexOf(val)` + -`myString.indexOf(val, from)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`val`: the value to search for. Allowed data types: `char`, `String`. + -`from`: the index to start the search from. - - -[float] -=== Returns -The index of val within the String, or -1 if not found. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "indexOf()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += indexOf() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Locates a character or String within another String. By default, searches from the beginning of the String, but can also start from a given index, allowing for the locating of all instances of the character or String. + + +[%hardbreaks] + + +[float] +=== Syntax +`myString.indexOf(val)` + +`myString.indexOf(val, from)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`val`: the value to search for. Allowed data types: `char`, `String`. + +`from`: the index to start the search from. + + +[float] +=== Returns +The index of val within the String, or -1 if not found. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc index 1a6700532..ffabd6589 100644 --- a/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc +++ b/Language/Variables/Data Types/String/Functions/lastIndexOf.adoc @@ -1,60 +1,60 @@ ---- -title: "lastIndexOf()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= lastIndexOf() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Locates a character or String within another String. By default, searches from the end of the String, but can also work backwards from a given index, allowing for the locating of all instances of the character or String. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.lastIndexOf(val)` + -`myString.lastIndexOf(val, from)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`val`: the value to search for. Allowed data types: `char`, `String`. + -`from`: the index to work backwards from. - - -[float] -=== Returns -The index of val within the String, or -1 if not found. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "lastIndexOf()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += lastIndexOf() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Locates a character or String within another String. By default, searches from the end of the String, but can also work backwards from a given index, allowing for the locating of all instances of the character or String. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.lastIndexOf(val)` + +`myString.lastIndexOf(val, from)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`val`: the value to search for. Allowed data types: `char`, `String`. + +`from`: the index to work backwards from. + + +[float] +=== Returns +The index of val within the String, or -1 if not found. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/length.adoc b/Language/Variables/Data Types/String/Functions/length.adoc index d0a2703e6..a0b644b42 100644 --- a/Language/Variables/Data Types/String/Functions/length.adoc +++ b/Language/Variables/Data Types/String/Functions/length.adoc @@ -1,57 +1,57 @@ ---- -title: "length()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= length() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Returns the length of the String, in characters. (Note that this doesn't include a trailing null character.) - -[%hardbreaks] - - -[float] -=== Syntax -`myString.length()` - - -[float] -=== Parameters -`myString`: a variable of type `String`. - - -[float] -=== Returns -The length of the String in characters. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "length()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += length() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Returns the length of the String, in characters. (Note that this doesn't include a trailing null character.) + +[%hardbreaks] + + +[float] +=== Syntax +`myString.length()` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + + +[float] +=== Returns +The length of the String in characters. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/remove.adoc b/Language/Variables/Data Types/String/Functions/remove.adoc index 02ea6a7a7..55b419ed1 100644 --- a/Language/Variables/Data Types/String/Functions/remove.adoc +++ b/Language/Variables/Data Types/String/Functions/remove.adoc @@ -1,73 +1,73 @@ ---- -title: "remove()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= remove() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Modify in place a String removing chars from the provided index to the end of the String or from the provided index to index plus count. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.remove(index)` + -`myString.remove(index, count)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`index`: The position at which to start the remove process (zero indexed). Allowed data types: `unsigned int`. + -`count`: The number of characters to remove. Allowed data types: `unsigned int`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ -[source,arduino] ----- -String greeting = "hello"; -greeting.remove(2, 2); // greeting now contains "heo" ----- -[%hardbreaks] --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "remove()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += remove() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Modify in place a String removing chars from the provided index to the end of the String or from the provided index to index plus count. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.remove(index)` + +`myString.remove(index, count)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`index`: The position at which to start the remove process (zero indexed). Allowed data types: `unsigned int`. + +`count`: The number of characters to remove. Allowed data types: `unsigned int`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ +[source,arduino] +---- +String greeting = "hello"; +greeting.remove(2, 2); // greeting now contains "heo" +---- +[%hardbreaks] +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/replace.adoc b/Language/Variables/Data Types/String/Functions/replace.adoc index 0905a7d5d..2555182a2 100644 --- a/Language/Variables/Data Types/String/Functions/replace.adoc +++ b/Language/Variables/Data Types/String/Functions/replace.adoc @@ -1,59 +1,59 @@ ---- -title: "replace()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= replace() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The String replace() function allows you to replace all instances of a given character with another character. You can also use replace to replace substrings of a String with a different substring. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.replace(substring1, substring2)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`substring1`: another variable of type `String`. + -`substring2`: another variable of type `String`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "replace()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += replace() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The String replace() function allows you to replace all instances of a given character with another character. You can also use replace to replace substrings of a String with a different substring. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.replace(substring1, substring2)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`substring1`: another variable of type `String`. + +`substring2`: another variable of type `String`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/reserve.adoc b/Language/Variables/Data Types/String/Functions/reserve.adoc index ee679674c..10d76d6ec 100644 --- a/Language/Variables/Data Types/String/Functions/reserve.adoc +++ b/Language/Variables/Data Types/String/Functions/reserve.adoc @@ -1,88 +1,88 @@ ---- -title: "reserve()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= reserve() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -The String reserve() function allows you to allocate a buffer in memory for manipulating Strings. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.reserve(size)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`size`: the number of bytes in memory to save for String manipulation. Allowed data types: `unsigned int`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code - -[source,arduino] ----- -String myString; - -void setup() { - // initialize serial and wait for port to open: - Serial.begin(9600); - while (!Serial) { - ; // wait for serial port to connect. Needed for native USB - } - - myString.reserve(26); - myString = "i="; - myString += "1234"; - myString += ", is that ok?"; - - // print the String: - Serial.println(myString); -} - -void loop() { - // nothing to do here -} ----- --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "reserve()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += reserve() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The String reserve() function allows you to allocate a buffer in memory for manipulating Strings. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.reserve(size)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`size`: the number of bytes in memory to save for String manipulation. Allowed data types: `unsigned int`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code + +[source,arduino] +---- +String myString; + +void setup() { + // initialize serial and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB + } + + myString.reserve(26); + myString = "i="; + myString += "1234"; + myString += ", is that ok?"; + + // print the String: + Serial.println(myString); +} + +void loop() { + // nothing to do here +} +---- +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/setCharAt.adoc b/Language/Variables/Data Types/String/Functions/setCharAt.adoc index d0dfc823a..369126e44 100644 --- a/Language/Variables/Data Types/String/Functions/setCharAt.adoc +++ b/Language/Variables/Data Types/String/Functions/setCharAt.adoc @@ -1,59 +1,59 @@ ---- -title: "setCharAt()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= setCharAt() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Sets a character of the String. Has no effect on indices outside the existing length of the String. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.setCharAt(index, c)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`index`: the index to set the character at. + -`c`: the character to store to the given location. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "setCharAt()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += setCharAt() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Sets a character of the String. Has no effect on indices outside the existing length of the String. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.setCharAt(index, c)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`index`: the index to set the character at. + +`c`: the character to store to the given location. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/startsWith.adoc b/Language/Variables/Data Types/String/Functions/startsWith.adoc index 76390ac91..3cf1acf7b 100644 --- a/Language/Variables/Data Types/String/Functions/startsWith.adoc +++ b/Language/Variables/Data Types/String/Functions/startsWith.adoc @@ -1,58 +1,58 @@ ---- -title: "startsWith()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= startsWith() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Tests whether or not a String starts with the characters of another String. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.startsWith(myString2)` - - -[float] -=== Parameters -`myString, myString2`: a variable of type `String`. - - -[float] -=== Returns -`true`: if myString starts with the characters of myString2. + -`false`: otherwise - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "startsWith()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += startsWith() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Tests whether or not a String starts with the characters of another String. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.startsWith(myString2)` + + +[float] +=== Parameters +`myString, myString2`: a variable of type `String`. + + +[float] +=== Returns +`true`: if myString starts with the characters of myString2. + +`false`: otherwise + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/substring.adoc b/Language/Variables/Data Types/String/Functions/substring.adoc index 5cf91d596..cee035575 100644 --- a/Language/Variables/Data Types/String/Functions/substring.adoc +++ b/Language/Variables/Data Types/String/Functions/substring.adoc @@ -1,60 +1,60 @@ ---- -title: "substring()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= substring() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Get a substring of a String. The starting index is inclusive (the corresponding character is included in the substring), but the optional ending index is exclusive (the corresponding character is not included in the substring). If the ending index is omitted, the substring continues to the end of the String. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.substring(from)` + -`myString.substring(from, to)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`from`: the index to start the substring at. + -`to` (optional): the index to end the substring before. - - -[float] -=== Returns -The substring. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "substring()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += substring() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Get a substring of a String. The starting index is inclusive (the corresponding character is included in the substring), but the optional ending index is exclusive (the corresponding character is not included in the substring). If the ending index is omitted, the substring continues to the end of the String. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.substring(from)` + +`myString.substring(from, to)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`from`: the index to start the substring at. + +`to` (optional): the index to end the substring before. + + +[float] +=== Returns +The substring. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toCharArray.adoc b/Language/Variables/Data Types/String/Functions/toCharArray.adoc index bc36e4c19..c0c24ace6 100644 --- a/Language/Variables/Data Types/String/Functions/toCharArray.adoc +++ b/Language/Variables/Data Types/String/Functions/toCharArray.adoc @@ -1,59 +1,59 @@ ---- -title: "toCharArray()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= toCharArray() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Copies the String's characters to the supplied buffer. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.toCharArray(buf, len)` - - -[float] -=== Parameters -`myString`: a variable of type `String`. + -`buf`: the buffer to copy the characters into. Allowed data types: array of `char`s. + -`len`: the size of the buffer. Allowed data types: `unsigned int`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "toCharArray()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += toCharArray() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Copies the String's characters to the supplied buffer. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.toCharArray(buf, len)` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + +`buf`: the buffer to copy the characters into. Allowed data types: array of `char`s. + +`len`: the size of the buffer. Allowed data types: `unsigned int`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toDouble.adoc b/Language/Variables/Data Types/String/Functions/toDouble.adoc index 622211837..1ede4a704 100644 --- a/Language/Variables/Data Types/String/Functions/toDouble.adoc +++ b/Language/Variables/Data Types/String/Functions/toDouble.adoc @@ -1,57 +1,57 @@ ---- -title: "toDouble()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= toDouble() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Converts a valid String to a double. The input String should start with a digit. If the String contains non-digit characters, the function will stop performing the conversion. For example, the Strings "123.45", "123", and "123fish" are converted to 123.45, 123.00, and 123.00 respectively. Note that "123.456" is approximated with 123.46. Note too that floats have only 6-7 decimal digits of precision and that longer Strings might be truncated. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.toDouble()` - - -[float] -=== Parameters -`myString`: a variable of type `String`. - - -[float] -=== Returns -If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. Data type: `double`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "toDouble()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += toDouble() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Converts a valid String to a double. The input String should start with a digit. If the String contains non-digit characters, the function will stop performing the conversion. For example, the Strings "123.45", "123", and "123fish" are converted to 123.45, 123.00, and 123.00 respectively. Note that "123.456" is approximated with 123.46. Note too that floats have only 6-7 decimal digits of precision and that longer Strings might be truncated. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.toDouble()` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + + +[float] +=== Returns +If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. Data type: `double`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toFloat.adoc b/Language/Variables/Data Types/String/Functions/toFloat.adoc index 52d3d3f20..91c1e1f5f 100644 --- a/Language/Variables/Data Types/String/Functions/toFloat.adoc +++ b/Language/Variables/Data Types/String/Functions/toFloat.adoc @@ -1,57 +1,57 @@ ---- -title: "toFloat()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= toFloat() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Converts a valid String to a float. The input String should start with a digit. If the String contains non-digit characters, the function will stop performing the conversion. For example, the Strings "123.45", "123", and "123fish" are converted to 123.45, 123.00, and 123.00 respectively. Note that "123.456" is approximated with 123.46. Note too that floats have only 6-7 decimal digits of precision and that longer Strings might be truncated. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.toFloat()` - - -[float] -=== Parameters -`myString`: a variable of type `String`. - - -[float] -=== Returns -If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. Data type: `float`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "toFloat()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += toFloat() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Converts a valid String to a float. The input String should start with a digit. If the String contains non-digit characters, the function will stop performing the conversion. For example, the Strings "123.45", "123", and "123fish" are converted to 123.45, 123.00, and 123.00 respectively. Note that "123.456" is approximated with 123.46. Note too that floats have only 6-7 decimal digits of precision and that longer Strings might be truncated. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.toFloat()` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + + +[float] +=== Returns +If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned. Data type: `float`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toInt.adoc b/Language/Variables/Data Types/String/Functions/toInt.adoc index f50acb697..3c238da57 100644 --- a/Language/Variables/Data Types/String/Functions/toInt.adoc +++ b/Language/Variables/Data Types/String/Functions/toInt.adoc @@ -1,57 +1,57 @@ ---- -title: "toInt()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= toInt() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Converts a valid String to an integer. The input String should start with an integer number. If the String contains non-integer numbers, the function will stop performing the conversion. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.toInt()` - - -[float] -=== Parameters -`myString`: a variable of type `String`. - - -[float] -=== Returns -If no valid conversion could be performed because the String doesn't start with a integer number, a zero is returned. Data type: `long`. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "toInt()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += toInt() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Converts a valid String to an integer. The input String should start with an integer number. If the String contains non-integer numbers, the function will stop performing the conversion. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.toInt()` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + + +[float] +=== Returns +If no valid conversion could be performed because the String doesn't start with a integer number, a zero is returned. Data type: `long`. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc index d94279650..9fe9a2fb5 100644 --- a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc @@ -1,57 +1,57 @@ ---- -title: "toLowerCase()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= toLowerCase() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Get a lower-case version of a String. As of 1.0, toLowerCase() modifies the String in place rather than returning a new one. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.toLowerCase()` - - -[float] -=== Parameters -`myString`: a variable of type `String`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "toLowerCase()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += toLowerCase() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Get a lower-case version of a String. As of 1.0, toLowerCase() modifies the String in place rather than returning a new one. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.toLowerCase()` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc index 07beae25d..81ef0dd79 100644 --- a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc @@ -1,56 +1,56 @@ ---- -title: "toUpperCase()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= toUpperCase() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Get an upper-case version of a String. As of 1.0, toUpperCase() modifies the String in place rather than returning a new one. -[%hardbreaks] - - -[float] -=== Syntax -`myString.toUpperCase()` - - -[float] -=== Parameters -`myString`: a variable of type `String`. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "toUpperCase()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += toUpperCase() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Get an upper-case version of a String. As of 1.0, toUpperCase() modifies the String in place rather than returning a new one. +[%hardbreaks] + + +[float] +=== Syntax +`myString.toUpperCase()` + + +[float] +=== Parameters +`myString`: a variable of type `String`. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/trim.adoc b/Language/Variables/Data Types/String/Functions/trim.adoc index 4b965dbcc..f5a3fb27d 100644 --- a/Language/Variables/Data Types/String/Functions/trim.adoc +++ b/Language/Variables/Data Types/String/Functions/trim.adoc @@ -1,57 +1,57 @@ ---- -title: "trim()" -categories: [ "Data Types" ] -subCategories: [ "StringObject Function" ] ---- - - - - - -= trim() - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Get a version of the String with any leading and trailing whitespace removed. As of 1.0, trim() modifies the String in place rather than returning a new one. - -[%hardbreaks] - - -[float] -=== Syntax -`myString.trim()` - - -[float] -=== Parameters -`myString`: a variable of type String. - - -[float] -=== Returns -Nothing - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "trim()" +categories: [ "Data Types" ] +subCategories: [ "StringObject Function" ] +--- + + + + + += trim() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Get a version of the String with any leading and trailing whitespace removed. As of 1.0, trim() modifies the String in place rather than returning a new one. + +[%hardbreaks] + + +[float] +=== Syntax +`myString.trim()` + + +[float] +=== Parameters +`myString`: a variable of type String. + + +[float] +=== Returns +Nothing + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/append.adoc b/Language/Variables/Data Types/String/Operators/append.adoc index 808d8fe5d..b2ca3b289 100644 --- a/Language/Variables/Data Types/String/Operators/append.adoc +++ b/Language/Variables/Data Types/String/Operators/append.adoc @@ -1,59 +1,59 @@ ---- -title: "+=" -title_expanded: append -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - - - - - -= += Append - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -It concatenates Strings with other data. - -[%hardbreaks] - - -[float] -=== Syntax -`myString1 += data` - - -[float] -=== Parameters -`myString1`: a String variable. - - -[float] -=== Returns -Nothing - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "+=" +title_expanded: append +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + + + + + += += Append + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +It concatenates Strings with other data. + +[%hardbreaks] + + +[float] +=== Syntax +`myString1 += data` + + +[float] +=== Parameters +`myString1`: a String variable. + + +[float] +=== Returns +Nothing + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/comparison.adoc b/Language/Variables/Data Types/String/Operators/comparison.adoc index bdd4e1262..4a711375d 100644 --- a/Language/Variables/Data Types/String/Operators/comparison.adoc +++ b/Language/Variables/Data Types/String/Operators/comparison.adoc @@ -1,57 +1,57 @@ ---- -title: "==" -title_expanded: comparison -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - -= == Comparison - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Compares two Strings for equality. The comparison is case-sensitive, meaning the String "hello" is not equal to the String "HELLO". Functionally the same as string.equals() - - -[%hardbreaks] - - -[float] -=== Syntax -`myString1 == myString2` - -[float] -=== Parameters -`myString1`: a String variable. + -`myString2`: a String variable. - - -[float] -=== Returns -`true`: if myString1 equals myString2. + -`false`: otherwise. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "==" +title_expanded: comparison +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + += == Comparison + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Compares two Strings for equality. The comparison is case-sensitive, meaning the String "hello" is not equal to the String "HELLO". Functionally the same as string.equals() + + +[%hardbreaks] + + +[float] +=== Syntax +`myString1 == myString2` + +[float] +=== Parameters +`myString1`: a String variable. + +`myString2`: a String variable. + + +[float] +=== Returns +`true`: if myString1 equals myString2. + +`false`: otherwise. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/concatenation.adoc b/Language/Variables/Data Types/String/Operators/concatenation.adoc index bcc3d6096..67fd53ca2 100644 --- a/Language/Variables/Data Types/String/Operators/concatenation.adoc +++ b/Language/Variables/Data Types/String/Operators/concatenation.adoc @@ -1,61 +1,61 @@ ---- -title: "+" -title_expanded: concatenation -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - - - - - -= + Concatenation - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Combines, or concatenates two Strings into one new String. The second String is appended to the first, and the result is placed in a new String. Works the same as string.concat(). - -[%hardbreaks] - - -[float] -=== Syntax -`myString3 = myString1 + myString2` - - -[float] -=== Parameters -`myString1`: a String variable. + -`myString2`: a String variable. + -`myString3`: a String variable. - - -[float] -=== Returns -New String that is the combination of the original two Strings. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "+" +title_expanded: concatenation +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + + + + + += + Concatenation + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Combines, or concatenates two Strings into one new String. The second String is appended to the first, and the result is placed in a new String. Works the same as string.concat(). + +[%hardbreaks] + + +[float] +=== Syntax +`myString3 = myString1 + myString2` + + +[float] +=== Parameters +`myString1`: a String variable. + +`myString2`: a String variable. + +`myString3`: a String variable. + + +[float] +=== Returns +New String that is the combination of the original two Strings. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/differentFrom.adoc b/Language/Variables/Data Types/String/Operators/differentFrom.adoc index b073f6b03..c26fe47d4 100644 --- a/Language/Variables/Data Types/String/Operators/differentFrom.adoc +++ b/Language/Variables/Data Types/String/Operators/differentFrom.adoc @@ -1,61 +1,61 @@ ---- -title: "!=" -title_expanded: different from -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - - - - - -= != Different From - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Compares two Strings for difference. The comparison is case-sensitive, meaning the String "hello" is not equal to the String "HELLO". Functionally the same as string.equals() - -[%hardbreaks] - - -[float] -=== Syntax -`myString1 != myString2` - - -[float] -=== Parameters -`myString1: a String variable. + -`myString2`: a String variable. - - -[float] -=== Returns -`true`: if myString1 is different from myString2. + -`false`: otherwise. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "!=" +title_expanded: different from +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + + + + + += != Different From + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Compares two Strings for difference. The comparison is case-sensitive, meaning the String "hello" is not equal to the String "HELLO". Functionally the same as string.equals() + +[%hardbreaks] + + +[float] +=== Syntax +`myString1 != myString2` + + +[float] +=== Parameters +`myString1: a String variable. + +`myString2`: a String variable. + + +[float] +=== Returns +`true`: if myString1 is different from myString2. + +`false`: otherwise. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/elementAccess.adoc b/Language/Variables/Data Types/String/Operators/elementAccess.adoc index 4ca3a7eee..bc9d73a9b 100644 --- a/Language/Variables/Data Types/String/Operators/elementAccess.adoc +++ b/Language/Variables/Data Types/String/Operators/elementAccess.adoc @@ -1,61 +1,61 @@ ---- -title: "[] " -title_expanded: element access -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - - - - - -= [] Element Access - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Allows you access to the individual characters of a String. - -[%hardbreaks] - - -[float] -=== Syntax -`char thisChar = myString1[n]` - - -[float] -=== Parameters -`thisChar`: Allowed data types: char. + -`myString1`: Allowed data types: String. + -`n`: a numeric variable. - - -[float] -=== Returns -The nth char of the String. Same as charAt(). - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "[] " +title_expanded: element access +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + + + + + += [] Element Access + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Allows you access to the individual characters of a String. + +[%hardbreaks] + + +[float] +=== Syntax +`char thisChar = myString1[n]` + + +[float] +=== Parameters +`thisChar`: Allowed data types: char. + +`myString1`: Allowed data types: String. + +`n`: a numeric variable. + + +[float] +=== Returns +The nth char of the String. Same as charAt(). + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/greaterThan.adoc b/Language/Variables/Data Types/String/Operators/greaterThan.adoc index 0c7de7f9f..26178c85c 100644 --- a/Language/Variables/Data Types/String/Operators/greaterThan.adoc +++ b/Language/Variables/Data Types/String/Operators/greaterThan.adoc @@ -1,62 +1,62 @@ ---- -title: ">" -title_expanded: greater than -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - - - - - -= > Greater Than - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Tests if the String on the left is greater than the String on the right. This operator evaluates Strings in alphabetical order, on the first character where the two differ. So, for example "b" > "a" and "2" > "1", but "999" > "1000" because 9 comes after 1. - -Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. -[%hardbreaks] - - -[float] -=== Syntax -`myString1 > myString2` - - -[float] -=== Parameters -`myString1`: a String variable. + -`myString2`: a String variable. - - -[float] -=== Returns -`true`: if myString1 is greater than myString2. + -`false`: otherwise. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: ">" +title_expanded: greater than +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + + + + + += > Greater Than + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Tests if the String on the left is greater than the String on the right. This operator evaluates Strings in alphabetical order, on the first character where the two differ. So, for example "b" > "a" and "2" > "1", but "999" > "1000" because 9 comes after 1. + +Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. +[%hardbreaks] + + +[float] +=== Syntax +`myString1 > myString2` + + +[float] +=== Parameters +`myString1`: a String variable. + +`myString2`: a String variable. + + +[float] +=== Returns +`true`: if myString1 is greater than myString2. + +`false`: otherwise. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc b/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc index da17d2671..79444aa6a 100644 --- a/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc +++ b/Language/Variables/Data Types/String/Operators/greaterThanOrEqualTo.adoc @@ -1,58 +1,58 @@ ---- -title: ">=" -title_expanded: greater than or equal to -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - -= >= Greater Than Or Equal To - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Tests if the String on the left is greater than, or equal to, the String on the right. This operator evaluate Strings in alphabetical order, on the first character where the two differ. So, for example "b" >= "a" and "2" >= "1", but "999" >= "1000" because 9 comes after 1. - -Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. - -[%hardbreaks] - - -[float] -=== Syntax -`myString1 >= myString2` - - -[float] -=== Parameters -`myString1`: variable of type String. + -`myString2: variable of type String. - - -[float] -=== Returns -`true`: if myString1 is greater than or equal to myString2. + -`false`: otherwise. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: ">=" +title_expanded: greater than or equal to +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + += >= Greater Than Or Equal To + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Tests if the String on the left is greater than, or equal to, the String on the right. This operator evaluate Strings in alphabetical order, on the first character where the two differ. So, for example "b" >= "a" and "2" >= "1", but "999" >= "1000" because 9 comes after 1. + +Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. + +[%hardbreaks] + + +[float] +=== Syntax +`myString1 >= myString2` + + +[float] +=== Parameters +`myString1`: variable of type String. + +`myString2: variable of type String. + + +[float] +=== Returns +`true`: if myString1 is greater than or equal to myString2. + +`false`: otherwise. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/lessThan.adoc b/Language/Variables/Data Types/String/Operators/lessThan.adoc index f145620cc..43dda7fa1 100644 --- a/Language/Variables/Data Types/String/Operators/lessThan.adoc +++ b/Language/Variables/Data Types/String/Operators/lessThan.adoc @@ -1,58 +1,58 @@ ---- -title: "<" -title_expanded: less thans -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - -= < Less Than - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Tests if the String on the left is less than the String on the right. This operator evaluate Strings in alphabetical order, on the first character where the two differ. So, for example "a" < "b" and "1" < "2", but "999" > "1000" because 9 comes after 1. - -Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. - -[%hardbreaks] - - -[float] -=== Syntax -`myString1 < myString2` - - -[float] -=== Parameters -`myString1`: variable of type String. + -`myString2`: variable of type String. - - -[float] -=== Returns -`true`: if myString1 is less than myString2. + -`false`: otherwise. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "<" +title_expanded: less thans +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + += < Less Than + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Tests if the String on the left is less than the String on the right. This operator evaluate Strings in alphabetical order, on the first character where the two differ. So, for example "a" < "b" and "1" < "2", but "999" > "1000" because 9 comes after 1. + +Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. + +[%hardbreaks] + + +[float] +=== Syntax +`myString1 < myString2` + + +[float] +=== Parameters +`myString1`: variable of type String. + +`myString2`: variable of type String. + + +[float] +=== Returns +`true`: if myString1 is less than myString2. + +`false`: otherwise. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc b/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc index 13c04f623..9ea998aff 100644 --- a/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc +++ b/Language/Variables/Data Types/String/Operators/lessThanOrEqualTo.adoc @@ -1,63 +1,63 @@ ---- -title: "<=" -title_expanded: less than or equal -categories: [ "Data Types" ] -subCategories: [ "StringObject Operator" ] ---- - - - - - -= <= Less Than Or Equal - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Tests if the String on the left is less than or equal to the String on the right. This operator evaluate Strings in alphabetical order, on the first character where the two differ. So, for example "a" < "b" and "1" < "2", but "999" > "1000" because 9 comes after 1. - -Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. - -[%hardbreaks] - - -[float] -=== Syntax -`myString1 <= myString2` - - -[float] -=== Parameters -`myString1`: variable of type String. + -`myString2`: variable of type String. - - -[float] -=== Returns -`true`: if myString1 is less than or equal to myString2. + -`false`: otherwise. - --- - -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION -[#see_also] --- - -[float] -=== See also - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] --- -// SEE ALSO SECTION ENDS +--- +title: "<=" +title_expanded: less than or equal +categories: [ "Data Types" ] +subCategories: [ "StringObject Operator" ] +--- + + + + + += <= Less Than Or Equal + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Tests if the String on the left is less than or equal to the String on the right. This operator evaluate Strings in alphabetical order, on the first character where the two differ. So, for example "a" < "b" and "1" < "2", but "999" > "1000" because 9 comes after 1. + +Caution: String comparison operators can be confusing when you're comparing numeric Strings, because the numbers are treated as Strings and not as numbers. If you need to compare numbers numerically, compare them as ints, floats, or longs, and not as Strings. + +[%hardbreaks] + + +[float] +=== Syntax +`myString1 <= myString2` + + +[float] +=== Parameters +`myString1`: variable of type String. + +`myString2`: variable of type String. + + +[float] +=== Returns +`true`: if myString1 is less than or equal to myString2. + +`false`: otherwise. + +-- + +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] +-- +// SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/stringObject.adoc b/Language/Variables/Data Types/stringObject.adoc index 80e320389..396582b3d 100644 --- a/Language/Variables/Data Types/stringObject.adoc +++ b/Language/Variables/Data Types/stringObject.adoc @@ -1,155 +1,155 @@ ---- -title: "String()" -categories: [ "Variables" ] -subCategories: [ "Data Types" ] ---- - -= String() - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -=== Description -Constructs an instance of the String class. There are multiple versions that construct Strings from different data types (i.e. format them as sequences of characters), including: - -* a constant string of characters, in double quotes (i.e. a char array) -* a single constant character, in single quotes -* another instance of the String object -* a constant integer or long integer -* a constant integer or long integer, using a specified base -* an integer or long integer variable -* an integer or long integer variable, using a specified base -* a float or double, using a specified decimal places - -Constructing a String from a number results in a string that contains the ASCII representation of that number. The default is base ten, so -[source,arduino] ----- -String thisString = String(13); ----- -gives you the String "13". You can use other bases, however. For example, - - -[source,arduino] ----- -String thisString = String(13, HEX); ----- - -gives you the String "D", which is the hexadecimal representation of the decimal value 13. Or if you prefer binary, - -[source,arduino] ----- -String thisString = String(13, BIN); ----- - -gives you the String "1101", which is the binary representation of 13. -[%hardbreaks] - - -[float] -=== Syntax -`String(val)` + -`String(val, base)` + -`String(val, decimalPlaces)` - - -[float] -=== Parameters -`val`: a variable to format as a String. Allowed data types: string, char, byte, int, long, unsigned int, unsigned long, float, double. + -`base`: (optional) the base in which to format an integral value. + -`decimalPlaces`: *only if val is float or double*. The desired decimal places. - - -[float] -=== Returns -An instance of the String class. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - -[float] -=== Example Code -All of the following are valid declarations for Strings. -[source,arduino] ----- -String stringOne = "Hello String"; // using a constant String -String stringOne = String('a'); // converting a constant char into a String -String stringTwo = String("This is a string"); // converting a constant string into a String object -String stringOne = String(stringTwo + " with more"); // concatenating two strings -String stringOne = String(13); // using a constant integer -String stringOne = String(analogRead(0), DEC); // using an int and a base -String stringOne = String(45, HEX); // using an int and a base (hexadecimal) -String stringOne = String(255, BIN); // using an int and a base (binary) -String stringOne = String(millis(), DEC); // using a long and a base -String stringOne = String(5.698, 3); // using a float and the decimal places ----- - --- -// HOW TO USE SECTION ENDS - - -[float] -=== Functions - -[role="language"] -* #LANGUAGE# link:../string/functions/charat[charAt()] -* #LANGUAGE# link:../string/functions/compareto[compareTo()] -* #LANGUAGE# link:../string/functions/concat[concat()] -* #LANGUAGE# link:../string/functions/c_str[c_str()] -* #LANGUAGE# link:../string/functions/endswith[endsWith()] -* #LANGUAGE# link:../string/functions/equals[equals()] -* #LANGUAGE# link:../string/functions/equalsignorecase[equalsIgnoreCase()] -* #LANGUAGE# link:../string/functions/getbytes[getBytes()] -* #LANGUAGE# link:../string/functions/indexof[indexOf()] -* #LANGUAGE# link:../string/functions/lastindexof[lastIndexOf()] -* #LANGUAGE# link:../string/functions/length[length()] -* #LANGUAGE# link:../string/functions/remove[remove()] -* #LANGUAGE# link:../string/functions/replace[replace()] -* #LANGUAGE# link:../string/functions/reserve[reserve()] -* #LANGUAGE# link:../string/functions/setcharat[setCharAt()] -* #LANGUAGE# link:../string/functions/startswith[startsWith()] -* #LANGUAGE# link:../string/functions/substring[substring()] -* #LANGUAGE# link:../string/functions/tochararray[toCharArray()] -* #LANGUAGE# link:../string/functions/todouble[toDouble()] -* #LANGUAGE# link:../string/functions/toint[toInt()] -* #LANGUAGE# link:../string/functions/tofloat[toFloat()] -* #LANGUAGE# link:../string/functions/tolowercase[toLowerCase()] -* #LANGUAGE# link:../string/functions/touppercase[toUpperCase()] -* #LANGUAGE# link:../string/functions/trim[trim()] - -[float] -=== Operators - -[role="language"] -* #LANGUAGE# link:../string/operators/elementaccess[[\] (element access)] -* #LANGUAGE# link:../string/operators/concatenation[+ (concatenation)] -* #LANGUAGE# link:../string/operators/append[+= (append)] -* #LANGUAGE# link:../string/operators/comparison[== (comparison)] -* #LANGUAGE# link:../string/operators/greaterthan[> (greater than)] -* #LANGUAGE# link:../string/operators/greaterthanorequalto[>= (greater than or equal to)] -* #LANGUAGE# link:../string/operators/lessthan[< (less than)] -* #LANGUAGE# link:../string/operators/lessthanorequalto[\<= (less than or equal to)] -* #LANGUAGE# link:../string/operators/differentfrom[!= (different from)] - -[role="example"] -* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] - - -// SEE ALSO SECTION STARTS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS +--- +title: "String()" +categories: [ "Variables" ] +subCategories: [ "Data Types" ] +--- + += String() + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Constructs an instance of the String class. There are multiple versions that construct Strings from different data types (i.e. format them as sequences of characters), including: + +* a constant string of characters, in double quotes (i.e. a char array) +* a single constant character, in single quotes +* another instance of the String object +* a constant integer or long integer +* a constant integer or long integer, using a specified base +* an integer or long integer variable +* an integer or long integer variable, using a specified base +* a float or double, using a specified decimal places + +Constructing a String from a number results in a string that contains the ASCII representation of that number. The default is base ten, so +[source,arduino] +---- +String thisString = String(13); +---- +gives you the String "13". You can use other bases, however. For example, + + +[source,arduino] +---- +String thisString = String(13, HEX); +---- + +gives you the String "D", which is the hexadecimal representation of the decimal value 13. Or if you prefer binary, + +[source,arduino] +---- +String thisString = String(13, BIN); +---- + +gives you the String "1101", which is the binary representation of 13. +[%hardbreaks] + + +[float] +=== Syntax +`String(val)` + +`String(val, base)` + +`String(val, decimalPlaces)` + + +[float] +=== Parameters +`val`: a variable to format as a String. Allowed data types: string, char, byte, int, long, unsigned int, unsigned long, float, double. + +`base`: (optional) the base in which to format an integral value. + +`decimalPlaces`: *only if val is float or double*. The desired decimal places. + + +[float] +=== Returns +An instance of the String class. + +-- +// OVERVIEW SECTION ENDS + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +All of the following are valid declarations for Strings. +[source,arduino] +---- +String stringOne = "Hello String"; // using a constant String +String stringOne = String('a'); // converting a constant char into a String +String stringTwo = String("This is a string"); // converting a constant string into a String object +String stringOne = String(stringTwo + " with more"); // concatenating two strings +String stringOne = String(13); // using a constant integer +String stringOne = String(analogRead(0), DEC); // using an int and a base +String stringOne = String(45, HEX); // using an int and a base (hexadecimal) +String stringOne = String(255, BIN); // using an int and a base (binary) +String stringOne = String(millis(), DEC); // using a long and a base +String stringOne = String(5.698, 3); // using a float and the decimal places +---- + +-- +// HOW TO USE SECTION ENDS + + +[float] +=== Functions + +[role="language"] +* #LANGUAGE# link:../string/functions/charat[charAt()] +* #LANGUAGE# link:../string/functions/compareto[compareTo()] +* #LANGUAGE# link:../string/functions/concat[concat()] +* #LANGUAGE# link:../string/functions/c_str[c_str()] +* #LANGUAGE# link:../string/functions/endswith[endsWith()] +* #LANGUAGE# link:../string/functions/equals[equals()] +* #LANGUAGE# link:../string/functions/equalsignorecase[equalsIgnoreCase()] +* #LANGUAGE# link:../string/functions/getbytes[getBytes()] +* #LANGUAGE# link:../string/functions/indexof[indexOf()] +* #LANGUAGE# link:../string/functions/lastindexof[lastIndexOf()] +* #LANGUAGE# link:../string/functions/length[length()] +* #LANGUAGE# link:../string/functions/remove[remove()] +* #LANGUAGE# link:../string/functions/replace[replace()] +* #LANGUAGE# link:../string/functions/reserve[reserve()] +* #LANGUAGE# link:../string/functions/setcharat[setCharAt()] +* #LANGUAGE# link:../string/functions/startswith[startsWith()] +* #LANGUAGE# link:../string/functions/substring[substring()] +* #LANGUAGE# link:../string/functions/tochararray[toCharArray()] +* #LANGUAGE# link:../string/functions/todouble[toDouble()] +* #LANGUAGE# link:../string/functions/toint[toInt()] +* #LANGUAGE# link:../string/functions/tofloat[toFloat()] +* #LANGUAGE# link:../string/functions/tolowercase[toLowerCase()] +* #LANGUAGE# link:../string/functions/touppercase[toUpperCase()] +* #LANGUAGE# link:../string/functions/trim[trim()] + +[float] +=== Operators + +[role="language"] +* #LANGUAGE# link:../string/operators/elementaccess[[\] (element access)] +* #LANGUAGE# link:../string/operators/concatenation[+ (concatenation)] +* #LANGUAGE# link:../string/operators/append[+= (append)] +* #LANGUAGE# link:../string/operators/comparison[== (comparison)] +* #LANGUAGE# link:../string/operators/greaterthan[> (greater than)] +* #LANGUAGE# link:../string/operators/greaterthanorequalto[>= (greater than or equal to)] +* #LANGUAGE# link:../string/operators/lessthan[< (less than)] +* #LANGUAGE# link:../string/operators/lessthanorequalto[\<= (less than or equal to)] +* #LANGUAGE# link:../string/operators/differentfrom[!= (different from)] + +[role="example"] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[String Tutorials^] + + +// SEE ALSO SECTION STARTS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS From 1c16b687480954050cc5944c6248436fe333d6ec Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 28 May 2019 14:09:40 -0700 Subject: [PATCH 025/298] Add missing "See also" section to stream reference page When the "See also" section is missing, the automatically generated links to the other pages within the same subsection are added to a section titled "undefined". --- Language/Functions/Communication/stream.adoc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Language/Functions/Communication/stream.adoc b/Language/Functions/Communication/stream.adoc index f58aa56f0..8950da800 100644 --- a/Language/Functions/Communication/stream.adoc +++ b/Language/Functions/Communication/stream.adoc @@ -58,3 +58,14 @@ link:../stream/streamsettimeout[setTimeout()] -- // FUNCTIONS SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +-- +// SEE ALSO SECTION ENDS From c471d9f8ce1a758ba9342eedb4fd5cd8aeac9b65 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 2 Jun 2019 06:00:01 +0530 Subject: [PATCH 026/298] Document PWM pins and frequency for all boards Previously, the reference page only contained documentation of PWM pins and the PWM frequency of those pins for a few boards. This commit adds documentation for all official Arduino boards. The previous paragraph format did not scale well with the added information (which will continue to increase as Arduino creates new boards) so it was reformatted as a table. Fixes https://github.com/arduino/reference-en/issues/587 --- Language/Functions/Analog IO/analogWrite.adoc | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 39d2b6e11..404ca895a 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -17,10 +17,25 @@ subCategories: [ "Analog I/O" ] [float] === Description -Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady square wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz. +Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady square wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. +[options="header"] +|==================================================================================================== +| Board | PWM Pins | PWM Frequency +| Uno, Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) +| Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) +| Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) +| Uno WiFi Rev.2 | 3, 5, 6, 9, 10 | 976 Hz +| MKR boards * | 0 - 8, 10, A3 (18), A4 (19) | 732 Hz +| MKR1000 WiFi * | 0 - 8, 10, 11, A3 (18), A4 (19) | 732 Hz +| Zero * | 3 - 13, A0 (14), A1 (15) | 732 Hz +| Due ** | 2-13 | 1000 Hz +| 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz +|==================================================================================================== +{empty}* In addition to PWM capabilities on the pins noted above, the MKR and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + +{empty}** In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. + [%hardbreaks] -On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support `analogWrite()` on pins 9, 10, and 11. -The Arduino DUE supports `analogWrite()` on pins 2 through 13, plus pins DAC0 and DAC1. Unlike the PWM pins, DAC0 and DAC1 are Digital to Analog converters, and act as true analog outputs. + You do not need to call `pinMode()` to set the pin as an output before calling `analogWrite()`. The `analogWrite` function has nothing to do with the analog pins or the `analogRead` function. [%hardbreaks] From fa12a4db4a839b1f130cd910937700cf7d5f67dd Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 3 Jun 2019 15:44:47 +0530 Subject: [PATCH 027/298] Update keyboardModifiers.adoc (#611) Fixed the issue #610 Updated the documentation for F13-F24 Fixed misleading definition in line 25 --- .../USB/Keyboard/keyboardModifiers.adoc | 84 +++++++++++-------- 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 8a7e13605..6ff0b9c75 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -22,48 +22,60 @@ For more on ASCII values and the characters or functions they represent, see htt [%hardbreaks] For multiple key presses use link:../keyboardpress[Keyboard.press]() [%hardbreaks] -The Leonardo's definitions for modifier keys are listed below: +The definitions of the modifier keys are listed below: [%hardbreaks] |=== |Key |Hexadecimal value |Decimal value -|KEY_LEFT_CTRL |0x80 |128 -|KEY_LEFT_SHIFT |0x81 |129 -|KEY_LEFT_ALT |0x82 |130 -|KEY_LEFT_GUI |0x83 |131 -|KEY_RIGHT_CTRL |0x84 |132 -|KEY_RIGHT_SHIFT |0x85 |133 -|KEY_RIGHT_ALT |0x86 |134 -|KEY_RIGHT_GUI |0x87 |135 -|KEY_UP_ARROW |0xDA |218 -|KEY_DOWN_ARROW |0xD9 |217 -|KEY_LEFT_ARROW |0xD8 |216 -|KEY_RIGHT_ARROW |0xD7 |215 -|KEY_BACKSPACE |0xB2 |178 -|KEY_TAB |0xB3 |179 -|KEY_RETURN |0xB0 |176 -|KEY_ESC |0xB1 |177 -|KEY_INSERT |0xD1 |209 -|KEY_DELETE |0xD4 |212 -|KEY_PAGE_UP |0xD3 |211 -|KEY_PAGE_DOWN |0xD6 |214 -|KEY_HOME |0xD2 |210 -|KEY_END |0xD5 |213 -|KEY_CAPS_LOCK |0xC1 |193 -|KEY_F1 |0xC2 |194 -|KEY_F2 |0xC3 |195 -|KEY_F3 |0xC4 |196 -|KEY_F4 |0xC5 |197 -|KEY_F5 |0xC6 |198 -|KEY_F6 |0xC7 |199 -|KEY_F7 |0xC8 |200 -|KEY_F8 |0xC9 |201 -|KEY_F9 |0xCA |202 -|KEY_F10 |0xCB |203 -|KEY_F11 |0xCC |204 -|KEY_F12 |0xCD |205 +|KEY_LEFT_CTRL |0x80 |128 +|KEY_LEFT_SHIFT |0x81 |129 +|KEY_LEFT_ALT |0x82 |130 +|KEY_LEFT_GUI |0x83 |131 +|KEY_RIGHT_CTRL |0x84 |132 +|KEY_RIGHT_SHIFT |0x85 |133 +|KEY_RIGHT_ALT |0x86 |134 +|KEY_RIGHT_GUI |0x87 |135 +|KEY_UP_ARROW |0xDA |218 +|KEY_DOWN_ARROW |0xD9 |217 +|KEY_LEFT_ARROW |0xD8 |216 +|KEY_RIGHT_ARROW |0xD7 |215 +|KEY_BACKSPACE |0xB2 |178 +|KEY_TAB |0xB3 |179 +|KEY_RETURN |0xB0 |176 +|KEY_ESC |0xB1 |177 +|KEY_INSERT |0xD1 |209 +|KEY_DELETE |0xD4 |212 +|KEY_PAGE_UP |0xD3 |211 +|KEY_PAGE_DOWN |0xD6 |214 +|KEY_HOME |0xD2 |210 +|KEY_END |0xD5 |213 +|KEY_CAPS_LOCK |0xC1 |193 +|KEY_F1 |0xC2 |194 +|KEY_F2 |0xC3 |195 +|KEY_F3 |0xC4 |196 +|KEY_F4 |0xC5 |197 +|KEY_F5 |0xC6 |198 +|KEY_F6 |0xC7 |199 +|KEY_F7 |0xC8 |200 +|KEY_F8 |0xC9 |201 +|KEY_F9 |0xCA |202 +|KEY_F10 |0xCB |203 +|KEY_F11 |0xCC |204 +|KEY_F12 |0xCD |205 +|KEY_F13 |0xF0 |240 +|KEY_F14 |0xF1 |241 +|KEY_F15 |0xF2 |242 +|KEY_F16 |0xF3 |243 +|KEY_F17 |0xF4 |244 +|KEY_F18 |0xF5 |245 +|KEY_F19 |0xF6 |246 +|KEY_F20 |0xF7 |247 +|KEY_F21 |0xF8 |248 +|KEY_F22 |0xF9 |249 +|KEY_F23 |0xFA |250 +|KEY_F24 |0xFB |251 |=== -- From 32250520bb6595fd1212821236606f2b9258c163 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 4 Jun 2019 06:49:01 +0530 Subject: [PATCH 028/298] Update volatile.adoc (#614) #613 Fixed --- Language/Variables/Variable Scope & Qualifiers/volatile.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc index 6032d171d..20fbd6fbd 100644 --- a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc @@ -17,7 +17,7 @@ subCategories: [ "Variable Scope & Qualifiers" ] [float] === Description -`volatile` is a keyword known as a variable _qualifier_, it is usually used before the datatype of a variable, to modify the way in which the compiler and subsequent program treats the variable. +`volatile` is a keyword known as a variable _qualifier_, it is usually used before the datatype of a variable, to modify the way in which the compiler and subsequent program treat the variable. Declaring a variable `volatile` is a directive to the compiler. The compiler is software which translates your C/C++ code into the machine code, which are the real instructions for the Atmega chip in the Arduino. From 726a250961f56c0b7ffc7669fa51f23375dac65a Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 5 Jun 2019 18:08:05 +0530 Subject: [PATCH 029/298] Fix typos in PROGMEM reference page --- Language/Variables/Utilities/PROGMEM.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index 4cbeb6db7..c27e27ed7 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -21,7 +21,7 @@ Store data in flash (program) memory instead of SRAM. There's a description of t The `PROGMEM` keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "put this information into flash memory", instead of into SRAM, where it would normally go. -PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE, however if you are using an IDE version below 1.0 (2011), you'll first need to include the library at the top your sketch, like this: +PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE. However, if you are using an IDE version below 1.0 (2011), you'll first need to include the library at the top your sketch, like this: `#include ` While `PROGMEM` could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array, (or another C++ data structure beyond our present discussion). @@ -34,7 +34,7 @@ Using `PROGMEM` is also a two-step procedure. After getting the data into Flash === Syntax `const dataType variableName[] PROGMEM = {data0, data1, data3...};` -Note that because PROGMEM is a variable modifier, there is no hard and fast rule about where it should go, so the Arduino compiler accepts all of the definitions below, which are also synonymous. However experiments have indicated that, in various versions of Arduino (having to do with GCC version), PROGMEM may work in one location and not in another. The "string table" example below has been tested to work with Arduino 13. Earlier versions of the IDE may work better if PROGMEM is included after the variable name. +Note that because PROGMEM is a variable modifier, there is no hard and fast rule about where it should go, so the Arduino compiler accepts all of the definitions below, which are also synonymous. However, experiments have indicated that, in various versions of Arduino (having to do with GCC version), PROGMEM may work in one location and not in another. The "string table" example below has been tested to work with Arduino 13. Earlier versions of the IDE may work better if PROGMEM is included after the variable name. `const dataType variableName[] PROGMEM = {}; // use this form` + `const PROGMEM dataType variableName[] = {}; // or this one` + @@ -118,7 +118,7 @@ These tend to be large structures so putting them into program memory is often d Setting up a table (array) of strings in program memory is slightly complicated, but here is a good template to follow. - Setting up the strings is a two-step process. First define the strings. + Setting up the strings is a two-step process. First, define the strings. */ #include From 0f2b1ab5f87af6c1847b5297bc3ae5ad0e7fd5ab Mon Sep 17 00:00:00 2001 From: HansM Date: Sat, 8 Jun 2019 21:08:15 +0200 Subject: [PATCH 030/298] Fix code style in else.adoc. Fixes https://github.com/arduino/reference-en/issues/618. --- Language/Structure/Control Structure/else.adoc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index c50e33e1e..64ce1afe3 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -49,17 +49,14 @@ else { Below is an extract from a code for temperature sensor system [source,arduino] ---- -if (temperature >= 70) -{ - // Danger! Shut down the system +if (temperature >= 70) { + // Danger! Shut down the system. } -else if (temperature >= 60) // 60 <= temperature < 70 -{ - // Warning! User attention required +else if (temperature >= 60) { // 60 <= temperature < 70 + // Warning! User attention required. } -else // temperature < 60 -{ - // Safe! Continue usual tasks... +else { // temperature < 60 + // Safe! Continue usual tasks. } ---- From 2e4da4539ee3a0d95e1032d931176752cd11519a Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 10 Jun 2019 01:05:01 +0530 Subject: [PATCH 031/298] Document truncation when converting from float/double to an integer type Fixes #579 --- Language/Variables/Data Types/float.adoc | 37 ++++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/Language/Variables/Data Types/float.adoc b/Language/Variables/Data Types/float.adoc index dbd235568..fcf41be45 100644 --- a/Language/Variables/Data Types/float.adoc +++ b/Language/Variables/Data Types/float.adoc @@ -19,13 +19,7 @@ subCategories: [ "Data Types" ] === Description Datatype for floating-point numbers, a number that has a decimal point. Floating-point numbers are often used to approximate analog and continuous values because they have greater resolution than integers. Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information. -Floats have only 6-7 decimal digits of precision. That means the total number of digits, not the number to the right of the decimal point. Unlike other platforms, where you can get more precision by using a double (e.g. up to 15 digits), on the Arduino, double is the same size as float. -Floating point numbers are not exact, and may yield strange results when compared. For example 6.0 / 3.0 may not equal 2.0. You should instead check that the absolute value of the difference between the numbers is less than some small number. - -Floating point math is also much slower than integer math in performing calculations, so should be avoided if, for example, a loop has to run at top speed for a critical timing function. Programmers often go to some lengths to convert floating point calculations to integer math to increase speed. - -If doing math with floats, you need to add a decimal point, otherwise it will be treated as an int. See the link:../../constants/floatingpointconstants[Floating point] constants page for details. [%hardbreaks] [float] @@ -75,6 +69,37 @@ z = (float)x / 2.0; // z now contains .5 (you have to use 2.0, not 2) [#see_also] -- +[float] +=== Notes and Warnings +If doing math with floats, you need to add a decimal point, otherwise it will be treated as an int. See the link:../../constants/floatingpointconstants[Floating point] constants page for details. + +The float data type has only 6-7 decimal digits of precision. That means the total number of digits, not the number to the right of the decimal point. Unlike other platforms, where you can get more precision by using a double (e.g. up to 15 digits), on the Arduino, double is the same size as float. + +Floating point numbers are not exact, and may yield strange results when compared. For example 6.0 / 3.0 may not equal 2.0. You should instead check that the absolute value of the difference between the numbers is less than some small number. + +Conversion from floating point to integer math results in truncation: +[source,arduino] +---- +float x = 2.9; // A float type variable +int y = x; // 2 +---- + +If, instead, you want to round off during the conversion process, you need to add `0.5`: +[source,arduino] +---- +float x = 2.9; +int y = x + 0.5; // 3 +---- +or use the `round()` function: +[source,arduino] +---- +float x = 2.9; +int y = round(x); // 3 +---- + +Floating point math is also much slower than integer math in performing calculations, so should be avoided if, for example, a loop has to run at top speed for a critical timing function. Programmers often go to some lengths to convert floating point calculations to integer math to increase speed. + +[%hardbreaks] [float] === See also From da804418fbc453376f7d71ec7bbd3e59d6b45a2a Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 10 Jun 2019 03:44:48 -0700 Subject: [PATCH 032/298] Add ATmega32U4 documentation to analogReference() reference page - Add Leonardo to the list of example AVR boards. This covers all three current microcontrollers of the official AVR boards. I think most owners of the Micro understand that Leonardo documentation applies to it. - Document INTERNAL reference voltage on ATmega32U4. --- Language/Functions/Analog IO/analogReference.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index 82437d942..31ae3d39c 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -19,10 +19,10 @@ subCategories: [ "Analog I/O" ] === Description Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). The options are: -Arduino AVR Boards (Uno, Mega, etc.) +Arduino AVR Boards (Uno, Mega, Leonardo, etc.) * DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards) -* INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328P and 2.56 volts on the ATmega8 (not available on the Arduino Mega) +* INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328P and 2.56 volts on the ATmega32U4 and ATmega8 (not available on the Arduino Mega) * INTERNAL1V1: a built-in 1.1V reference (Arduino Mega only) * INTERNAL2V56: a built-in 2.56V reference (Arduino Mega only) * EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference. From 18c1f9a1dea66c83a58bec3edf5d3f7ba2070161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Pud=C5=82o?= <50989199+tomb0x@users.noreply.github.com> Date: Tue, 11 Jun 2019 13:56:53 +0200 Subject: [PATCH 033/298] sum -> result [Notes and Warnings 2.] --- Language/Structure/Arithmetic Operators/division.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Arithmetic Operators/division.adoc b/Language/Structure/Arithmetic Operators/division.adoc index 7fd4fea5e..12ae3b8bb 100644 --- a/Language/Structure/Arithmetic Operators/division.adoc +++ b/Language/Structure/Arithmetic Operators/division.adoc @@ -59,7 +59,7 @@ c = a / b; // the variable 'c' gets a value of 5 after this statement is execut === Notes and Warnings 1. If one of the numbers (operands) are of the type float or of type double, floating point math will be used for the calculation. -2. If the operands are of float / double data type and the variable that stores the sum is an integer, then only the integral part is stored and the fractional part of the number is lost. +2. If the operands are of float / double data type and the variable that stores the result is an integer, then only the integral part is stored and the fractional part of the number is lost. [source,arduino] ---- From 9c8bf1007fd9a39941bbfbb0f96d04d08fd8d6e0 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 22 Feb 2019 01:04:48 -0800 Subject: [PATCH 034/298] Don't use a trailing slash on reference links Following the standard established by the sample reference pages, don't put a trailing slash on links to Language Reference pages. Although either way works, it's better that all the links are consistent so that contributors don't waste time trying to figure out which style they need to use. I have left any trailing slashes on non-Language Reference links. --- Language/Functions/Advanced IO/pulseIn.adoc | 2 +- Language/Functions/Advanced IO/pulseInLong.adoc | 2 +- Language/Structure/Boolean Operators/logicalNot.adoc | 2 +- Language/Variables/Data Types/boolean.adoc | 2 +- Language/Variables/Data Types/int.adoc | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Language/Functions/Advanced IO/pulseIn.adoc b/Language/Functions/Advanced IO/pulseIn.adoc index 74e1669a0..964cb7a4f 100644 --- a/Language/Functions/Advanced IO/pulseIn.adoc +++ b/Language/Functions/Advanced IO/pulseIn.adoc @@ -32,7 +32,7 @@ The timing of this function has been determined empirically and will probably sh [float] === Parameters `pin`: the number of the Arduino pin on which you want to read the pulse. Allowed data types: `int`. + -`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. Allowed data types: `int`. + +`value`: type of pulse to read: either link:../../../variables/constants/constants[HIGH] or link:../../../variables/constants/constants[LOW]. Allowed data types: `int`. + `timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. diff --git a/Language/Functions/Advanced IO/pulseInLong.adoc b/Language/Functions/Advanced IO/pulseInLong.adoc index a9b851168..dd2bc5320 100644 --- a/Language/Functions/Advanced IO/pulseInLong.adoc +++ b/Language/Functions/Advanced IO/pulseInLong.adoc @@ -34,7 +34,7 @@ The timing of this function has been determined empirically and will probably sh [float] === Parameters `pin`: the number of the Arduino pin on which you want to read the pulse. Allowed data types: `int`. + -`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. Allowed data types: `int`. + +`value`: type of pulse to read: either link:../../../variables/constants/constants[HIGH] or link:../../../variables/constants/constants[LOW]. Allowed data types: `int`. + `timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. diff --git a/Language/Structure/Boolean Operators/logicalNot.adoc b/Language/Structure/Boolean Operators/logicalNot.adoc index 7fa92071e..47a29c012 100644 --- a/Language/Structure/Boolean Operators/logicalNot.adoc +++ b/Language/Structure/Boolean Operators/logicalNot.adoc @@ -32,7 +32,7 @@ subCategories: [ "Boolean Operators" ] [float] === Example Code -This operator can be used inside the condition of an link:../../control-structure/if/[if] statement. +This operator can be used inside the condition of an link:../../control-structure/if[if] statement. [source,arduino] ---- diff --git a/Language/Variables/Data Types/boolean.adoc b/Language/Variables/Data Types/boolean.adoc index 95c5fae9d..241799121 100644 --- a/Language/Variables/Data Types/boolean.adoc +++ b/Language/Variables/Data Types/boolean.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -`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. +`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. [%hardbreaks] diff --git a/Language/Variables/Data Types/int.adoc b/Language/Variables/Data Types/int.adoc index 871013a81..12d8d52c5 100644 --- a/Language/Variables/Data Types/int.adoc +++ b/Language/Variables/Data Types/int.adoc @@ -20,7 +20,7 @@ On the Arduino Due and SAMD based boards (like MKR1000 and Zero), an int stores int's store negative numbers with a technique called (http://en.wikipedia.org/wiki/2%27s_complement[2's complement math]). The highest bit, sometimes referred to as the "sign" bit, flags the number as a negative number. The rest of the bits are inverted and 1 is added. -The Arduino takes care of dealing with negative numbers for you, so that arithmetic operations work transparently in the expected manner. There can be an unexpected complication in dealing with the link:../../../structure/bitwise-operators/bitshiftright/[bitshift right operator] (>>) however. +The Arduino takes care of dealing with negative numbers for you, so that arithmetic operations work transparently in the expected manner. There can be an unexpected complication in dealing with the link:../../../structure/bitwise-operators/bitshiftright[bitshift right operator] (>>) however. [%hardbreaks] @@ -67,7 +67,7 @@ void loop() { [float] === Notes and Warnings -When signed variables are made to exceed their maximum or minimum capacity they _overflow_. The result of an overflow is unpredictable so this should be avoided. A typical symptom of an overflow is the variable "rolling over" from its maximum capacity to its minimum or vice versa, but this is not always the case. If you want this behavior, use link:../unsignedint/[unsigned int]. +When signed variables are made to exceed their maximum or minimum capacity they _overflow_. The result of an overflow is unpredictable so this should be avoided. A typical symptom of an overflow is the variable "rolling over" from its maximum capacity to its minimum or vice versa, but this is not always the case. If you want this behavior, use link:../unsignedint[unsigned int]. -- From c847bd14e232c17d6c4ab54e200a17a9a5413adc Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 5 Feb 2019 23:44:18 -0800 Subject: [PATCH 035/298] Document C-like type casting syntax In addition to the existing documentation of functional notation, add documentation of the C-like notation as well. This will bring some consistency with the the documentation for the casts to multi-word types (e.g., unsigned int). --- Language/Variables/Conversion/byteCast.adoc | 3 ++- Language/Variables/Conversion/charCast.adoc | 3 ++- Language/Variables/Conversion/floatCast.adoc | 3 ++- Language/Variables/Conversion/intCast.adoc | 3 ++- Language/Variables/Conversion/longCast.adoc | 3 ++- Language/Variables/Conversion/wordcast.adoc | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Language/Variables/Conversion/byteCast.adoc b/Language/Variables/Conversion/byteCast.adoc index 1b6eb6e9d..2aef0f0e1 100644 --- a/Language/Variables/Conversion/byteCast.adoc +++ b/Language/Variables/Conversion/byteCast.adoc @@ -23,7 +23,8 @@ Converts a value to the link:../../data-types/byte[byte] data type. [float] === Syntax -`byte(x)` +`byte(x)` + +`(byte)x` (C-style type conversion) [float] diff --git a/Language/Variables/Conversion/charCast.adoc b/Language/Variables/Conversion/charCast.adoc index 6c2d8e791..9c39619ca 100644 --- a/Language/Variables/Conversion/charCast.adoc +++ b/Language/Variables/Conversion/charCast.adoc @@ -23,7 +23,8 @@ Converts a value to the link:../../data-types/char[char] data type. [float] === Syntax -`char(x)` +`char(x)` + +`(char)x` (C-style type conversion) [float] diff --git a/Language/Variables/Conversion/floatCast.adoc b/Language/Variables/Conversion/floatCast.adoc index 9b0da90cb..d813d2f43 100644 --- a/Language/Variables/Conversion/floatCast.adoc +++ b/Language/Variables/Conversion/floatCast.adoc @@ -23,7 +23,8 @@ Converts a value to the link:../../data-types/float[float] data type. [float] === Syntax -`float(x)` +`float(x)` + +`(float)x` (C-style type conversion) [float] diff --git a/Language/Variables/Conversion/intCast.adoc b/Language/Variables/Conversion/intCast.adoc index a087cb6a2..c9d5d29d4 100644 --- a/Language/Variables/Conversion/intCast.adoc +++ b/Language/Variables/Conversion/intCast.adoc @@ -23,7 +23,8 @@ Converts a value to the link:../../data-types/int[int] data type. [float] === Syntax -`int(x)` +`int(x)` + +`(int)x` (C-style type conversion) [float] diff --git a/Language/Variables/Conversion/longCast.adoc b/Language/Variables/Conversion/longCast.adoc index 05749fd89..3751aaef9 100644 --- a/Language/Variables/Conversion/longCast.adoc +++ b/Language/Variables/Conversion/longCast.adoc @@ -23,7 +23,8 @@ Converts a value to the link:../../data-types/long[long] data type. [float] === Syntax -`long(x)` +`long(x)` + +`(long)x` (C-style type conversion) [float] diff --git a/Language/Variables/Conversion/wordcast.adoc b/Language/Variables/Conversion/wordcast.adoc index 19cff9667..14ab38f94 100644 --- a/Language/Variables/Conversion/wordcast.adoc +++ b/Language/Variables/Conversion/wordcast.adoc @@ -24,7 +24,8 @@ Converts a value to the link:../../data-types/word[word] data type. [float] === Syntax `word(x)` + -`word(h, l)` +`word(h, l)` + +`(word)x` (C-style type conversion) [float] === Parameters From 584ff5eb24056c55e41328ee4f5eff3358f8f7b1 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 5 Feb 2019 23:54:27 -0800 Subject: [PATCH 036/298] Add unsigned int/long type casting pages I'm not certain whether casting pages for all the types in the reference should be added, but certainly it must be demonstrated that casting can be done to the multi-word types as well. unsigned int/unsigned long are important types, so at a minimum these must be added. Likely it would have been best to write a single generic page on type casting but we took the other fork in the road too long ago to turn back now. --- .../Variables/Conversion/unsignedIntCast.adoc | 55 +++++++++++++++++++ .../Conversion/unsignedLongCast.adoc | 55 +++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 Language/Variables/Conversion/unsignedIntCast.adoc create mode 100644 Language/Variables/Conversion/unsignedLongCast.adoc diff --git a/Language/Variables/Conversion/unsignedIntCast.adoc b/Language/Variables/Conversion/unsignedIntCast.adoc new file mode 100644 index 000000000..863d2724e --- /dev/null +++ b/Language/Variables/Conversion/unsignedIntCast.adoc @@ -0,0 +1,55 @@ +--- +title: (unsigned int) +categories: [ "Variables" ] +subCategories: [ "Conversion" ] +--- + + + + + += (unsigned int) + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Converts a value to the link:../../data-types/unsignedint[unsigned int] data type. +[%hardbreaks] + + +[float] +=== Syntax +`(unsigned int)x` + + +[float] +=== Parameters +`x`: a value of any type + +[float] +=== Returns +`unsigned int` + +-- +// OVERVIEW SECTION ENDS + + + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../data-types/unsignedint[unsigned int] + + +-- +// SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Conversion/unsignedLongCast.adoc b/Language/Variables/Conversion/unsignedLongCast.adoc new file mode 100644 index 000000000..c950d2b7c --- /dev/null +++ b/Language/Variables/Conversion/unsignedLongCast.adoc @@ -0,0 +1,55 @@ +--- +title: (unsigned long) +categories: [ "Variables" ] +subCategories: [ "Conversion" ] +--- + + + + + += (unsigned long) + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Converts a value to the link:../../data-types/unsignedlong[unsigned long] data type. +[%hardbreaks] + + +[float] +=== Syntax +`(unsigned long)x` + + +[float] +=== Parameters +`x`: a value of any type + +[float] +=== Returns +`unsigned long` + +-- +// OVERVIEW SECTION ENDS + + + + +// SEE ALSO SECTION STARTS +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../data-types/unsignedlong[unsigned long] + + +-- +// SEE ALSO SECTION ENDS \ No newline at end of file From 71917426b4c59ee2a2c3ac1a1900ac69ee35e907 Mon Sep 17 00:00:00 2001 From: HansM Date: Sun, 16 Jun 2019 15:50:47 +0200 Subject: [PATCH 037/298] Fixed float reference page. Fixes https://github.com/arduino/reference-en/issues/624. --- Language/Variables/Data Types/float.adoc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Language/Variables/Data Types/float.adoc b/Language/Variables/Data Types/float.adoc index fcf41be45..8882397ed 100644 --- a/Language/Variables/Data Types/float.adoc +++ b/Language/Variables/Data Types/float.adoc @@ -59,15 +59,7 @@ x = 1; y = x / 2; // y now contains 0, ints can't hold fractions z = (float)x / 2.0; // z now contains .5 (you have to use 2.0, not 2) ---- - - --- -// HOW TO USE SECTION ENDS - - -// SEE ALSO SECTION STARTS -[#see_also] --- +[%hardbreaks] [float] === Notes and Warnings @@ -99,6 +91,16 @@ int y = round(x); // 3 Floating point math is also much slower than integer math in performing calculations, so should be avoided if, for example, a loop has to run at top speed for a critical timing function. Programmers often go to some lengths to convert floating point calculations to integer math to increase speed. +-- +// HOW TO USE SECTION ENDS + + + + +// SEE ALSO SECTION STARTS +[#see_also] +-- + [%hardbreaks] [float] === See also From 68f451478ff78aa22ff0f83a729a5269d3879a18 Mon Sep 17 00:00:00 2001 From: Jed Mijares <36108020+jedmijares@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:00:30 -0400 Subject: [PATCH 038/298] Fixes typo in string.adoc "in actually" should be "in actuality" or "actually". --- Language/Variables/Data Types/string.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/string.adoc b/Language/Variables/Data Types/string.adoc index df629b4f6..9273f9c9e 100644 --- a/Language/Variables/Data Types/string.adoc +++ b/Language/Variables/Data Types/string.adoc @@ -60,7 +60,7 @@ char myString[] = "This is the first line" *Arrays of strings* -It is often convenient, when working with large amounts of text, such as a project with an LCD display, to setup an array of strings. Because strings themselves are arrays, this is in actually an example of a two-dimensional array. +It is often convenient, when working with large amounts of text, such as a project with an LCD display, to setup an array of strings. Because strings themselves are arrays, this is actually an example of a two-dimensional array. In the code below, the asterisk after the datatype `char` "`char*`" indicates that this is an array of "`pointers`". All array names are actually pointers, so this is required to make an array of arrays. Pointers are one of the more esoteric parts of C++ for beginners to understand, but it isn't necessary to understand pointers in detail to use them effectively here. From efbcd410c441fad438f2809507e79a4e9b21f865 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 19 Jun 2019 19:55:13 +0530 Subject: [PATCH 039/298] Typo Fixed Line 72 1. Comma removed. 2. noun phrase timing require a determiner Line 74 1. addition of the comma. --- Language/Functions/Time/delay.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Time/delay.adoc b/Language/Functions/Time/delay.adoc index a7dce4953..a20a3d942 100644 --- a/Language/Functions/Time/delay.adoc +++ b/Language/Functions/Time/delay.adoc @@ -69,9 +69,9 @@ void loop() { [float] === Notes and Warnings -While it is easy to create a blinking LED with the `delay()` function, and many sketches use short delays for such tasks as switch debouncing, the use of `delay()` in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the link:http://arduino.cc/en/Tutorial/BlinkWithoutDelay[Blink Without Delay] sketch, which loops, polling the link:../millis[millis()] function until enough time has elapsed. More knowledgeable programmers usually avoid the use of `delay()` for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple. +While it is easy to create a blinking LED with the `delay()` function and many sketches use short delays for such tasks as switch debouncing, the use of `delay()` in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the link:http://arduino.cc/en/Tutorial/BlinkWithoutDelay[Blink Without Delay] sketch, which loops, polling the link:../millis[millis()] function until enough time has elapsed. More knowledgeable programmers usually avoid the use of `delay()` for the timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple. -Certain things do go on while the delay() function is controlling the Atmega chip however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (link:../../analog-io/analogwrite[analogWrite]) values and pin states are maintained, and link:../../external-interrupts/attachinterrupt[interrupts] will work as they should. +Certain things do go on while the delay() function is controlling the Atmega chip, however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (link:../../analog-io/analogwrite[analogWrite]) values and pin states are maintained, and link:../../external-interrupts/attachinterrupt[interrupts] will work as they should. -- // HOW TO USE SECTION ENDS From 7ad67f1f57e7b78cabc5daf86d0bcd6243bf9c0f Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 19 Jun 2019 19:58:58 +0530 Subject: [PATCH 040/298] Typo Fixed Line 20 1. parameter requires an article before it. 2. unnecessary comma in a compound object. --- Language/Functions/Time/delayMicroseconds.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/delayMicroseconds.adoc b/Language/Functions/Time/delayMicroseconds.adoc index e86d37f2c..708245c44 100644 --- a/Language/Functions/Time/delayMicroseconds.adoc +++ b/Language/Functions/Time/delayMicroseconds.adoc @@ -17,7 +17,7 @@ subCategories: [ "Time" ] [float] === Description -Pauses the program for the amount of time (in microseconds) specified as parameter. There are a thousand microseconds in a millisecond, and a million microseconds in a second. +Pauses the program for the amount of time (in microseconds) specified as the parameter. There are a thousand microseconds in a millisecond and a million microseconds in a second. Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use `delay()` instead. [%hardbreaks] From 418bc96e9fa7e9e2e497e0e7a7bec41c058b6a22 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 21 Jun 2019 14:47:16 +0530 Subject: [PATCH 041/298] Update Language/Functions/Time/delay.adoc Co-Authored-By: per1234 --- Language/Functions/Time/delay.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/delay.adoc b/Language/Functions/Time/delay.adoc index a20a3d942..b47fc9ec3 100644 --- a/Language/Functions/Time/delay.adoc +++ b/Language/Functions/Time/delay.adoc @@ -69,7 +69,7 @@ void loop() { [float] === Notes and Warnings -While it is easy to create a blinking LED with the `delay()` function and many sketches use short delays for such tasks as switch debouncing, the use of `delay()` in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the link:http://arduino.cc/en/Tutorial/BlinkWithoutDelay[Blink Without Delay] sketch, which loops, polling the link:../millis[millis()] function until enough time has elapsed. More knowledgeable programmers usually avoid the use of `delay()` for the timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple. +While it is easy to create a blinking LED with the `delay()` function and many sketches use short delays for such tasks as switch debouncing, the use of `delay()` in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the link:http://arduino.cc/en/Tutorial/BlinkWithoutDelay[Blink Without Delay] sketch, which loops, polling the link:../millis[millis()] function until enough time has elapsed. More knowledgeable programmers usually avoid the use of `delay()` for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple. Certain things do go on while the delay() function is controlling the Atmega chip, however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (link:../../analog-io/analogwrite[analogWrite]) values and pin states are maintained, and link:../../external-interrupts/attachinterrupt[interrupts] will work as they should. From 8aa21e27ee1c40fe0bb8dfcc074f0c2d9e48c961 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 21 Jun 2019 14:49:09 +0530 Subject: [PATCH 042/298] Update Language/Functions/Time/delayMicroseconds.adoc Co-Authored-By: per1234 --- Language/Functions/Time/delayMicroseconds.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/delayMicroseconds.adoc b/Language/Functions/Time/delayMicroseconds.adoc index 708245c44..0fbf57d84 100644 --- a/Language/Functions/Time/delayMicroseconds.adoc +++ b/Language/Functions/Time/delayMicroseconds.adoc @@ -17,7 +17,7 @@ subCategories: [ "Time" ] [float] === Description -Pauses the program for the amount of time (in microseconds) specified as the parameter. There are a thousand microseconds in a millisecond and a million microseconds in a second. +Pauses the program for the amount of time (in microseconds) specified by the parameter. There are a thousand microseconds in a millisecond and a million microseconds in a second. Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use `delay()` instead. [%hardbreaks] From c07a147f049a220853b612763cee476a3194063d Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 24 Jun 2019 15:23:59 +0530 Subject: [PATCH 043/298] Typos fixed in attachInterrupt.adoc (#633) Line 44: Unnecessary comma in a compound predicate. Line 46: insure to ensure (Requires suggestion). Addition of comma. Line 50: Addition of comma. Line 52: Unnecessary comma in a compound predicate. Line 73: Addition of the Line 77: the singular verb "allows" doesn't agree with the plural subject "boards" Line 121: Unnecessary comma in a compound predicate. on to for is run to runs --- .../Functions/External Interrupts/attachInterrupt.adoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 0f5c21cf2..2800a7208 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -41,15 +41,15 @@ Inside the attached function, `delay()` won't work and the value returned by `mi [float] == Using Interrupts -Interrupts are useful for making things happen automatically in microcontroller programs, and can help solve timing problems. Good tasks for using an interrupt may include reading a rotary encoder, or monitoring user input. +Interrupts are useful for making things happen automatically in microcontroller programs and can help solve timing problems. Good tasks for using an interrupt may include reading a rotary encoder, or monitoring user input. -If you wanted to insure that a program always caught the pulses from a rotary encoder, so that it never misses a pulse, it would make it very tricky to write a program to do anything else, because the program would need to constantly poll the sensor lines for the encoder, in order to catch pulses when they occurred. Other sensors have a similar interface dynamic too, such as trying to read a sound sensor that is trying to catch a click, or an infrared slot sensor (photo-interrupter) trying to catch a coin drop. In all of these situations, using an interrupt can free the microcontroller to get some other work done while not missing the input. +If you wanted to ensure that a program always caught the pulses from a rotary encoder, so that it never misses a pulse, it would make it very tricky to write a program to do anything else, because the program would need to constantly poll the sensor lines for the encoder, in order to catch pulses when they occurred. Other sensors have a similar interface dynamic too, such as trying to read a sound sensor that is trying to catch a click, or an infrared slot sensor (photo-interrupter) trying to catch a coin drop. In all of these situations, using an interrupt can free the microcontroller to get some other work done while not missing the input. [float] == About Interrupt Service Routines ISRs are special kinds of functions that have some unique limitations most other functions do not have. An ISR cannot have any parameters, and they shouldn't return anything. -Generally, an ISR should be as short and fast as possible. If your sketch uses multiple ISRs, only one can run at a time, other interrupts will be executed after the current one finishes in an order that depends on the priority they have. `millis()` relies on interrupts to count, so it will never increment inside an ISR. Since `delay()` requires interrupts to work, it will not work if called inside an ISR. `micros()` works initially, but will start behaving erratically after 1-2 ms. `delayMicroseconds()` does not use any counter, so it will work as normal. +Generally, an ISR should be as short and fast as possible. If your sketch uses multiple ISRs, only one can run at a time, other interrupts will be executed after the current one finishes in an order that depends on the priority they have. `millis()` relies on interrupts to count, so it will never increment inside an ISR. Since `delay()` requires interrupts to work, it will not work if called inside an ISR. `micros()` works initially but will start behaving erratically after 1-2 ms. `delayMicroseconds()` does not use any counter, so it will work as normal. Typically global variables are used to pass data between an ISR and the main program. To make sure variables shared between an ISR and the main program are updated correctly, declare them as `volatile`. @@ -74,7 +74,7 @@ For more information on interrupts, see http://gammon.com.au/interrupts[Nick Gam * *RISING* to trigger when the pin goes from low to high, + * *FALLING* for when the pin goes from high to low. + -The Due, Zero and MKR1000 boards allows also: + +The Due, Zero and MKR1000 boards allow also: + * *HIGH* to trigger the interrupt whenever the pin is high. @@ -118,7 +118,7 @@ void blink() { [float] === Interrupt Numbers -Normally you should use `digitalPinToInterrupt(pin)`, rather than place an interrupt number directly into your sketch. The specific pins with interrupts, and their mapping to interrupt number varies on each type of board. Direct use of interrupt numbers may seem simple, but it can cause compatibility trouble when your sketch is run on a different board. +Normally you should use `digitalPinToInterrupt(pin)`, rather than place an interrupt number directly into your sketch. The specific pins with interrupts and their mapping to interrupt number varies for each type of board. Direct use of interrupt numbers may seem simple, but it can cause compatibility trouble when your sketch runs on a different board. However, older sketches often have direct interrupt numbers. Often number 0 (for digital pin 2) or number 1 (for digital pin 3) were used. The table below shows the available interrupt pins on various boards. From 9aa1649628db83998609cb185e598600e04f02a0 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 25 Jun 2019 00:13:17 +0530 Subject: [PATCH 044/298] Update dereference.adoc Removed "and" Line 49 --- Language/Structure/Pointer Access Operators/dereference.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Pointer Access Operators/dereference.adoc b/Language/Structure/Pointer Access Operators/dereference.adoc index 6785e5c9d..b59831358 100644 --- a/Language/Structure/Pointer Access Operators/dereference.adoc +++ b/Language/Structure/Pointer Access Operators/dereference.adoc @@ -46,7 +46,7 @@ result = *p; // 'result' gets the value at the address pointed by 'p' [float] === Notes and Warnings -Pointers are one of the complicated subjects for beginners in learning C, and it is possible to write the vast majority of Arduino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and and knowledge of manipulating pointers is handy to have in one's toolkit. +Pointers are one of the complicated subjects for beginners in learning C, and it is possible to write the vast majority of Arduino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and knowledge of manipulating pointers is handy to have in one's toolkit. [%hardbreaks] -- From e58cbedec1e15dc0c075add7e848e2ae95c9534b Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 25 Jun 2019 11:52:39 +0530 Subject: [PATCH 045/298] Addition of Missing "Digital Pins" link. (#634) --- Language/Functions/Digital IO/digitalWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Digital IO/digitalWrite.adoc b/Language/Functions/Digital IO/digitalWrite.adoc index 35f5f075c..d2bc38aad 100644 --- a/Language/Functions/Digital IO/digitalWrite.adoc +++ b/Language/Functions/Digital IO/digitalWrite.adoc @@ -22,7 +22,7 @@ Write a `HIGH` or a `LOW` value to a digital pin. If the pin has been configured as an `OUTPUT` with `pinMode()`, its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for `HIGH`, 0V (ground) for `LOW`. [%hardbreaks] -If the pin is configured as an `INPUT`, `digitalWrite()` will enable (`HIGH`) or disable (`LOW`) the internal pullup on the input pin. It is recommended to set the `pinMode()` to `INPUT_PULLUP` to enable the internal pull-up resistor. See the digital pins tutorial for more information. +If the pin is configured as an `INPUT`, `digitalWrite()` will enable (`HIGH`) or disable (`LOW`) the internal pullup on the input pin. It is recommended to set the `pinMode()` to `INPUT_PULLUP` to enable the internal pull-up resistor. See the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins^] tutorial for more information. [%hardbreaks] If you do not set the `pinMode()` to `OUTPUT`, and connect an LED to a pin, when calling `digitalWrite(HIGH)`, the LED may appear dim. Without explicitly setting `pinMode()`, `digitalWrite()` will have enabled the internal pull-up resistor, which acts like a large current-limiting resistor. From 10fd6dec19d1420f7662e920c600bc2460b3e3ed Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 25 Jun 2019 21:45:19 +0530 Subject: [PATCH 046/298] Update blockComment.adoc Typo fixed Line 24: encounters removal of "a" --- Language/Structure/Further Syntax/blockComment.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Further Syntax/blockComment.adoc b/Language/Structure/Further Syntax/blockComment.adoc index d8c200c9a..62c0a8f40 100644 --- a/Language/Structure/Further Syntax/blockComment.adoc +++ b/Language/Structure/Further Syntax/blockComment.adoc @@ -21,7 +21,7 @@ subCategories: [ "Further Syntax" ] *Comments* are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don't take up any space in the microcontroller's flash memory. Comments' only purpose is to help you understand (or remember), or to inform others about how your program works. [%hardbreaks] -The beginning of a *block comment* or a *multi-line comment* is marked by the symbol `/\*` and the symbol `*/` marks its end. This type of a comment is called so as this can extend over more than one line; once the compiler reads the `/\*` it ignores whatever follows until it enounters a `*/`. +The beginning of a *block comment* or a *multi-line comment* is marked by the symbol `/\*` and the symbol `*/` marks its end. This type of comment is called so as this can extend over more than one line; once the compiler reads the `/\*` it ignores whatever follows until it encounters a `*/`. // NOTE TO THE EDITOR: The '\' before the '*' in certain places are to escape the '*' from making the text bolder. // In places were '\' is not used before '*', it is not actually required. From 782e33220c6922649908fa8a58ea662e3199debf Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 25 Jun 2019 21:48:20 +0530 Subject: [PATCH 047/298] Update curlyBraces.adoc Line 23 Removal of "s" --- Language/Structure/Further Syntax/curlyBraces.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Further Syntax/curlyBraces.adoc b/Language/Structure/Further Syntax/curlyBraces.adoc index 044b813d3..9bafb7fdc 100644 --- a/Language/Structure/Further Syntax/curlyBraces.adoc +++ b/Language/Structure/Further Syntax/curlyBraces.adoc @@ -20,7 +20,7 @@ subCategories: [ "Further Syntax" ] Curly braces (also referred to as just "braces" or as "curly brackets") are a major part of the C++ programming language. They are used in several different constructs, outlined below, and this can sometimes be confusing for beginners. + An opening curly brace `{` must always be followed by a closing curly brace `}`. This is a condition that is often referred to as the braces being balanced. The Arduino IDE (Integrated Development Environment) includes a convenient feature to check the balance of curly braces. Just select a brace, or even click the insertion point immediately following a brace, and its logical companion will be highlighted. [%hardbreaks] -Beginners programmers, and programmers coming to C++ from the BASIC language often find using braces confusing or daunting. After all, the same curly braces replace the RETURN statement in a subroutine (function), the ENDIF statement in a conditional and the NEXT statement in a FOR loop. +Beginner programmers, and programmers coming to C++ from the BASIC language often find using braces confusing or daunting. After all, the same curly braces replace the RETURN statement in a subroutine (function), the ENDIF statement in a conditional and the NEXT statement in a FOR loop. [%hardbreaks] Unbalanced braces can often lead to cryptic, impenetrable compiler errors that can sometimes be hard to track down in a large program. Because of their varied usages, braces are also incredibly important to the syntax of a program and moving a brace one or two lines will often dramatically affect the meaning of a program. [%hardbreaks] From af18fb91c08df6fcc626c14d3aa825cfca00e5af Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 25 Jun 2019 21:54:13 +0530 Subject: [PATCH 048/298] Update singleLineComment.adoc Minor typo fixed --- Language/Structure/Further Syntax/singleLineComment.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Further Syntax/singleLineComment.adoc b/Language/Structure/Further Syntax/singleLineComment.adoc index 3bf2f8ae0..9946e3865 100644 --- a/Language/Structure/Further Syntax/singleLineComment.adoc +++ b/Language/Structure/Further Syntax/singleLineComment.adoc @@ -21,7 +21,7 @@ subCategories: [ "Further Syntax" ] *Comments* are lines in the program that are used to inform yourself or others about the way the program works. They are ignored by the compiler, and not exported to the processor, so they don't take up any space in the microcontroller's flash memory. Comments' only purpose is to help you understand (or remember), or to inform others about how your program works. [%hardbreaks] -A *single line comment* begins with `//` (two adjacent slashes). This comment ends automatically at the end of a line. whatever follows `//` till the end of a line will be ignored by the compiler. +A *single line comment* begins with `//` (two adjacent slashes). This comment ends automatically at the end of a line. Whatever follows `//` till the end of a line will be ignored by the compiler. -- // OVERVIEW SECTION ENDS From 6e5a36f960f3779c0a8d3a4904a8a747c053f516 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 25 Jun 2019 21:59:18 +0530 Subject: [PATCH 049/298] Update else.adoc --- Language/Structure/Control Structure/else.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 64ce1afe3..91580ad85 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -19,7 +19,7 @@ The `if...else` allows greater control over the flow of code than the basic link Each test will proceed to the next one until a true test is encountered. When a true test is found, its associated block of code is run, and the program then skips to the line following the entire if/else construction. If no test proves to be true, the default `else` block is executed, if one is present, and sets the default behavior. [%hardbreaks] -Note that an `else if` block may be used with or without a terminating `else` block and vice versa. An unlimited number of such `else if` branches is allowed. +Note that an `else if` block may be used with or without a terminating `else` block and vice versa. An unlimited number of such `else if` branches are allowed. [float] === Syntax From 3f1d10c995ecd95256095070536428838f7975d8 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 26 Jun 2019 04:53:00 -0700 Subject: [PATCH 050/298] Correct serial object name for ATmega32U4 boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The table incorrectly indicated that pins 0 and 1 on the Leonardo, Micro, and Yún were Serial. These pins are Serial1. --- Language/Functions/Communication/Serial.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial.adoc b/Language/Functions/Communication/Serial.adoc index 567f3bc99..21fb67ce1 100644 --- a/Language/Functions/Communication/Serial.adoc +++ b/Language/Functions/Communication/Serial.adoc @@ -22,7 +22,7 @@ Used for communication between the Arduino board and a computer or other devices | Board | USB CDC name | Serial pins | Serial1 pins | Serial2 pins | Serial3 pins | Uno, Nano, Mini | | 0(RX), 1(TX) | | | | Mega | | 0(RX), 1(TX) | 19(RX), 18(TX) | 17(RX), 16(TX) | 15(RX), 14(TX) -| Leonardo, Micro, Yún | Serial | 0(RX), 1(TX) | | | +| Leonardo, Micro, Yún | Serial | | 0(RX), 1(TX) | | | Uno WiFi Rev.2 | | Connected to USB | 0(RX), 1(TX) | Connected to NINA | | MKR boards | Serial | | 13(RX), 14(TX) | | | Zero | SerialUSB (Native USB Port only) | Connected to Programming Port | 0(RX), 1(TX) | | From 0941553d6c6c06814cd900c8d3dbb32a04a1923c Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 30 Jun 2019 13:42:23 +0530 Subject: [PATCH 051/298] Fixed typos Addition of Comma Line 6 The preposition "on" must be replaced with "of" Line 11 The line contains a series of three or more words, phrases, or clauses. Insertion of a comma is required to separate them. Line 11 "as" replaced by "at". Line 18 --- README.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index 4cc807d66..8f78aaf7a 100644 --- a/README.adoc +++ b/README.adoc @@ -3,19 +3,19 @@ Reference-en is the repo for the Language Reference documentation of the Arduino syntax in **English**. All the Reference terms files are in AsciiDoc format. -Thank you for taking the time to contribute to Arduino content, this is really helpful to the whole Arduino Community. If you want to learn more on how to contribute to this project please check https://create.arduino.cc/projecthub/Arduino_Genuino/contribute-to-the-arduino-reference-af7c37[this step by step tutorial]. +Thank you for taking the time to contribute to Arduino content, this is really helpful to the whole Arduino Community. If you want to learn more on how to contribute to this project, please check https://create.arduino.cc/projecthub/Arduino_Genuino/contribute-to-the-arduino-reference-af7c37[this step by step tutorial]. == Content Creation and Editing If you want to contribute new content, create a new file (with any text or code editor) and save it as .adoc. Do not use parenthesis or any special character in the file name. -In https://raw.githubusercontent.com/arduino/reference-en/master/AsciiDoc_sample/AsciiDoc_Dictionary/AsciiDoc_Template-Dictionary.adoc[`reference-en/AsciiDoc_sample/AsciiDoc_Dictionary`] you will find an overview on the AsciiDoc syntax. This includes Titles, Text, Links, Images, Tables, Code and various embeds (video, slideshow, audio and code). You can see it rendered https://www.arduino.cc/reference/en/asciidoc_sample/asciidoc_dictionary/asciidoc_template-dictionary/[here]. +In https://raw.githubusercontent.com/arduino/reference-en/master/AsciiDoc_sample/AsciiDoc_Dictionary/AsciiDoc_Template-Dictionary.adoc[`reference-en/AsciiDoc_sample/AsciiDoc_Dictionary`] you will find an overview of the AsciiDoc syntax. This includes Titles, Text, Links, Images, Tables, Code and various embeds (video, slideshow, audio, and code). You can see it rendered https://www.arduino.cc/reference/en/asciidoc_sample/asciidoc_dictionary/asciidoc_template-dictionary/[here]. If you want to contribute to the Language Reference or edit existing content, you can find two templates in reference-en/AsciiDoc_sample/Reference_Terms: * Use https://raw.githubusercontent.com/arduino/reference-en/master/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc[`AsciiDoc_Template-Single_Entity.adoc`] (rendered https://www.arduino.cc/reference/en/asciidoc_sample/reference_terms/asciidoc_template-single_entity/[here]) for terms such as link:http://arduino.cc/en/Reference/AnalogWrite[analogWrite]. * Use https://raw.githubusercontent.com/arduino/reference-en/master/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Parent_Of_Entities.adoc[`AsciiDoc_Template-Parent_Of_Entities.adoc`] (rendered https://www.arduino.cc/reference/en/asciidoc_sample/reference_terms/asciidoc_template-parent_of_entities/[here]) for groups of functions such as link:http://arduino.cc/en/Reference/Serial[Serial]. -Please note that every Reference file should include as least a Description, some Example Code, and links to other relevant infos (See Also section). +Please note that every Reference file should include at least a Description, some Example Code, and links to other relevant infos (See Also section). If you need to add images to the Asciidoc please create a folder called attachments in the same directory as the Asciidoc file. Images can be saved in SVG and PNG format, max size 200KB. From 56d95dac552d9443d9e36f7a8844c5fc8d427f8b Mon Sep 17 00:00:00 2001 From: Kyle Lobo Date: Mon, 1 Jul 2019 22:06:49 +0530 Subject: [PATCH 052/298] Fix grammatical, formatting errors 1. If you want to learn more ~on~ about 2. and link to other ~infos~ info 3. a short Tutorial to show you how ~,~ - CHECK IT OUT! --- README.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index 8f78aaf7a..cbe8fde78 100644 --- a/README.adoc +++ b/README.adoc @@ -3,7 +3,7 @@ Reference-en is the repo for the Language Reference documentation of the Arduino syntax in **English**. All the Reference terms files are in AsciiDoc format. -Thank you for taking the time to contribute to Arduino content, this is really helpful to the whole Arduino Community. If you want to learn more on how to contribute to this project, please check https://create.arduino.cc/projecthub/Arduino_Genuino/contribute-to-the-arduino-reference-af7c37[this step by step tutorial]. +Thank you for taking the time to contribute to Arduino content, this is really helpful to the whole Arduino Community. If you want to learn more about how to contribute to this project, please check https://create.arduino.cc/projecthub/Arduino_Genuino/contribute-to-the-arduino-reference-af7c37[this step by step tutorial]. == Content Creation and Editing If you want to contribute new content, create a new file (with any text or code editor) and save it as .adoc. @@ -15,12 +15,12 @@ If you want to contribute to the Language Reference or edit existing content, yo * Use https://raw.githubusercontent.com/arduino/reference-en/master/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc[`AsciiDoc_Template-Single_Entity.adoc`] (rendered https://www.arduino.cc/reference/en/asciidoc_sample/reference_terms/asciidoc_template-single_entity/[here]) for terms such as link:http://arduino.cc/en/Reference/AnalogWrite[analogWrite]. * Use https://raw.githubusercontent.com/arduino/reference-en/master/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Parent_Of_Entities.adoc[`AsciiDoc_Template-Parent_Of_Entities.adoc`] (rendered https://www.arduino.cc/reference/en/asciidoc_sample/reference_terms/asciidoc_template-parent_of_entities/[here]) for groups of functions such as link:http://arduino.cc/en/Reference/Serial[Serial]. -Please note that every Reference file should include at least a Description, some Example Code, and links to other relevant infos (See Also section). +Please note that every Reference file should include at least a Description, some Example Code, and links to other relevant info (See Also section). If you need to add images to the Asciidoc please create a folder called attachments in the same directory as the Asciidoc file. Images can be saved in SVG and PNG format, max size 200KB. == Contribute Content on Github -If you are not familiar with Git you can contribute content directly on Github via their online interface. We put together a short Tutorial to show you how, https://create.arduino.cc/projecthub/Arduino_Genuino/contribute-to-the-arduino-reference-af7c37[CHECK IT OUT!] +If you are not familiar with Git you can contribute content directly on Github via their online interface. We put together a short Tutorial to show you how - https://create.arduino.cc/projecthub/Arduino_Genuino/contribute-to-the-arduino-reference-af7c37[CHECK IT OUT!] link:https://help.github.com/articles/editing-files-in-another-user-s-repository/[You can also follow this guide] (written by the Github team) to learn how to edit an .adoc file and propose a file change to the Arduino team. When suggesting a change, please follow the guidelines described in the Reference template files. From b24aff92e4d27226cb88fddc98f3cc094b2122cc Mon Sep 17 00:00:00 2001 From: Kyle Lobo Date: Mon, 1 Jul 2019 22:28:35 +0530 Subject: [PATCH 053/298] Fix grammatical errors 1. at the top _of_ your sketch 2. such as a project with an LCD ~display~ 3. this is ~in~ actually an example --- Language/Variables/Utilities/PROGMEM.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index c27e27ed7..b483ad5fe 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -21,7 +21,7 @@ Store data in flash (program) memory instead of SRAM. There's a description of t The `PROGMEM` keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "put this information into flash memory", instead of into SRAM, where it would normally go. -PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE. However, if you are using an IDE version below 1.0 (2011), you'll first need to include the library at the top your sketch, like this: +PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE. However, if you are using an IDE version below 1.0 (2011), you'll first need to include the library at the top of your sketch, like this: `#include ` While `PROGMEM` could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array, (or another C++ data structure beyond our present discussion). @@ -101,7 +101,7 @@ void loop() { ---- *Arrays of strings* -It is often convenient when working with large amounts of text, such as a project with an LCD display, to setup an array of strings. Because strings themselves are arrays, this is in actually an example of a two-dimensional array. +It is often convenient when working with large amounts of text, such as a project with an LCD, to setup an array of strings. Because strings themselves are arrays, this is actually an example of a two-dimensional array. These tend to be large structures so putting them into program memory is often desirable. The code below illustrates the idea. @@ -146,7 +146,7 @@ void setup() { void loop() { /* Using the string table in program memory requires the use of special functions to retrieve the data. The strcpy_P function copies a string from program space to a string in RAM ("buffer"). - Make sure your receiving string in RAM is large enough to hold whatever + Make sure your receiving string in RAM is large enough to hold whatever you are retrieving from program space. */ From 8830c4e394ffa93f6974973d5b2893f3a0f3a822 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 1 Jul 2019 23:05:52 +0530 Subject: [PATCH 054/298] Fixed code syntax in digitalRead Fixed code syntax in Line 73 --- Language/Functions/Digital IO/digitalRead.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Digital IO/digitalRead.adoc b/Language/Functions/Digital IO/digitalRead.adoc index 4db06e3d4..01b4f3c5a 100644 --- a/Language/Functions/Digital IO/digitalRead.adoc +++ b/Language/Functions/Digital IO/digitalRead.adoc @@ -70,7 +70,7 @@ void loop() { [float] === Notes and Warnings -If the pin isn't connected to anything, digitalRead() can return either HIGH or LOW (and this can change randomly). +If the pin isn't connected to anything, `digitalRead()` can return either `HIGH` or `LOW` (and this can change randomly). The analog input pins can be used as digital pins, referred to as A0, A1, etc. The exception is the Arduino Nano, Pro Mini, and Mini's A6 and A7 pins, which can only be used as analog inputs. From cd7bcc723535ad612de14ccee4eea75bda08b55a Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 2 Jul 2019 05:34:25 -0700 Subject: [PATCH 055/298] Use correct term for the waveform generated by analogWrite() A true square wave is only created by a PWM duty cycle of 50%. At any other duty cycle setting (including 50%), analogWrite() will create a rectangular wave. --- Language/Functions/Analog IO/analogWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 404ca895a..28daf1085 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -17,7 +17,7 @@ subCategories: [ "Analog I/O" ] [float] === Description -Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady square wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. +Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady rectangular wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. [options="header"] |==================================================================================================== | Board | PWM Pins | PWM Frequency From 8fe6bb5d49b55c4fec9d3f67fdf8d7b7297b8406 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 3 Jul 2019 01:05:33 +0530 Subject: [PATCH 056/298] Update pinMode.adoc Fixed code syntax typo --- Language/Functions/Digital IO/pinMode.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Digital IO/pinMode.adoc b/Language/Functions/Digital IO/pinMode.adoc index c2b3c9e50..882e8c221 100644 --- a/Language/Functions/Digital IO/pinMode.adoc +++ b/Language/Functions/Digital IO/pinMode.adoc @@ -19,7 +19,7 @@ subCategories: [ "Digital I/O" ] === Description Configures the specified pin to behave either as an input or an output. See the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins] page for details on the functionality of the pins. [%hardbreaks] -As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly disables the internal pullups. +As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode `INPUT_PULLUP`. Additionally, the `INPUT` mode explicitly disables the internal pullups. [%hardbreaks] From 660fbe6e15ce408cef4d515f4eb668dc12190d72 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 3 Jul 2019 01:09:27 +0530 Subject: [PATCH 057/298] Update analogRead.adoc Fixed code syntax related typo in analogRead --- Language/Functions/Analog IO/analogRead.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Analog IO/analogRead.adoc b/Language/Functions/Analog IO/analogRead.adoc index 8a6ae8e2d..929b1cc8a 100644 --- a/Language/Functions/Analog IO/analogRead.adoc +++ b/Language/Functions/Analog IO/analogRead.adoc @@ -32,7 +32,7 @@ On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 microseconds |=================================================== *A0 through A5 are labelled on the board, A6 through A11 are respectively available on pins 4, 6, 8, 9, 10, and 12 + -**The default analogRead() resolution for these boards is 10 bits, for compatibility. You need to use link:../../zero-due-mkr-family/analogreadresolution[analogReadResolution()] to change it to 12 bits. +**The default `analogRead()` resolution for these boards is 10 bits, for compatibility. You need to use link:../../zero-due-mkr-family/analogreadresolution[analogReadResolution()] to change it to 12 bits. [%hardbreaks] @@ -82,7 +82,7 @@ void loop() { [float] === Notes and Warnings -If the analog input pin is not connected to anything, the value returned by analogRead() will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.). +If the analog input pin is not connected to anything, the value returned by `analogRead()` will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.). -- // HOW TO USE SECTION ENDS From cdd78edfe263ec78ac4a78519eb2c5722894f05d Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 3 Jul 2019 01:17:05 +0530 Subject: [PATCH 058/298] Update noTone.adoc Fixed code syntax related typo in noTone.adoc --- Language/Functions/Advanced IO/noTone.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Advanced IO/noTone.adoc b/Language/Functions/Advanced IO/noTone.adoc index d30c3360d..14e3663d0 100644 --- a/Language/Functions/Advanced IO/noTone.adoc +++ b/Language/Functions/Advanced IO/noTone.adoc @@ -45,7 +45,7 @@ Nothing [float] === Notes and Warnings -If you want to play different pitches on multiple pins, you need to call noTone() on one pin before calling `tone()` on the next pin. +If you want to play different pitches on multiple pins, you need to call `noTone()` on one pin before calling `tone()` on the next pin. [%hardbreaks] -- From 462caff6bebec1a1106de5683996a9f9121bf00d Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 3 Jul 2019 01:19:38 +0530 Subject: [PATCH 059/298] Update pulseInLong.adoc Fixed code syntax related typo --- Language/Functions/Advanced IO/pulseInLong.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Advanced IO/pulseInLong.adoc b/Language/Functions/Advanced IO/pulseInLong.adoc index dd2bc5320..2517f6533 100644 --- a/Language/Functions/Advanced IO/pulseInLong.adoc +++ b/Language/Functions/Advanced IO/pulseInLong.adoc @@ -76,7 +76,7 @@ void loop() { [float] === Notes and Warnings -This function relies on micros() so cannot be used in link:../../interrupts/nointerrupts[noInterrupts()] context. +This function relies on `micros()` so cannot be used in link:../../interrupts/nointerrupts[noInterrupts()] context. -- // HOW TO USE SECTION ENDS From 61ce3b24a58d37160ff9e12c50c40e0dcf104e63 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Wed, 3 Jul 2019 01:23:01 +0530 Subject: [PATCH 060/298] Update tone.adoc Fixed code syntax related typo --- Language/Functions/Advanced IO/tone.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 169f43f4c..56c65bbc5 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -19,7 +19,7 @@ subCategories: [ "Advanced I/O" ] === Description Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until a call to link:../noTone[noTone()]. The pin can be connected to a piezo buzzer or other speaker to play tones. -Only one tone can be generated at a time. If a tone is already playing on a different pin, the call to tone() will have no effect. If the tone is playing on the same pin, the call will set its frequency. +Only one tone can be generated at a time. If a tone is already playing on a different pin, the call to `tone()` will have no effect. If the tone is playing on the same pin, the call will set its frequency. Use of the `tone()` function will interfere with PWM output on pins 3 and 11 (on boards other than the Mega). From 67fb05be69ed20907de855d7f1beecec9cf8d59e Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Thu, 4 Jul 2019 00:25:46 +0530 Subject: [PATCH 061/298] Update find.adoc Fixed code syntax related typo --- Language/Functions/Communication/Serial/find.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Serial/find.adoc b/Language/Functions/Communication/Serial/find.adoc index e8e383f5d..b36efdc63 100644 --- a/Language/Functions/Communication/Serial/find.adoc +++ b/Language/Functions/Communication/Serial/find.adoc @@ -14,9 +14,9 @@ title: Serial.find() [float] === Description -Serial.find() reads data from the serial buffer until the target is found. The function returns true if target is found, false if it times out. +`Serial.find()` reads data from the serial buffer until the target is found. The function returns `true` if target is found, `false` if it times out. -Serial.find() inherits from the link:../../stream[stream] utility class. +`Serial.find()` inherits from the link:../../stream[stream] utility class. [%hardbreaks] From 85affc445ccfefedcf2670899d50b8a7de871161 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 5 Jul 2019 00:18:17 +0530 Subject: [PATCH 062/298] Update print.adoc Fixed code syntax related typo --- Language/Functions/Communication/Serial/print.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index 06844efc5..4f3e6b1fc 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -32,7 +32,7 @@ An optional second parameter specifies the base (format) to use; permitted value * `Serial.print(1.23456, 2)` gives "1.23" + * `Serial.print(1.23456, 4)` gives "1.2346" -You can pass flash-memory based strings to Serial.print() by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example: +You can pass flash-memory based strings to `Serial.print()` by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example: `Serial.print(F(“Hello World”))` From 0266b7b2d7cc13e16c540119f7dca91a0e4f5bd8 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 5 Jul 2019 19:00:31 +0530 Subject: [PATCH 063/298] Update begin.adoc Specified Even and Odd Parity --- Language/Functions/Communication/Serial/begin.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Serial/begin.adoc b/Language/Functions/Communication/Serial/begin.adoc index 0033a91af..f5701a75a 100644 --- a/Language/Functions/Communication/Serial/begin.adoc +++ b/Language/Functions/Communication/Serial/begin.adoc @@ -39,7 +39,7 @@ An optional second argument configures the data, parity, and stop bits. The defa `SERIAL_6N2` + `SERIAL_7N2` + `SERIAL_8N2` + -`SERIAL_5E1` + +`SERIAL_5E1`: even parity + `SERIAL_6E1` + `SERIAL_7E1` + `SERIAL_8E1` + @@ -47,7 +47,7 @@ An optional second argument configures the data, parity, and stop bits. The defa `SERIAL_6E2` + `SERIAL_7E2` + `SERIAL_8E2` + -`SERIAL_5O1` + +`SERIAL_5O1`: odd parity + `SERIAL_6O1` + `SERIAL_7O1` + `SERIAL_8O1` + From 2e938f0dcf26ff70249321fb03880e274f199712 Mon Sep 17 00:00:00 2001 From: HansM Date: Thu, 11 Jul 2019 11:08:48 +0200 Subject: [PATCH 064/298] Made serial italic in Serial.print. --- .../Functions/Communication/Serial/print.adoc | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index 4f3e6b1fc..e43fa2665 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -16,23 +16,23 @@ title: Serial.print() === Description Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is. For example- -* `Serial.print(78)` gives "78" + -* `Serial.print(1.23456)` gives "1.23" + -* `Serial.print('N')` gives "N" + -* `Serial.print("Hello world.")` gives "Hello world." +* `_Serial_.print(78)` gives "78" + +* `_Serial_.print(1.23456)` gives "1.23" + +* `_Serial_.print('N')` gives "N" + +* `_Serial_.print("Hello world.")` gives "Hello world." An optional second parameter specifies the base (format) to use; permitted values are `BIN(binary, or base 2)`, `OCT(octal, or base 8)`, `DEC(decimal, or base 10)`, `HEX(hexadecimal, or base 16)`. For floating point numbers, this parameter specifies the number of decimal places to use. For example- -* `Serial.print(78, BIN)` gives "1001110" + -* `Serial.print(78, OCT)` gives "116" + -* `Serial.print(78, DEC)` gives "78" + -* `Serial.print(78, HEX)` gives "4E" + -* `Serial.print(1.23456, 0)` gives "1" + -* `Serial.print(1.23456, 2)` gives "1.23" + -* `Serial.print(1.23456, 4)` gives "1.2346" +* `_Serial_.print(78, BIN)` gives "1001110" + +* `_Serial_.print(78, OCT)` gives "116" + +* `_Serial_.print(78, DEC)` gives "78" + +* `_Serial_.print(78, HEX)` gives "4E" + +* `_Serial_.print(1.23456, 0)` gives "1" + +* `_Serial_.print(1.23456, 2)` gives "1.23" + +* `_Serial_.print(1.23456, 4)` gives "1.2346" -You can pass flash-memory based strings to `Serial.print()` by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example: +You can pass flash-memory based strings to `_Serial_.print()` by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example: `Serial.print(F(“Hello World”))` @@ -122,7 +122,7 @@ void loop() { [float] === Notes and Warnings -For information on the asyncronicity of `Serial.print()`, see the Notes and Warnings section of the link:../write#howtouse[Serial.write() reference page]. +For information on the asyncronicity of `_Serial_.print()`, see the Notes and Warnings section of the link:../write#howtouse[Serial.write() reference page]. -- // HOW TO USE SECTION ENDS From 370fae1b0419d4db0083fed57eff16805faf4a1c Mon Sep 17 00:00:00 2001 From: Luca Cipriani Date: Thu, 11 Jul 2019 14:35:19 +0200 Subject: [PATCH 065/298] test PR, please ignore test PR, please ignore --- README.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.adoc b/README.adoc index cbe8fde78..803b9f5fd 100644 --- a/README.adoc +++ b/README.adoc @@ -1,5 +1,7 @@ = Reference-en +Test + Reference-en is the repo for the Language Reference documentation of the Arduino syntax in **English**. All the Reference terms files are in AsciiDoc format. From 70df2cde7c8a3b94b646deb4ab4375d30021f20c Mon Sep 17 00:00:00 2001 From: Luca Cipriani Date: Thu, 11 Jul 2019 15:12:29 +0200 Subject: [PATCH 066/298] test to ignore 2 test to ignore 2 --- README.adoc | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.adoc b/README.adoc index 803b9f5fd..cbe8fde78 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,5 @@ = Reference-en -Test - Reference-en is the repo for the Language Reference documentation of the Arduino syntax in **English**. All the Reference terms files are in AsciiDoc format. From 83f49784e61da074519b766c941019fa82ee0d73 Mon Sep 17 00:00:00 2001 From: Roberto Sora <35916119+rsora@users.noreply.github.com> Date: Thu, 11 Jul 2019 15:46:19 +0200 Subject: [PATCH 067/298] test commit to test webhook integration --- README.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/README.adoc b/README.adoc index cbe8fde78..9a14f37ed 100644 --- a/README.adoc +++ b/README.adoc @@ -1,5 +1,6 @@ = Reference-en + Reference-en is the repo for the Language Reference documentation of the Arduino syntax in **English**. All the Reference terms files are in AsciiDoc format. From 4e9b19cc68c002291d400a419ed307dc621f58e2 Mon Sep 17 00:00:00 2001 From: Roberto Sora <35916119+rsora@users.noreply.github.com> Date: Thu, 11 Jul 2019 15:48:26 +0200 Subject: [PATCH 068/298] test commit to test again webhook integration --- README.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/README.adoc b/README.adoc index 9a14f37ed..3285859f1 100644 --- a/README.adoc +++ b/README.adoc @@ -1,6 +1,7 @@ = Reference-en + Reference-en is the repo for the Language Reference documentation of the Arduino syntax in **English**. All the Reference terms files are in AsciiDoc format. From 28710be7061b3c7c56d766c13c7613b6da6ff12a Mon Sep 17 00:00:00 2001 From: Roberto Sora <35916119+rsora@users.noreply.github.com> Date: Thu, 11 Jul 2019 16:01:54 +0200 Subject: [PATCH 069/298] test again webhook integration (sorry) --- README.adoc | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.adoc b/README.adoc index 3285859f1..cbe8fde78 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,5 @@ = Reference-en - - Reference-en is the repo for the Language Reference documentation of the Arduino syntax in **English**. All the Reference terms files are in AsciiDoc format. From a1ec4da091c48e8621d6b7b97f14078d84579689 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 03:46:03 +0530 Subject: [PATCH 070/298] Update byteCast.adoc Code Highlight markup and Link colouration fix --- Language/Variables/Conversion/byteCast.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Conversion/byteCast.adoc b/Language/Variables/Conversion/byteCast.adoc index 25e3484d4..e1d50ee4e 100644 --- a/Language/Variables/Conversion/byteCast.adoc +++ b/Language/Variables/Conversion/byteCast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/byte[byte] data type. +Converts a value to the `link:../../data-types/byte[byte]` data type. [%hardbreaks] @@ -34,7 +34,7 @@ Converts a value to the link:../../data-types/byte[byte] data type. [float] === Returns -Data type: `byte`. +Data type: link:../../data-types/byte[`byte`]. -- // OVERVIEW SECTION ENDS From a20c994bf2aa8db4c9c3b04dd192187d2d4e0992 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 03:49:47 +0530 Subject: [PATCH 071/298] Update charCast.adoc Code Highlight markup and Link colouration fix --- Language/Variables/Conversion/charCast.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Conversion/charCast.adoc b/Language/Variables/Conversion/charCast.adoc index 57eacd65e..b4a6963fe 100644 --- a/Language/Variables/Conversion/charCast.adoc +++ b/Language/Variables/Conversion/charCast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/char[char] data type. +Converts a value to the `link:../../data-types/char[char]` data type. [%hardbreaks] @@ -34,7 +34,7 @@ Converts a value to the link:../../data-types/char[char] data type. [float] === Returns -Data type: `char`. +Data type: link:../../data-types/char[`char`]. -- // OVERVIEW SECTION ENDS From 69c0c610e1ec128761787f30d63861f1586cb8bc Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 03:57:04 +0530 Subject: [PATCH 072/298] Update intCast.adoc --- Language/Variables/Conversion/intCast.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Conversion/intCast.adoc b/Language/Variables/Conversion/intCast.adoc index 53c88d9da..692ecc871 100644 --- a/Language/Variables/Conversion/intCast.adoc +++ b/Language/Variables/Conversion/intCast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/int[int] data type. +Converts a value to the `link:../../data-types/int[int]` data type. [%hardbreaks] @@ -34,7 +34,7 @@ Converts a value to the link:../../data-types/int[int] data type. [float] === Returns -Data type: `int`. +Data type: link:../../data-types/int[`int`]. -- // OVERVIEW SECTION ENDS From c6b748c0ec91175f6b3cf889ef634eb865afef9f Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 03:58:52 +0530 Subject: [PATCH 073/298] Update longCast.adoc --- Language/Variables/Conversion/longCast.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Conversion/longCast.adoc b/Language/Variables/Conversion/longCast.adoc index 411883fe0..fefd61eb7 100644 --- a/Language/Variables/Conversion/longCast.adoc +++ b/Language/Variables/Conversion/longCast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/long[long] data type. +Converts a value to the `link:../../data-types/long[long]` data type. [%hardbreaks] @@ -34,7 +34,7 @@ Converts a value to the link:../../data-types/long[long] data type. [float] === Returns -Data type: `long`. +Data type: link:../../data-types/long[`long`]. -- // OVERVIEW SECTION ENDS From 791c8d2658061cfa93349e4ec2025886ef3f66ef Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 04:00:38 +0530 Subject: [PATCH 074/298] Update unsignedIntCast.adoc --- Language/Variables/Conversion/unsignedIntCast.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Conversion/unsignedIntCast.adoc b/Language/Variables/Conversion/unsignedIntCast.adoc index 863d2724e..62af57a95 100644 --- a/Language/Variables/Conversion/unsignedIntCast.adoc +++ b/Language/Variables/Conversion/unsignedIntCast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/unsignedint[unsigned int] data type. +Converts a value to the `link:../../data-types/unsignedint[unsigned int]` data type. [%hardbreaks] @@ -32,7 +32,7 @@ Converts a value to the link:../../data-types/unsignedint[unsigned int] data typ [float] === Returns -`unsigned int` +link:../../data-types/unsignedint[`unsigned int`] -- // OVERVIEW SECTION ENDS @@ -52,4 +52,4 @@ Converts a value to the link:../../data-types/unsignedint[unsigned int] data typ -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS From 0ac40c0487f68e2cb0972ec971896bd521bc6d9d Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 04:02:22 +0530 Subject: [PATCH 075/298] Update unsignedLongCast.adoc --- Language/Variables/Conversion/unsignedLongCast.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Conversion/unsignedLongCast.adoc b/Language/Variables/Conversion/unsignedLongCast.adoc index c950d2b7c..c44d19594 100644 --- a/Language/Variables/Conversion/unsignedLongCast.adoc +++ b/Language/Variables/Conversion/unsignedLongCast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/unsignedlong[unsigned long] data type. +Converts a value to the `link:../../data-types/unsignedlong[unsigned long]` data type. [%hardbreaks] @@ -32,7 +32,7 @@ Converts a value to the link:../../data-types/unsignedlong[unsigned long] data t [float] === Returns -`unsigned long` +link:../../data-types/unsignedlong[`unsigned long`] -- // OVERVIEW SECTION ENDS @@ -52,4 +52,4 @@ Converts a value to the link:../../data-types/unsignedlong[unsigned long] data t -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS From 4938dbe49ebd15607342e6a552aaaebd4f31fe1b Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 04:03:45 +0530 Subject: [PATCH 076/298] Update wordcast.adoc --- Language/Variables/Conversion/wordcast.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Conversion/wordcast.adoc b/Language/Variables/Conversion/wordcast.adoc index abd28b7b9..e6ddc1363 100644 --- a/Language/Variables/Conversion/wordcast.adoc +++ b/Language/Variables/Conversion/wordcast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/word[word] data type. +Converts a value to the `link:../../data-types/word[word]` data type. [%hardbreaks] @@ -37,7 +37,7 @@ Converts a value to the link:../../data-types/word[word] data type. [float] === Returns -Data type: `word`. +Data type: link:../../data-types/word[`word`]. -- // OVERVIEW SECTION ENDS From d2c5e69d9bf994058f157b65cf1e393057116e7e Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 12:16:21 +0530 Subject: [PATCH 077/298] Code Highlight markup and Link colouration fix constants.adoc (#657) Co-Authored-By: per1234 --- Language/Variables/Constants/constants.adoc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Language/Variables/Constants/constants.adoc b/Language/Variables/Constants/constants.adoc index 32650ad60..0e43ffacd 100644 --- a/Language/Variables/Constants/constants.adoc +++ b/Language/Variables/Constants/constants.adoc @@ -38,16 +38,16 @@ When reading or writing to a digital pin there are only two possible values a pi [float] === HIGH -The meaning of `HIGH` (in reference to a pin) is somewhat different depending on whether a pin is set to an `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with link:../../../functions/digital-io/pinmode[pinMode()], and read with link:../../../functions/digital-io/digitalread[digitalRead()], the Arduino (ATmega) will report `HIGH` if: +The meaning of `HIGH` (in reference to a pin) is somewhat different depending on whether a pin is set to an `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with `link:../../../functions/digital-io/pinmode[pinMode()]`, and read with `link:../../../functions/digital-io/digitalread[digitalRead()]`, the Arduino (ATmega) will report `HIGH` if: - a voltage greater than 3.0V is present at the pin (5V boards) - a voltage greater than 2.0V volts is present at the pin (3.3V boards) [%hardbreaks] -A pin may also be configured as an INPUT with `pinMode()`, and subsequently made HIGH with link:../../../functions/digital-io/digitalwrite[digitalWrite()]. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can done alternatively by passing `INPUT_PULLUP` as argument to the `pinMode()` funtion, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. +A pin may also be configured as an INPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and subsequently made HIGH with `link:../../../functions/digital-io/digitalwrite[digitalWrite()]`. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can done alternatively by passing `INPUT_PULLUP` as argument to the link:../../../functions/digital-io/pinmode[`pinMode()`] funtion, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. [%hardbreaks] -When a pin is configured to OUTPUT with `pinMode()`, and set to `HIGH` with `digitalWrite()`, the pin is at: +When a pin is configured to OUTPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and set to `HIGH` with link:../../../functions/digital-io/digitalwrite[`digitalWrite()`], the pin is at: - 5 volts (5V boards) - 3.3 volts (3.3V boards) @@ -57,21 +57,21 @@ In this state it can source current, e.g. light an LED that is connected through [float] === LOW -The meaning of `LOW` also has a different meaning depending on whether a pin is set to `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with `pinMode()`, and read with `digitalRead()`, the Arduino (ATmega) will report LOW if: +The meaning of `LOW` also has a different meaning depending on whether a pin is set to `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`], and read with link:../../../functions/digital-io/digitalread[`digitalRead()`], the Arduino (ATmega) will report LOW if: - a voltage less than 1.5V is present at the pin (5V boards) - a voltage less than 1.0V (Approx) is present at the pin (3.3V boards) -When a pin is configured to `OUTPUT` with `pinMode()`, and set to `LOW` with `digitalWrite()`, the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts). +When a pin is configured to `OUTPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`], and set to `LOW` with link:../../../functions/digital-io/digitalwrite[`digitalWrite()`], the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts). [%hardbreaks] [float] == Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT -Digital pins can be used as `INPUT`, `INPUT_PULLUP`, or `OUTPUT`. Changing a pin with `pinMode()` changes the electrical behavior of the pin. +Digital pins can be used as `INPUT`, `INPUT_PULLUP`, or `OUTPUT`. Changing a pin with link:../../../functions/digital-io/pinmode[`pinMode()`] changes the electrical behavior of the pin. [float] === Pins Configured as INPUT -Arduino (ATmega) pins configured as `INPUT` with `pinMode()` are said to be in a _high-impedance_ state. Pins configured as `INPUT` make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor. +Arduino (ATmega) pins configured as `INPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`] are said to be in a _high-impedance_ state. Pins configured as `INPUT` make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor. [%hardbreaks] If you have your pin configured as an `INPUT`, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not not draw too much current when the switch is closed. See the http://arduino.cc/en/Tutorial/DigitalReadSerial[Digital Read Serial^] tutorial for more information. @@ -85,7 +85,7 @@ If a pull-up resistor is used, the input pin will be `HIGH` when the switch is o [float] === Pins Configured as INPUT_PULLUP -The ATmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the `INPUT_PULLUP` argument in `pinMode()`. +The ATmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the `INPUT_PULLUP` argument in link:../../../functions/digital-io/pinmode[`pinMode()`]. [%hardbreaks] See the http://arduino.cc/en/Tutorial/InputPullupSerial[Input Pullup Serial^] tutorial for an example of this in use. @@ -96,7 +96,7 @@ Pins configured as inputs with either `INPUT` or `INPUT_PULLUP` can be damaged o [float] === Pins Configured as OUTPUT -Pins configured as `OUTPUT` with `pinMode()` are said to be in a _low-impedance_ state. This means that they can provide a substantial amount of current to other circuits. ATmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry. +Pins configured as `OUTPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`] are said to be in a _low-impedance_ state. This means that they can provide a substantial amount of current to other circuits. ATmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry. [%hardbreaks] Pins configured as outputs can be damaged or destroyed if they are connected to either the ground or positive power rails. From 5d7a0b1a90a0bb7c26fcef17195f624d9b5a73ff Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 12 Jul 2019 12:46:01 +0530 Subject: [PATCH 078/298] Code Highlight markup and Link colouration fix floatCast.adoc (#665) Co-Authored-By: per1234 --- Language/Variables/Conversion/floatCast.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Conversion/floatCast.adoc b/Language/Variables/Conversion/floatCast.adoc index 920a04285..ccd127afd 100644 --- a/Language/Variables/Conversion/floatCast.adoc +++ b/Language/Variables/Conversion/floatCast.adoc @@ -17,7 +17,7 @@ subCategories: [ "Conversion" ] [float] === Description -Converts a value to the link:../../data-types/float[float] data type. +Converts a value to the `link:../../data-types/float[float]` data type. [%hardbreaks] @@ -34,7 +34,7 @@ Converts a value to the link:../../data-types/float[float] data type. [float] === Returns -Data type: `float`. +Data type: link:../../data-types/float[`float`]. -- // OVERVIEW SECTION ENDS @@ -48,7 +48,7 @@ Data type: `float`. [float] === Notes and Warnings -See the reference for link:../../data-types/float[float] for details about the precision and limitations of floating point numbers on Arduino. +See the reference for `link:../../data-types/float[float]` for details about the precision and limitations of floating point numbers on Arduino. [%hardbreaks] -- From e5e4b14d7d23f5298f69b863cc55909b95efe24b Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 14 Jul 2019 05:24:22 +0530 Subject: [PATCH 079/298] Update sizeof.adoc Line 69 Do we need to modify the **ints** ? --- Language/Variables/Utilities/sizeof.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Utilities/sizeof.adoc b/Language/Variables/Utilities/sizeof.adoc index 332e8637c..d40f4d2b7 100644 --- a/Language/Variables/Utilities/sizeof.adoc +++ b/Language/Variables/Utilities/sizeof.adoc @@ -23,12 +23,12 @@ The `sizeof` operator returns the number of bytes in a variable type, or the num [float] === Parameters -`variable`: The thing to get the size of. Allowed data types: any variable type or array (e.g. `int`, `float`, `byte`). +`variable`: The thing to get the size of. Allowed data types: any variable type or array (e.g. `link:../../data-types/int[int]`, `link:../../data-types/float[float]`, `link:../../data-types/byte[byte]`). [float] === Returns -The number of bytes in a variable or bytes occupied in an array. Data type: `size_t`. +The number of bytes in a variable or bytes occupied in an array. Data type: `link:../../data-types/size_t[size_t]`. -- // OVERVIEW SECTION ENDS From ca3e7e199a843026602ab16ce7d3ab75b509ca7c Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 15 Jul 2019 01:51:09 +0530 Subject: [PATCH 080/298] Code Highlight markup and Link colouration fix --- Language/Variables/Variable Scope & Qualifiers/const.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Variable Scope & Qualifiers/const.adoc b/Language/Variables/Variable Scope & Qualifiers/const.adoc index 5914f7a33..d571776c2 100644 --- a/Language/Variables/Variable Scope & Qualifiers/const.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/const.adoc @@ -19,7 +19,7 @@ subCategories: [ "Variable Scope & Qualifiers" ] === Description The `const` keyword stands for constant. It is a variable _qualifier_ that modifies the behavior of the variable, making a variable "_read-only_". This means that the variable can be used just as any other variable of its type, but its value cannot be changed. You will get a compiler error if you try to assign a value to a `const` variable. -Constants defined with the `const` keyword obey the rules of link:../scope[variable scoping] that govern other variables. This, and the pitfalls of using `#define`, makes the `const` keyword a superior method for defining constants and is preferred over using link:../../../structure/further-syntax/define[`#define`]. +Constants defined with the `const` keyword obey the rules of link:../scope[variable scoping] that govern other variables. This, and the pitfalls of using `link:../../../structure/further-syntax/define[#define]`, makes the `const` keyword a superior method for defining constants and is preferred over using link:../../../structure/further-syntax/define[`#define`]. [%hardbreaks] -- @@ -49,9 +49,9 @@ pi = 7; // illegal - you can't write to (modify) a constant [float] === Notes and Warnings -*`#define` or `const`* +*link:../../../structure/further-syntax/define[`#define`] or `const`* -You can use either `const` or `#define` for creating numeric or string constants. For link:../../data-types/array[arrays], you will need to use `const`. In general `const` is preferred over `#define` for defining constants. +You can use either `const` or link:../../../structure/further-syntax/define[`#define`] for creating numeric or string constants. For link:../../data-types/array[arrays], you will need to use `const`. In general `const` is preferred over link:../../../structure/further-syntax/define[`#define`] for defining constants. -- From 8b6a8e606418cdcc313c3f3eb687df4953af6d57 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Thu, 18 Jul 2019 23:19:10 +0530 Subject: [PATCH 081/298] Update scope.adoc Code Highlight markup and Link colouration fix --- Language/Variables/Variable Scope & Qualifiers/scope.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Variable Scope & Qualifiers/scope.adoc b/Language/Variables/Variable Scope & Qualifiers/scope.adoc index d2501ea61..56e366c48 100644 --- a/Language/Variables/Variable Scope & Qualifiers/scope.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/scope.adoc @@ -19,11 +19,11 @@ subCategories: [ "Variable Scope & Qualifiers" ] === Description Variables in the C++ programming language, which Arduino uses, have a property called scope. This is in contrast to early versions of languages such as BASIC where every variable is a _global_ variable. -A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino environment, any variable declared outside of a function (e.g. setup(), loop(), etc. ), is a _global_ variable. +A global variable is one that can be seen by every function in a program. Local variables are only visible to the function in which they are declared. In the Arduino environment, any variable declared outside of a function (e.g. `link:../../../structure/sketch/setup[setup()]`, `link:../../../structure/sketch/loop[loop()]`, etc. ), is a _global_ variable. When programs start to get larger and more complex, local variables are a useful way to insure that only one function has access to its own variables. This prevents programming errors when one function inadvertently modifies variables used by another function. -It is also sometimes handy to declare and initialize a variable inside a `for` loop. This creates a variable that can only be accessed from inside the for-loop brackets. +It is also sometimes handy to declare and initialize a variable inside a `link:../../../structure/control-structure/for[for]` loop. This creates a variable that can only be accessed from inside the link:../../../structure/control-structure/for[`for`]-loop brackets. [%hardbreaks] -- From 9f8ef87ea8af6ce89dbb6a1ca41397ae25372d49 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Thu, 18 Jul 2019 23:35:41 +0530 Subject: [PATCH 082/298] Update bool.adoc --- Language/Variables/Data Types/bool.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/bool.adoc b/Language/Variables/Data Types/bool.adoc index 27f66d74b..6145dab3a 100644 --- a/Language/Variables/Data Types/bool.adoc +++ b/Language/Variables/Data Types/bool.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -A `bool` holds one of two values, `true` or `false`. (Each `bool` variable occupies one byte of memory.) +A `bool` holds one of two values, `link:../../constants/constants[true]` or `link:../../constants/constants[false]`. (Each `bool` variable occupies one byte of memory.) [%hardbreaks] From e0b55b2aee1d9ec13d8e1a141fc8af96f5a18a71 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Thu, 18 Jul 2019 23:43:18 +0530 Subject: [PATCH 083/298] Update boolean.adoc --- Language/Variables/Data Types/boolean.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/boolean.adoc b/Language/Variables/Data Types/boolean.adoc index 241799121..9815916e7 100644 --- a/Language/Variables/Data Types/boolean.adoc +++ b/Language/Variables/Data Types/boolean.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -`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. +`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 link:../../../variables/data-types/bool[`bool`], which is identical. [%hardbreaks] From 379a4655776d46f6e6092b2fbf3a894085a91226 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Thu, 18 Jul 2019 23:46:27 +0530 Subject: [PATCH 084/298] Update char.adoc --- Language/Variables/Data Types/char.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Data Types/char.adoc b/Language/Variables/Data Types/char.adoc index 7244a893a..18a36b400 100644 --- a/Language/Variables/Data Types/char.adoc +++ b/Language/Variables/Data Types/char.adoc @@ -14,9 +14,9 @@ subCategories: [ "Data Types" ] === Description A data type used to store a character value. Character literals are written in single quotes, like this: 'A' (for multiple characters - strings - use double quotes: "ABC"). -Characters are stored as numbers however. You can see the specific encoding in the link:https://www.arduino.cc/en/Reference/ASCIIchart[ASCII chart]. This means that it is possible to do arithmetic on characters, in which the ASCII value of the character is used (e.g. 'A' + 1 has the value 66, since the ASCII value of the capital letter A is 65). See link:../../../functions/communication/serial/println[`Serial.println`] reference for more on how characters are translated to numbers. +Characters are stored as numbers however. You can see the specific encoding in the link:https://www.arduino.cc/en/Reference/ASCIIchart[ASCII chart]. This means that it is possible to do arithmetic on characters, in which the ASCII value of the character is used (e.g. 'A' + 1 has the value 66, since the ASCII value of the capital letter A is 65). See `link:../../../functions/communication/serial/println[Serial.println]` reference for more on how characters are translated to numbers. -The size of the `char` datatype is at least 8 bits. It's recommended to only use `char` for storing characters. For an unsigned, one-byte (8 bit) data type, use the link:../byte[byte] data type. +The size of the `char` datatype is at least 8 bits. It's recommended to only use `char` for storing characters. For an unsigned, one-byte (8 bit) data type, use the `link:../byte[byte]` data type. [%hardbreaks] From 0f9f6fae4b8fc5728289af944be223305e585a4f Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Thu, 18 Jul 2019 23:54:05 +0530 Subject: [PATCH 085/298] Update size_t.adoc --- Language/Variables/Data Types/size_t.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/size_t.adoc b/Language/Variables/Data Types/size_t.adoc index 7c772af14..daadd550e 100644 --- a/Language/Variables/Data Types/size_t.adoc +++ b/Language/Variables/Data Types/size_t.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -`size_t` is a data type capable of representing the size of any object in bytes. Examples of the use of `size_t` are the return type of link:../../utilities/sizeof[sizeof()] and link:../../../functions/communication/serial/print[Serial.print()]. +`size_t` is a data type capable of representing the size of any object in bytes. Examples of the use of `size_t` are the return type of `link:../../utilities/sizeof[sizeof()]` and `link:../../../functions/communication/serial/print[Serial.print()]`. [%hardbreaks] From 3d029eada6c3db1e23cf13653233faef323f10f5 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Thu, 18 Jul 2019 23:58:14 +0530 Subject: [PATCH 086/298] Update string.adoc --- Language/Variables/Data Types/string.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Data Types/string.adoc b/Language/Variables/Data Types/string.adoc index 9273f9c9e..d05e3bae2 100644 --- a/Language/Variables/Data Types/string.adoc +++ b/Language/Variables/Data Types/string.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -Text strings can be represented in two ways. you can use the String data type, which is part of the core as of version 0019, or you can make a string out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the link:../stringobject[String object] page. +Text strings can be represented in two ways. you can use the String data type, which is part of the core as of version 0019, or you can make a string out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the `link:../stringobject[String object]` page. [%hardbreaks] [float] @@ -37,7 +37,7 @@ All of the following are valid declarations for strings. *Null termination* -Generally, strings are terminated with a null character (ASCII code 0). This allows functions (like `Serial.print()`) to tell where the end of a string is. Otherwise, they would continue reading subsequent bytes of memory that aren't actually part of the string. +Generally, strings are terminated with a null character (ASCII code 0). This allows functions (like `link:../../../functions/communication/serial/print[Serial.print()]`) to tell where the end of a string is. Otherwise, they would continue reading subsequent bytes of memory that aren't actually part of the string. This means that your string needs to have space for one more character than the text you want it to contain. That is why Str2 and Str5 need to be eight characters, even though "arduino" is only seven - the last position is automatically filled with a null character. Str4 will be automatically sized to eight characters, one for the extra null. In Str3, we've explicitly included the null character (written '\0') ourselves. @@ -62,7 +62,7 @@ char myString[] = "This is the first line" It is often convenient, when working with large amounts of text, such as a project with an LCD display, to setup an array of strings. Because strings themselves are arrays, this is actually an example of a two-dimensional array. -In the code below, the asterisk after the datatype `char` "`char*`" indicates that this is an array of "`pointers`". All array names are actually pointers, so this is required to make an array of arrays. Pointers are one of the more esoteric parts of C++ for beginners to understand, but it isn't necessary to understand pointers in detail to use them effectively here. +In the code below, the asterisk after the datatype `link:../char[char]` "`char*`" indicates that this is an array of "`pointers`". All array names are actually pointers, so this is required to make an array of arrays. Pointers are one of the more esoteric parts of C++ for beginners to understand, but it isn't necessary to understand pointers in detail to use them effectively here. -- // OVERVIEW SECTION ENDS From 76d24fae744a439747dfe1f392262b5374688819 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Fri, 19 Jul 2019 00:00:11 +0530 Subject: [PATCH 087/298] Update unsignedChar.adoc --- Language/Variables/Data Types/unsignedChar.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Data Types/unsignedChar.adoc b/Language/Variables/Data Types/unsignedChar.adoc index 9225c34af..fe554cd43 100644 --- a/Language/Variables/Data Types/unsignedChar.adoc +++ b/Language/Variables/Data Types/unsignedChar.adoc @@ -12,11 +12,11 @@ subCategories: [ "Data Types" ] [float] === Description -An unsigned data type that occupies 1 byte of memory. Same as the link:../byte[byte] datatype. +An unsigned data type that occupies 1 byte of memory. Same as the `link:../byte[byte]` datatype. The unsigned char datatype encodes numbers from 0 to 255. -For consistency of Arduino programming style, the byte data type is to be preferred. +For consistency of Arduino programming style, the link:../byte[`byte`] data type is to be preferred. [%hardbreaks] From 11e82a2ce1a3a29d80100e4819248e2f5f1adaab Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sat, 20 Jul 2019 12:38:41 +0530 Subject: [PATCH 088/298] Code Highlight markup and Link colouration fix int.adoc (#678) Co-Authored-By: per1234 --- Language/Variables/Data Types/int.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Data Types/int.adoc b/Language/Variables/Data Types/int.adoc index 12d8d52c5..f9e2b9310 100644 --- a/Language/Variables/Data Types/int.adoc +++ b/Language/Variables/Data Types/int.adoc @@ -20,7 +20,7 @@ On the Arduino Due and SAMD based boards (like MKR1000 and Zero), an int stores int's store negative numbers with a technique called (http://en.wikipedia.org/wiki/2%27s_complement[2's complement math]). The highest bit, sometimes referred to as the "sign" bit, flags the number as a negative number. The rest of the bits are inverted and 1 is added. -The Arduino takes care of dealing with negative numbers for you, so that arithmetic operations work transparently in the expected manner. There can be an unexpected complication in dealing with the link:../../../structure/bitwise-operators/bitshiftright[bitshift right operator] (>>) however. +The Arduino takes care of dealing with negative numbers for you, so that arithmetic operations work transparently in the expected manner. There can be an unexpected complication in dealing with the link:../../../structure/bitwise-operators/bitshiftright[bitshift right operator] (`>>`) however. [%hardbreaks] @@ -67,7 +67,7 @@ void loop() { [float] === Notes and Warnings -When signed variables are made to exceed their maximum or minimum capacity they _overflow_. The result of an overflow is unpredictable so this should be avoided. A typical symptom of an overflow is the variable "rolling over" from its maximum capacity to its minimum or vice versa, but this is not always the case. If you want this behavior, use link:../unsignedint[unsigned int]. +When signed variables are made to exceed their maximum or minimum capacity they _overflow_. The result of an overflow is unpredictable so this should be avoided. A typical symptom of an overflow is the variable "rolling over" from its maximum capacity to its minimum or vice versa, but this is not always the case. If you want this behavior, use `link:../unsignedint[unsigned int]`. -- From a2145ed9e10fed9ad8c98f8571c2444e8420b506 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 21 Jul 2019 23:14:36 +0530 Subject: [PATCH 089/298] Update sizeof.adoc --- Language/Variables/Utilities/sizeof.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Utilities/sizeof.adoc b/Language/Variables/Utilities/sizeof.adoc index d40f4d2b7..ecf4c45ec 100644 --- a/Language/Variables/Utilities/sizeof.adoc +++ b/Language/Variables/Utilities/sizeof.adoc @@ -66,7 +66,7 @@ void loop() { [float] === Notes and Warnings -Note that `sizeof` returns the total number of bytes. So for arrays of larger variable types such as ints, the for loop would look something like this. +Note that `sizeof` returns the total number of bytes. So for arrays of larger variable types such as link:../../data-types/int[`int`]s, the for loop would look something like this. [source,arduino] ---- From 33b18990fa517f479923a00f69c1586f60a27269 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 21 Jul 2019 23:33:49 +0530 Subject: [PATCH 090/298] Update loop.adoc --- Language/Structure/Sketch/loop.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Sketch/loop.adoc b/Language/Structure/Sketch/loop.adoc index 8586e44c0..a9261c1d2 100644 --- a/Language/Structure/Sketch/loop.adoc +++ b/Language/Structure/Sketch/loop.adoc @@ -17,7 +17,7 @@ subCategories: [ "Sketch" ] [float] === Description -After creating a link:../setup[setup()] function, which initializes and sets the initial values, the `loop()` function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board. +After creating a `link:../setup[setup()]` function, which initializes and sets the initial values, the `loop()` function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board. [%hardbreaks] -- From a2ba289895bcb886bd37d8b4767183754d3fb6b7 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 21 Jul 2019 23:41:57 +0530 Subject: [PATCH 091/298] Update define.adoc --- Language/Structure/Further Syntax/define.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Further Syntax/define.adoc b/Language/Structure/Further Syntax/define.adoc index 3f65ce054..561a6d7e8 100644 --- a/Language/Structure/Further Syntax/define.adoc +++ b/Language/Structure/Further Syntax/define.adoc @@ -24,7 +24,7 @@ subCategories: [ "Further Syntax" ] This can have some unwanted side effects though, if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text). [%hardbreaks] -In general, the link:../../../variables/variable-scope\--qualifiers/const[const] keyword is preferred for defining constants and should be used instead of #define. +In general, the `link:../../../variables/variable-scope\--qualifiers/const[const]` keyword is preferred for defining constants and should be used instead of `#define`. [%hardbreaks] [float] From 9da0e7dbd5cbdc2dcf95615150da123fd7ad6da5 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 21 Jul 2019 23:44:27 +0530 Subject: [PATCH 092/298] Update include.adoc --- Language/Structure/Further Syntax/include.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Further Syntax/include.adoc b/Language/Structure/Further Syntax/include.adoc index f2fb9db86..e4020e65e 100644 --- a/Language/Structure/Further Syntax/include.adoc +++ b/Language/Structure/Further Syntax/include.adoc @@ -24,7 +24,7 @@ subCategories: [ "Further Syntax" ] The main reference page for AVR C libraries (AVR is a reference to the Atmel chips on which the Arduino is based) is http://www.nongnu.org/avr-libc/user-manual/modules.html[here^]. [%hardbreaks] -Note that `#include`, similar to link:../define[`#define`], has no semicolon terminator, and the compiler will yield cryptic error messages if you add one. +Note that `#include`, similar to `link:../define[#define]`, has no semicolon terminator, and the compiler will yield cryptic error messages if you add one. [%hardbreaks] -- From fd5ce3367801bf9ae82b1bf5b4b6884728770a8c Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 21 Jul 2019 23:48:06 +0530 Subject: [PATCH 093/298] Update break.adoc --- Language/Structure/Control Structure/break.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Structure/Control Structure/break.adoc b/Language/Structure/Control Structure/break.adoc index 63bb798ca..493845ef5 100644 --- a/Language/Structure/Control Structure/break.adoc +++ b/Language/Structure/Control Structure/break.adoc @@ -18,7 +18,7 @@ subCategories: [ "Control Structure" ] [float] === Description [%hardbreaks] -`break` is used to exit from a link:../for[for], link:../while[while] or link:../dowhile[do...while] loop, bypassing the normal loop condition. It is also used to exit from a link:../switchcase[switch case] statement. +`break` is used to exit from a `link:../for[for]`, `link:../while[while]` or `link:../dowhile[do...while]` loop, bypassing the normal loop condition. It is also used to exit from a `link:../switchcase[switch case]` statement. [%hardbreaks] -- @@ -32,7 +32,7 @@ subCategories: [ "Control Structure" ] -- [float] === Example Code -In the following code, the control exits the `for` loop when the sensor value exceeds the threshold. +In the following code, the control exits the link:../for[`for`] loop when the sensor value exceeds the threshold. [source,arduino] ---- int threshold = 40; From d201ead9d95578bc47358f1b4f672808b23e9920 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 21 Jul 2019 23:49:55 +0530 Subject: [PATCH 094/298] Update continue.adoc --- Language/Structure/Control Structure/continue.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/continue.adoc b/Language/Structure/Control Structure/continue.adoc index 505a28679..9c7a368e4 100644 --- a/Language/Structure/Control Structure/continue.adoc +++ b/Language/Structure/Control Structure/continue.adoc @@ -18,7 +18,7 @@ subCategories: [ "Control Structure" ] [float] === Description [%hardbreaks] -The `continue` statement skips the rest of the current iteration of a loop (link:../for[for], link:../while[while], or link:../dowhile[do...while]). It continues by checking the conditional expression of the loop, and proceeding with any subsequent iterations. +The `continue` statement skips the rest of the current iteration of a loop (`link:../for[for]`, `link:../while[while]`, or `link:../dowhile[do...while]`). It continues by checking the conditional expression of the loop, and proceeding with any subsequent iterations. [%hardbreaks] -- From 2374de321aa6e09e251ecc0e37b25028cb85eec6 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Sun, 21 Jul 2019 23:55:13 +0530 Subject: [PATCH 095/298] Update doWhile.adoc --- Language/Structure/Control Structure/doWhile.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Structure/Control Structure/doWhile.adoc b/Language/Structure/Control Structure/doWhile.adoc index 672ff5919..c79421917 100644 --- a/Language/Structure/Control Structure/doWhile.adoc +++ b/Language/Structure/Control Structure/doWhile.adoc @@ -18,7 +18,7 @@ subCategories: [ "Control Structure" ] [float] === Description [%hardbreaks] -The `do...while` loop works in the same manner as the link:../while[while] loop, with the exception that the condition is tested at the end of the loop, so the do loop will always run at least once. +The `do...while` loop works in the same manner as the `link:../while[while]` loop, with the exception that the condition is tested at the end of the loop, so the do loop will always run at least once. [float] === Syntax @@ -32,7 +32,7 @@ do { [float] === Parameters -`condition`: a boolean expression that evaluates to `true` or `false`. +`condition`: a boolean expression that evaluates to `link:../../../variables/constants/constants[true]` or `link:../../../variables/constants/constants[false]`. -- // OVERVIEW SECTION ENDS From 5f5ea46dfc75447220e22a430771ac0ca7da6b1b Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 22 Jul 2019 00:03:01 +0530 Subject: [PATCH 096/298] Update else.adoc #546 Line 16: **Grouped together** creates a tautology --- Language/Structure/Control Structure/else.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 91580ad85..769e9d965 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -13,7 +13,7 @@ subCategories: [ "Control Structure" ] [float] === Description -The `if...else` allows greater control over the flow of code than the basic link:../if[if] statement, by allowing multiple tests to be grouped together. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can proceed another `if` test, so that multiple, mutually exclusive tests can be run at the same time. +The `if...else` allows greater control over the flow of code than the basic `link:../if[if]` statement, by allowing multiple tests to be grouped. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can proceed another `if` test, so that multiple, mutually exclusive tests can be run at the same time. [%hardbreaks] Each test will proceed to the next one until a true test is encountered. When a true test is found, its associated block of code is run, and the program then skips to the line following the entire if/else construction. If no test proves to be true, the default `else` block is executed, if one is present, and sets the default behavior. From 0907e9af9607f4234e1f380ee2a14a95694fbb9d Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 22 Jul 2019 11:37:27 +0530 Subject: [PATCH 097/298] Code Highlight markup and Link colouration fix for.adoc (#692) Co-Authored-By: per1234 --- Language/Structure/Control Structure/for.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index ef56739ba..a2410a4da 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -34,8 +34,8 @@ for (initialization; condition; increment) { [float] === Parameters `initialization`: happens first and exactly once. + -`condition`: each time through the loop, `condition` is tested; if it's `true`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `false`, the loop ends. + -`increment`: executed each time through the loop when `contition` is true. +`condition`: each time through the loop, `condition` is tested; if it's `link:../../../variables/constants/constants[true]`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `link:../../../variables/constants/constants[false]`, the loop ends. + +`increment`: executed each time through the loop when `contition` is link:../../../variables/constants/constants[`true`]. -- // OVERVIEW SECTION ENDS From 227ecc2d1f2ee5674c1fce1331400be7ac9c5776 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 23 Jul 2019 21:01:35 +0530 Subject: [PATCH 098/298] Update for.adoc --- Language/Structure/Control Structure/for.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index a2410a4da..7e02a21f7 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -35,7 +35,7 @@ for (initialization; condition; increment) { === Parameters `initialization`: happens first and exactly once. + `condition`: each time through the loop, `condition` is tested; if it's `link:../../../variables/constants/constants[true]`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `link:../../../variables/constants/constants[false]`, the loop ends. + -`increment`: executed each time through the loop when `contition` is link:../../../variables/constants/constants[`true`]. +`increment`: executed each time through the loop when `condition` is link:../../../variables/constants/constants[`true`]. -- // OVERVIEW SECTION ENDS @@ -69,7 +69,7 @@ void loop() { [float] === Notes and Warnings -The C++ `for` loop is much more flexible than `for` loops found in some other computer languages, including BASIC. Any or all of the three header elements may be omitted, although the semicolons are required. Also the statements for initialization, condition, and increment can be any valid C++ statements with unrelated variables, and use any C++ datatypes including floats. These types of unusual `for` statements may provide solutions to some rare programming problems. +The pass:[C++] `for` loop is much more flexible than `for` loops found in some other computer languages, including BASIC. Any or all of the three header elements may be omitted, although the semicolons are required. Also the statements for initialization, condition, and increment can be any valid pass:[C++] statements with unrelated variables, and use any pass:[C++] datatypes including floats. These types of unusual `for` statements may provide solutions to some rare programming problems. [%hardbreaks] For example, using a multiplication in the increment line will generate a logarithmic progression: From 53e1e95934306639b890223f0d0f01f7941a6b29 Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Tue, 30 Jul 2019 15:53:42 +0530 Subject: [PATCH 099/298] Update Language/Variables/Data Types/string.adoc Co-Authored-By: per1234 --- Language/Variables/Data Types/string.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/string.adoc b/Language/Variables/Data Types/string.adoc index d05e3bae2..c19ab743e 100644 --- a/Language/Variables/Data Types/string.adoc +++ b/Language/Variables/Data Types/string.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -Text strings can be represented in two ways. you can use the String data type, which is part of the core as of version 0019, or you can make a string out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the `link:../stringobject[String object]` page. +Text strings can be represented in two ways. you can use the String data type, which is part of the core as of version 0019, or you can make a string out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the link:../stringobject[String object] page. [%hardbreaks] [float] From 449050909367a689ca06054d2cf22adf0906837f Mon Sep 17 00:00:00 2001 From: Animesh Srivastava Date: Mon, 5 Aug 2019 18:38:05 +0530 Subject: [PATCH 100/298] Update bitSet.adoc Fixed typo related to the correct position of the content. Ref: https://github.com/arduino/reference-hi/pull/56 (Made changes to the Hindi Version too). --- Language/Functions/Bits and Bytes/bitSet.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bitSet.adoc b/Language/Functions/Bits and Bytes/bitSet.adoc index 522de02e8..d5c49a018 100644 --- a/Language/Functions/Bits and Bytes/bitSet.adoc +++ b/Language/Functions/Bits and Bytes/bitSet.adoc @@ -12,12 +12,12 @@ subCategories: [ "Bits and Bytes" ] // OVERVIEW SECTION STARTS -Sets (writes a 1 to) a bit of a numeric variable. [#overview] -- [float] === Description +Sets (writes a 1 to) a bit of a numeric variable. [%hardbreaks] From a85dca10e5650c39b0d98875e5dbf575f9ff20d3 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Fri, 30 Aug 2019 22:25:33 +0200 Subject: [PATCH 101/298] Update readBytesUntil.adoc As a side note, a function readBytesTill() which also copies the supplied terminator into the array (assuming it fits) would be convenient to add as it does allow to distinguish a time-out from a termination detection. --- Language/Functions/Communication/Serial/readBytesUntil.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index 103ea47d7..8a378edd5 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -49,7 +49,7 @@ Data type: `size_t`. [float] === Notes and Warnings -The terminator character is discarded from the serial buffer. +The terminator character is discarded from the serial buffer, unless the return value equals `length`. If the return value is less than `length`, it cannot be determined whether this is due to a time-out or due to the detection of the supplied terminator. [%hardbreaks] -- From f77108922493b9b234fe8fa3413f278763eea008 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Sat, 31 Aug 2019 19:00:28 +0200 Subject: [PATCH 102/298] Update millis.adoc Use of millis() may become unreliable if timer0 is reprogrammed, so a small warning might be useful that timer0 is used by millis(). --- Language/Functions/Time/millis.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index d031efded..dbc70ff54 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -64,7 +64,7 @@ void loop() { [float] === Notes and Warnings -Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. +Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. millis() uses timer0's overflow interrupt. -- // HOW TO USE SECTION ENDS From 7a0036abd0f025c4f4b7ab3248aa766f444a0b15 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Sat, 31 Aug 2019 19:04:08 +0200 Subject: [PATCH 103/298] Update readBytesUntil.adoc Added note that millis()/timer0 is being used. --- Language/Functions/Communication/Serial/readBytesUntil.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index 8a378edd5..01735e09b 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -49,7 +49,7 @@ Data type: `size_t`. [float] === Notes and Warnings -The terminator character is discarded from the serial buffer, unless the return value equals `length`. If the return value is less than `length`, it cannot be determined whether this is due to a time-out or due to the detection of the supplied terminator. +The terminator character is discarded from the serial buffer, unless the return value equals `length`. If the return value is less than `length`, it cannot be determined whether this is due to a time-out or due to the detection of the supplied terminator. This function relies on millis() which uses timer0's overflow interrupt. [%hardbreaks] -- From 3beb8eb66d8e22f30084a56acced666c57c40e8c Mon Sep 17 00:00:00 2001 From: SeppPenner Date: Tue, 3 Sep 2019 08:09:53 +0200 Subject: [PATCH 104/298] Fixed wrong double quotes in examples. --- Language/Functions/Communication/Serial/print.adoc | 2 +- Language/Functions/Communication/Serial/write.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index e43fa2665..eb2d5732f 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -34,7 +34,7 @@ An optional second parameter specifies the base (format) to use; permitted value You can pass flash-memory based strings to `_Serial_.print()` by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example: -`Serial.print(F(“Hello World”))` +`Serial.print(F("Hello World"))` To send data without conversion to its representation as characters, use link:../write[Serial.write()]. [%hardbreaks] diff --git a/Language/Functions/Communication/Serial/write.adoc b/Language/Functions/Communication/Serial/write.adoc index 494d2210b..aa2117dfb 100644 --- a/Language/Functions/Communication/Serial/write.adoc +++ b/Language/Functions/Communication/Serial/write.adoc @@ -58,7 +58,7 @@ void setup() { void loop() { Serial.write(45); // send a byte with the value 45 - int bytesSent = Serial.write(“hello”); //send the string “hello” and return the length of the string. + int bytesSent = Serial.write("hello"); //send the string "hello" and return the length of the string. } ---- [%hardbreaks] From 19fefd682e77eddebdea35c9668cf35307bedc68 Mon Sep 17 00:00:00 2001 From: Robert Zacharias Date: Tue, 3 Sep 2019 22:24:32 -0400 Subject: [PATCH 105/298] removed unspaced pluralization of data type (bytes) which caused MD parse error --- Language/Functions/Communication/Serial/readBytesUntil.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index 103ea47d7..efe33829b 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -31,7 +31,7 @@ Serial.readBytesUntil() reads characters from the serial buffer into an array. T === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + `character`: the character to search for. Allowed data types: `char`. + -`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`s. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. From fccb00e7bc0afd2a518e922fa926efee12d00f01 Mon Sep 17 00:00:00 2001 From: SeppPenner Date: Wed, 4 Sep 2019 08:52:16 +0200 Subject: [PATCH 106/298] Fixed markdown errors with chars after a code block. --- Language/Functions/Communication/Serial/readBytes.adoc | 2 +- Language/Functions/Communication/Serial/readBytesUntil.adoc | 2 +- Language/Functions/Communication/Stream/streamReadBytes.adoc | 2 +- .../Functions/Communication/Stream/streamReadBytesUntil.adoc | 2 +- Language/Variables/Data Types/String/Functions/getBytes.adoc | 2 +- Language/Variables/Data Types/String/Functions/toCharArray.adoc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Language/Functions/Communication/Serial/readBytes.adoc b/Language/Functions/Communication/Serial/readBytes.adoc index ef2ccc739..581e0620f 100644 --- a/Language/Functions/Communication/Serial/readBytes.adoc +++ b/Language/Functions/Communication/Serial/readBytes.adoc @@ -30,7 +30,7 @@ title: Serial.readBytes() [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + -`buffer`: the buffer to store the bytes in. Allowed data types: or array of `char` or `byte`s. + +`buffer`: the buffer to store the bytes in. Allowed data types: or array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index 103ea47d7..efe33829b 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -31,7 +31,7 @@ Serial.readBytesUntil() reads characters from the serial buffer into an array. T === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + `character`: the character to search for. Allowed data types: `char`. + -`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`s. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. diff --git a/Language/Functions/Communication/Stream/streamReadBytes.adoc b/Language/Functions/Communication/Stream/streamReadBytes.adoc index f519027d2..fd24d1a85 100644 --- a/Language/Functions/Communication/Stream/streamReadBytes.adoc +++ b/Language/Functions/Communication/Stream/streamReadBytes.adoc @@ -30,7 +30,7 @@ This function is part of the Stream class, and can be called by any class that i [float] === Parameters `stream`: an instance of a class that inherits from Stream. + -`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`s. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. diff --git a/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc b/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc index fad3dfa5f..1baf1ff02 100644 --- a/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc @@ -31,7 +31,7 @@ This function is part of the Stream class, and can be called by any class that i === Parameters `stream`: an instance of a class that inherits from Stream. + `character`: the character to search for. Allowed data types: `char`. + -`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`s. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. diff --git a/Language/Variables/Data Types/String/Functions/getBytes.adoc b/Language/Variables/Data Types/String/Functions/getBytes.adoc index ac758819e..b1a08409c 100644 --- a/Language/Variables/Data Types/String/Functions/getBytes.adoc +++ b/Language/Variables/Data Types/String/Functions/getBytes.adoc @@ -30,7 +30,7 @@ Copies the String's characters to the supplied buffer. [float] === Parameters `myString`: a variable of type `String`. + -`buf`: the buffer to copy the characters into. Allowed data types: array of `byte`s. + +`buf`: the buffer to copy the characters into. Allowed data types: array of `byte`. + `len`: the size of the buffer. Allowed data types: `unsigned int`. diff --git a/Language/Variables/Data Types/String/Functions/toCharArray.adoc b/Language/Variables/Data Types/String/Functions/toCharArray.adoc index c0c24ace6..95bf3c909 100644 --- a/Language/Variables/Data Types/String/Functions/toCharArray.adoc +++ b/Language/Variables/Data Types/String/Functions/toCharArray.adoc @@ -30,7 +30,7 @@ Copies the String's characters to the supplied buffer. [float] === Parameters `myString`: a variable of type `String`. + -`buf`: the buffer to copy the characters into. Allowed data types: array of `char`s. + +`buf`: the buffer to copy the characters into. Allowed data types: array of `char`. + `len`: the size of the buffer. Allowed data types: `unsigned int`. From ca43a1d67acc8e1b1b17f6cf68ed155395c447cf Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Thu, 5 Sep 2019 21:50:08 +0200 Subject: [PATCH 107/298] Update readBytesUntil.adoc --- Language/Functions/Communication/Serial/readBytesUntil.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index 01735e09b..f2345abab 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -14,9 +14,9 @@ title: Serial.readBytesUntil() [float] === Description -Serial.readBytesUntil() reads characters from the serial buffer into an array. The function terminates if the terminator character is detected, the determined length has been read, or it times out (see link:../settimeout[Serial.setTimeout()]). The function returns the characters up to the last character before the supplied terminator. The terminator itself is not returned in the buffer. +Serial.readBytesUntil() reads characters from the serial buffer into an array. The function terminates (checks being done in this order) if the determined length has been read, if it times out (see link:../settimeout[Serial.setTimeout()]), or if the terminator character is detected, in which case the function returns the characters up to the last character before the supplied terminator. The terminator itself is not returned in the buffer. -`Serial.readBytesUntil()` returns the number of characters read into the buffer. A 0 means no valid data was found. +`Serial.readBytesUntil()` returns the number of characters read into the buffer. A 0 means that supplied length < = 0, a time out occured, or a termination character was found before any other input. `Serial.readBytesUntil()` inherits from the link:../../stream[Stream] utility class. [%hardbreaks] @@ -49,7 +49,7 @@ Data type: `size_t`. [float] === Notes and Warnings -The terminator character is discarded from the serial buffer, unless the return value equals `length`. If the return value is less than `length`, it cannot be determined whether this is due to a time-out or due to the detection of the supplied terminator. This function relies on millis() which uses timer0's overflow interrupt. +The terminator character is discarded from the serial buffer, unless the number of characters read and copied into the buffer equals `length`. [%hardbreaks] -- From 07ceebbccd6b926e2470848ad9df49c6be121179 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Thu, 5 Sep 2019 22:07:16 +0200 Subject: [PATCH 108/298] Update readBytesUntil.adoc --- Language/Functions/Communication/Serial/readBytesUntil.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index f2345abab..75fed5449 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -16,7 +16,7 @@ title: Serial.readBytesUntil() === Description Serial.readBytesUntil() reads characters from the serial buffer into an array. The function terminates (checks being done in this order) if the determined length has been read, if it times out (see link:../settimeout[Serial.setTimeout()]), or if the terminator character is detected, in which case the function returns the characters up to the last character before the supplied terminator. The terminator itself is not returned in the buffer. -`Serial.readBytesUntil()` returns the number of characters read into the buffer. A 0 means that supplied length < = 0, a time out occured, or a termination character was found before any other input. +`Serial.readBytesUntil()` returns the number of characters read into the buffer. A 0 means that supplied length < = 0, or that a time out occured or a termination character was found before any other input. `Serial.readBytesUntil()` inherits from the link:../../stream[Stream] utility class. [%hardbreaks] From 221ef38c0ce8af4f00d294ccdc3f80851cec64c8 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Fri, 6 Sep 2019 07:47:53 +0200 Subject: [PATCH 109/298] Updated "0 value" description --- Language/Functions/Communication/Serial/readBytesUntil.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index 75fed5449..e6bada67f 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -14,9 +14,9 @@ title: Serial.readBytesUntil() [float] === Description -Serial.readBytesUntil() reads characters from the serial buffer into an array. The function terminates (checks being done in this order) if the determined length has been read, if it times out (see link:../settimeout[Serial.setTimeout()]), or if the terminator character is detected, in which case the function returns the characters up to the last character before the supplied terminator. The terminator itself is not returned in the buffer. +Serial.readBytesUntil() reads characters from the serial buffer into an array. The function terminates (checks being done in this order) if the determined length has been read, if it times out (see link:../settimeout[Serial.setTimeout()]), or if the terminator character is detected (in which case the function returns the characters up to the last character before the supplied terminator). The terminator itself is not returned in the buffer. -`Serial.readBytesUntil()` returns the number of characters read into the buffer. A 0 means that supplied length < = 0, or that a time out occured or a termination character was found before any other input. +`Serial.readBytesUntil()` returns the number of characters read into the buffer. A 0 means that the `length` parameter \<= 0, a time out occurred before any other input, or a termination character was found before any other input. `Serial.readBytesUntil()` inherits from the link:../../stream[Stream] utility class. [%hardbreaks] @@ -49,7 +49,7 @@ Data type: `size_t`. [float] === Notes and Warnings -The terminator character is discarded from the serial buffer, unless the number of characters read and copied into the buffer equals `length`. +The terminator character is discarded from the serial buffer, unless the number of characters read and copied into the buffer equals `length`. [%hardbreaks] -- From c1d6af8470f1d61dd7bb43dfb990be36bf919702 Mon Sep 17 00:00:00 2001 From: katerss1 <44533145+katerss1@users.noreply.github.com> Date: Sun, 22 Sep 2019 21:44:03 +0200 Subject: [PATCH 110/298] Fixed mistake You need to call pinMode() before calling analogWrite(); --- Language/Functions/Analog IO/analogWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 28daf1085..f90825358 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -36,7 +36,7 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C [%hardbreaks] -You do not need to call `pinMode()` to set the pin as an output before calling `analogWrite()`. +You do need to call `pinMode()` to set the pin as an output before calling `analogWrite()`. The `analogWrite` function has nothing to do with the analog pins or the `analogRead` function. [%hardbreaks] From f568231a46e1cbf2bf4fe49a7cda31063ac816da Mon Sep 17 00:00:00 2001 From: Dotan Cohen Date: Sun, 24 Nov 2019 13:11:59 +0200 Subject: [PATCH 111/298] Remove word that was incorrectly repeated twice. --- Language/Variables/Constants/constants.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Constants/constants.adoc b/Language/Variables/Constants/constants.adoc index 0e43ffacd..6bbff458b 100644 --- a/Language/Variables/Constants/constants.adoc +++ b/Language/Variables/Constants/constants.adoc @@ -74,7 +74,7 @@ Digital pins can be used as `INPUT`, `INPUT_PULLUP`, or `OUTPUT`. Changing a pin Arduino (ATmega) pins configured as `INPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`] are said to be in a _high-impedance_ state. Pins configured as `INPUT` make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor. [%hardbreaks] -If you have your pin configured as an `INPUT`, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not not draw too much current when the switch is closed. See the http://arduino.cc/en/Tutorial/DigitalReadSerial[Digital Read Serial^] tutorial for more information. +If you have your pin configured as an `INPUT`, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not draw too much current when the switch is closed. See the http://arduino.cc/en/Tutorial/DigitalReadSerial[Digital Read Serial^] tutorial for more information. [%hardbreaks] If a pull-down resistor is used, the input pin will be `LOW` when the switch is open and `HIGH` when the switch is closed. From 0650027f260782b4cbf0e1f859c769968d22cd56 Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Sun, 1 Dec 2019 09:27:43 +0100 Subject: [PATCH 112/298] Update volatile.adoc: Add explanation to examples This change also adds a visual separator between the two code blocks so it is clear that they do not belong together. --- Language/Variables/Variable Scope & Qualifiers/volatile.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc index 20fbd6fbd..19a699bda 100644 --- a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc @@ -55,6 +55,7 @@ There are several ways to do this: === Example Code // Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ +Use a `volatile byte` to store the pin state in a single byte: [source,arduino] ---- @@ -77,16 +78,19 @@ void blink() { } ---- +Use an atomic block for atomic access to a 16-bit `int`: [source,arduino] ---- #include // this library includes the ATOMIC_BLOCK macro. volatile int input_from_interrupt; +void loop() { ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { // code with interrupts blocked (consecutive atomic operations will not get interrupted) int result = input_from_interrupt; } +} ---- From 0291a63258efd79778a9aff2e4760ec77f901fef Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Dec 2019 02:57:46 -0800 Subject: [PATCH 113/298] Document interrupt pins for new Nano boards Document the pins that can be used with attachInterrupt() on the Nano Every/33 IoT/33 BLE/33 BLE Sense. --- Language/Functions/External Interrupts/attachInterrupt.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 2800a7208..0a618e52c 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -21,11 +21,13 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |=================================================== |Board |Digital Pins Usable For Interrupts |Uno, Nano, Mini, other 328-based |2, 3 -|Uno WiFi Rev.2 |all digital pins +|Uno WiFi Rev.2, Nano Every |all digital pins |Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 |Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7 |Zero |all digital pins, except 4 |MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2 +|Nano 33 IoT |2, 3, 9, 10, 11, 13, 15, A5, A7 +|Nano 33 BLE, Nano 33 BLE Sense |all pins |Due |all digital pins |101 |all digital pins (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*) |=================================================== From a239a516dd99bfdc6ab185604ac012443a82972e Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Sun, 8 Dec 2019 11:51:34 +0100 Subject: [PATCH 114/298] Update volatile.adoc: Add new code sample --- .../Variable Scope & Qualifiers/volatile.adoc | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc index 19a699bda..ecf5a5544 100644 --- a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc @@ -55,42 +55,52 @@ There are several ways to do this: === Example Code // Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ -Use a `volatile byte` to store the pin state in a single byte: +The `volatile` modifier ensures that changes to the `state` variable are immediately visible in `loop()`. Without the `volatile` modifier, the `state` variable would be loaded into a register when entering the function and would not be updated anymore until the function ends. [source,arduino] ---- -// toggles LED when interrupt pin changes state +// Flashes the LED for 1 s if the input has changed +// in the previous second. -int pin = 13; volatile byte state = LOW; void setup() { - pinMode(pin, OUTPUT); - attachInterrupt(digitalPinToInterrupt(2), blink, CHANGE); + pinMode(LED_BUILTIN, OUTPUT); + attachInterrupt(digitalPinToInterrupt(2), toggle, CHANGE); } void loop() { - digitalWrite(pin, state); + bool changedInTheMeantime = false; + + byte originalState = state; + delay(1000); + byte newState = state; + + if (newState != originalState) { + // toggle() has been called during delay(1000) + changedInTheMeantime = true; + } + + digitalWrite(LED_BUILTIN, changedInTheMeantime ? HIGH : LOW); } -void blink() { +void toggle() { state = !state; } ---- -Use an atomic block for atomic access to a 16-bit `int`: +To access a variable with size greater than the microcontroller’s 8-bit data bus, use the `ATOMIC_BLOCK` macro. The macro ensures that the variable is read in an atomic operation, i.e. its contents cannot be altered while it is being read. [source,arduino] ---- #include // this library includes the ATOMIC_BLOCK macro. volatile int input_from_interrupt; -void loop() { +// Somewhere in the code, e.g. inside loop() ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { // code with interrupts blocked (consecutive atomic operations will not get interrupted) int result = input_from_interrupt; } -} ---- From 9a838f50b8085d28b24f8aeceaa98f330818b92c Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Mon, 9 Dec 2019 15:40:30 +0100 Subject: [PATCH 115/298] Update print.adoc Changed a small error on line 33 --- Language/Functions/Communication/Serial/print.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index eb2d5732f..ff3cbe14a 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -30,7 +30,7 @@ An optional second parameter specifies the base (format) to use; permitted value * `_Serial_.print(78, HEX)` gives "4E" + * `_Serial_.print(1.23456, 0)` gives "1" + * `_Serial_.print(1.23456, 2)` gives "1.23" + -* `_Serial_.print(1.23456, 4)` gives "1.2346" +* `_Serial_.print(1.23456, 4)` gives "1.2345" You can pass flash-memory based strings to `_Serial_.print()` by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example: From 58ff37631b4af725a459fcc40fbcfc0a159f8be1 Mon Sep 17 00:00:00 2001 From: Vishnu Easwaran E <3790701+VishnuEaswaran@users.noreply.github.com> Date: Thu, 12 Dec 2019 11:57:33 +0530 Subject: [PATCH 116/298] [vishnu] typo corrected. --- Language/Functions/Communication/Serial/readBytes.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/readBytes.adoc b/Language/Functions/Communication/Serial/readBytes.adoc index 581e0620f..da566d64b 100644 --- a/Language/Functions/Communication/Serial/readBytes.adoc +++ b/Language/Functions/Communication/Serial/readBytes.adoc @@ -30,7 +30,7 @@ title: Serial.readBytes() [float] === Parameters `_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + -`buffer`: the buffer to store the bytes in. Allowed data types: or array of `char` or `byte`. + +`buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. From a6d6081ee6368250921ec7e44ffa63a3a10bc4d5 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 1 Jan 2020 02:39:27 -0800 Subject: [PATCH 117/298] Document PWM pins of Nano Every/33 IoT/BLE/BLE Sense I had to remove the integer literal representations of the An pins because they caused the Nano 33 IoT row to be excessively long. It's no loss because people should always use the An pin names anyway. --- Language/Functions/Analog IO/analogWrite.adoc | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 28daf1085..95402cba0 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -19,19 +19,21 @@ subCategories: [ "Analog I/O" ] === Description Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady rectangular wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. [options="header"] -|==================================================================================================== -| Board | PWM Pins | PWM Frequency -| Uno, Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) -| Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) -| Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) -| Uno WiFi Rev.2 | 3, 5, 6, 9, 10 | 976 Hz -| MKR boards * | 0 - 8, 10, A3 (18), A4 (19) | 732 Hz -| MKR1000 WiFi * | 0 - 8, 10, 11, A3 (18), A4 (19) | 732 Hz -| Zero * | 3 - 13, A0 (14), A1 (15) | 732 Hz -| Due ** | 2-13 | 1000 Hz -| 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz -|==================================================================================================== -{empty}* In addition to PWM capabilities on the pins noted above, the MKR and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + +|======================================================================================================== +| Board | PWM Pins | PWM Frequency +| Uno, Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) +| Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) +| Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) +| Uno WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz +| MKR boards * | 0 - 8, 10, A3, A4 | 732 Hz +| MKR1000 WiFi * | 0 - 8, 10, 11, A3, A4 | 732 Hz +| Zero * | 3 - 13, A0, A1 | 732 Hz +| Nano 33 IoT * | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz +| Nano 33 BLE/BLE Sense | 1 - 13, A0 - A7 | 500 Hz +| Due ** | 2-13 | 1000 Hz +| 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz +|======================================================================================================== +{empty}* In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + {empty}** In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. [%hardbreaks] From bfc67851272c3140bec119a31c6236bd7cbba0cc Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sat, 4 Jan 2020 23:42:38 +0100 Subject: [PATCH 118/298] exlamation -> exclamation --- Language/Functions/Characters/isPunct.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Characters/isPunct.adoc b/Language/Functions/Characters/isPunct.adoc index 001fd7588..7f9d159dd 100644 --- a/Language/Functions/Characters/isPunct.adoc +++ b/Language/Functions/Characters/isPunct.adoc @@ -17,7 +17,7 @@ subCategories: [ "Characters" ] [float] === Description -Analyse if a char is punctuation (that is a comma, a semicolon, an exlamation mark and so on). Returns true if thisChar is punctuation. +Analyse if a char is punctuation (that is a comma, a semicolon, an exclamation mark and so on). Returns true if thisChar is punctuation. [%hardbreaks] From 8a6879ba894a16401424f2e05182f82484061dc8 Mon Sep 17 00:00:00 2001 From: Adam Chyb Date: Mon, 3 Feb 2020 21:55:14 +1100 Subject: [PATCH 119/298] Fix method in readStringUntil example. --- .../Functions/Communication/Stream/streamReadStringUntil.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc index 971337a49..79b818a9d 100644 --- a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc @@ -22,7 +22,7 @@ This function is part of the Stream class, and can be called by any class that i [float] === Syntax -`stream.readString(terminator)` +`stream.readStringUntil(terminator)` [float] From fff3f9e9adfd56be6eaf2eb4b60dd142bbd70a79 Mon Sep 17 00:00:00 2001 From: Rajat Shinde Date: Mon, 27 Apr 2020 01:49:37 +0530 Subject: [PATCH 120/298] Update define.adoc --- Language/Structure/Further Syntax/define.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Structure/Further Syntax/define.adoc b/Language/Structure/Further Syntax/define.adoc index 561a6d7e8..78ad5676d 100644 --- a/Language/Structure/Further Syntax/define.adoc +++ b/Language/Structure/Further Syntax/define.adoc @@ -24,7 +24,7 @@ subCategories: [ "Further Syntax" ] This can have some unwanted side effects though, if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text). [%hardbreaks] -In general, the `link:../../../variables/variable-scope\--qualifiers/const[const]` keyword is preferred for defining constants and should be used instead of `#define`. +In general, the `link:../../variables/variable-scope-qualifiers/const[const]` keyword is preferred for defining constants and should be used instead of `#define`. [%hardbreaks] [float] @@ -88,8 +88,8 @@ Similarly, including an equal sign after the #define statement will also generat === See also [role="language"] -* #LANGUAGE# link:../../../variables/variable-scope\--qualifiers/const[const] -* #LANGUAGE# link:../../../variables/constants/constants[Constants] +* #LANGUAGE# link:../../variables/variable-scope-qualifiers/const[const] +* #LANGUAGE# link:../../variables/constants/constants[Constants] -- // SEE ALSO SECTION ENDS From 6a20121c4fcd43f4f04d0d46fa12c08c2eb21da5 Mon Sep 17 00:00:00 2001 From: AndyDHill Date: Tue, 28 Apr 2020 22:45:54 +0100 Subject: [PATCH 121/298] Update pulseIn.adoc Ammendment that picked up that if the optional parameter is used code operates faster. --- Language/Functions/Advanced IO/pulseIn.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Language/Functions/Advanced IO/pulseIn.adoc b/Language/Functions/Advanced IO/pulseIn.adoc index 964cb7a4f..1a34dc93e 100644 --- a/Language/Functions/Advanced IO/pulseIn.adoc +++ b/Language/Functions/Advanced IO/pulseIn.adoc @@ -20,6 +20,8 @@ subCategories: [ "Advanced I/O" ] Reads a pulse (either `HIGH` or `LOW`) on a pin. For example, if `value` is `HIGH`, `pulseIn()` waits for the pin to go from `LOW` to `HIGH`, starts timing, then waits for the pin to go `LOW` and stops timing. Returns the length of the pulse in microseconds or gives up and returns 0 if no complete pulse was received within the timeout. The timing of this function has been determined empirically and will probably show errors in longer pulses. Works on pulses from 10 microseconds to 3 minutes in length. + +NOTE: if the optional timeout is used code will execute faster. [%hardbreaks] From 341f158cb63a36fb3f6ebf34db1124369d23d09f Mon Sep 17 00:00:00 2001 From: Ashutosh Pandey Date: Tue, 23 Jun 2020 19:06:56 +0530 Subject: [PATCH 122/298] Added Example Code/ Notes and warnings There was no example code given, and the returns section was incorrect. The code was tested on Arduino Mega 2560. --- .../Functions/Bits and Bytes/bitClear.adoc | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bitClear.adoc b/Language/Functions/Bits and Bytes/bitClear.adoc index c81e359fe..ded704cf5 100644 --- a/Language/Functions/Bits and Bytes/bitClear.adoc +++ b/Language/Functions/Bits and Bytes/bitClear.adoc @@ -34,7 +34,7 @@ Clears (writes a 0 to) a bit of a numeric variable. [float] === Returns -Nothing +`x`: the value of the numeric variable after the bit at position `n` is cleared. -- // OVERVIEW SECTION ENDS @@ -45,6 +45,32 @@ Nothing -- [float] +=== Example Code +// Describe what the example code is all about and add relevant code +Prints the output of `bitClear(x,n)` on two given integers. The binary representation of 6 is 0110, so when `n=1`, the second bit from the right is set to 0. After this we are left with 0100 in binary, so 4 is returned. + +[source,arduino] +---- +void setup() +{ +Serial.begin(9600); +} + +void loop() +{ +int x = 6; int n = 1; //setting the value of x and n +Serial.print(bitClear(x,n)); //printing the output of the bitClear(x,n) +} +---- +[%hardbreaks] + +[float] +=== Notes and Warnings +The indexing of the rightmost bit starts from 0, so `n=1` clears the second bit from the right. If the bit at any given position is already zero, `x` is returned unchanged. + +Both `x` and `n` must be integers. + +-- === See also -- From c4a713be2b040457b4a0004adbe664ef96c87daa Mon Sep 17 00:00:00 2001 From: Sebastiaan Lokhorst Date: Mon, 13 Jul 2020 20:35:40 +0200 Subject: [PATCH 123/298] Add analogReference modes for the Arduino 33 BLE Found at https://github.com/arduino/ArduinoCore-mbed/blob/master/variants/ARDUINO_NANO33BLE/pins_arduino.h#L13 --- Language/Functions/Analog IO/analogReference.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index 31ae3d39c..4b6c97978 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -52,6 +52,13 @@ Arduino SAM Boards (Due) * AR_DEFAULT: the default analog reference of 3.3V. This is the only supported option for the Due. +Arduino mbed-enabled Boards (Nano 33 BLE only): only available when using the _Arduino mbed-enabled Boards_ platform, and not when using the _Arduino nRF528x Boards (Mbed OS)_ platform + +* AR_VDD: the default 3.3 V reference +* AR_INTERNAL: built-in 0.6 V reference +* AR_INTERNAL1V2: 1.2 V reference (internal 0.6 V reference with 2x gain) +* AR_INTERNAL2V4: 2.4 V reference (internal 0.6 V reference with 4x gain) + [%hardbreaks] From 309efcc052787c0e70af6d134823d609db401bf0 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 15 Jul 2020 05:53:01 -0700 Subject: [PATCH 124/298] Make markup valid The newly added content was placed inside the "See Also" section, which caused the generation process to fail: ERROR 2020/07/15 05:00:40 Language/Functions/Bits and Bytes/bitClear.adoc: asciidoctor: WARNING: : line 69: section title out of sequence: expected level 1, got level 2 ERROR 2020/07/15 05:00:40 Language/Functions/Bits and Bytes/bitClear.adoc: asciidoctor: WARNING: : line 71: unterminated open block --- Language/Functions/Bits and Bytes/bitClear.adoc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Bits and Bytes/bitClear.adoc b/Language/Functions/Bits and Bytes/bitClear.adoc index ded704cf5..ca7e9433f 100644 --- a/Language/Functions/Bits and Bytes/bitClear.adoc +++ b/Language/Functions/Bits and Bytes/bitClear.adoc @@ -40,8 +40,9 @@ Clears (writes a 0 to) a bit of a numeric variable. // OVERVIEW SECTION ENDS -// SEE ALSO SECTION -[#see_also] + +// HOW TO USE SECTION STARTS +[#howtouse] -- [float] @@ -67,10 +68,17 @@ Serial.print(bitClear(x,n)); //printing the output of the bitClear(x,n) [float] === Notes and Warnings The indexing of the rightmost bit starts from 0, so `n=1` clears the second bit from the right. If the bit at any given position is already zero, `x` is returned unchanged. +-- +// HOW TO USE SECTION ENDS + Both `x` and `n` must be integers. +// SEE ALSO SECTION +[#see_also] -- + +[float] === See also -- From 659c2928a4fb667718072be8694b96c44835cb38 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 15 Jul 2020 05:53:46 -0700 Subject: [PATCH 125/298] Standardize formatting of example code - Use the standard "Arduino sketch style" formatting. - Move the print to setup(), so it only happens once. --- Language/Functions/Bits and Bytes/bitClear.adoc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Language/Functions/Bits and Bytes/bitClear.adoc b/Language/Functions/Bits and Bytes/bitClear.adoc index ca7e9433f..b07259e44 100644 --- a/Language/Functions/Bits and Bytes/bitClear.adoc +++ b/Language/Functions/Bits and Bytes/bitClear.adoc @@ -52,15 +52,18 @@ Prints the output of `bitClear(x,n)` on two given integers. The binary represent [source,arduino] ---- -void setup() -{ -Serial.begin(9600); +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + int x = 6; + int n = 1; + Serial.print(bitClear(x, n)); // print the output of bitClear(x,n) } -void loop() -{ -int x = 6; int n = 1; //setting the value of x and n -Serial.print(bitClear(x,n)); //printing the output of the bitClear(x,n) +void loop() { } ---- [%hardbreaks] From 33656815efe05f5b770cc275b9b5ee1cb2820e67 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 15 Jul 2020 06:00:30 -0700 Subject: [PATCH 126/298] Remove "Notes and Warnings" section The zero-indexed nature of the macro is already documented in the parameters section. The handling of zeroed bits is already clear from the description. The requirement for the parameters to be integers seems fairly obvious to me, but I'm open to being convinced otherwise. However, if it is necessary to document the supported parameter types, that should be done in the parameters section, following the convention that has been established through the rest of the language reference content, so this part needs to be removed either way. --- Language/Functions/Bits and Bytes/bitClear.adoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Language/Functions/Bits and Bytes/bitClear.adoc b/Language/Functions/Bits and Bytes/bitClear.adoc index b07259e44..7c8594c8f 100644 --- a/Language/Functions/Bits and Bytes/bitClear.adoc +++ b/Language/Functions/Bits and Bytes/bitClear.adoc @@ -68,14 +68,10 @@ void loop() { ---- [%hardbreaks] -[float] -=== Notes and Warnings -The indexing of the rightmost bit starts from 0, so `n=1` clears the second bit from the right. If the bit at any given position is already zero, `x` is returned unchanged. -- // HOW TO USE SECTION ENDS -Both `x` and `n` must be integers. // SEE ALSO SECTION [#see_also] From 4f0339886df9ef05ad1f5451facc9210d1ee8b9f Mon Sep 17 00:00:00 2001 From: Ethan Tracy <49354012+EthanTracy@users.noreply.github.com> Date: Mon, 20 Jul 2020 17:24:41 +1000 Subject: [PATCH 127/298] Update analogReference.adoc Fixed a typo on line 25 --- Language/Functions/Analog IO/analogReference.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index 4b6c97978..e0fd3aed6 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -22,7 +22,7 @@ Configures the reference voltage used for analog input (i.e. the value used as t Arduino AVR Boards (Uno, Mega, Leonardo, etc.) * DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards) -* INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328P and 2.56 volts on the ATmega32U4 and ATmega8 (not available on the Arduino Mega) +* INTERNAL: a built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328P and 2.56 volts on the ATmega32U4 and ATmega8 (not available on the Arduino Mega) * INTERNAL1V1: a built-in 1.1V reference (Arduino Mega only) * INTERNAL2V56: a built-in 2.56V reference (Arduino Mega only) * EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference. From 2e9dc6a72c93ef163d034eb920b07e9d9e5a128f Mon Sep 17 00:00:00 2001 From: Max Reynolds Date: Mon, 3 Aug 2020 09:37:39 +0100 Subject: [PATCH 128/298] Update link, currently noTone is 404. --- Language/Functions/Advanced IO/tone.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 56c65bbc5..86b4c1af6 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -17,7 +17,7 @@ subCategories: [ "Advanced I/O" ] [float] === Description -Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until a call to link:../noTone[noTone()]. The pin can be connected to a piezo buzzer or other speaker to play tones. +Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until a call to link:../notone[noTone()]. The pin can be connected to a piezo buzzer or other speaker to play tones. Only one tone can be generated at a time. If a tone is already playing on a different pin, the call to `tone()` will have no effect. If the tone is playing on the same pin, the call will set its frequency. @@ -72,6 +72,7 @@ If you want to play different pitches on multiple pins, you need to call `noTone [role="language"] * #LANGUAGE# link:../../analog-io/analogwrite[analogWrite()] +* #LANGUAGE# link:../notone[noTone()] [role="example"] From 68880c635b63635d6f0a5fc64fad3efcea2d269d Mon Sep 17 00:00:00 2001 From: Max Reynolds Date: Mon, 3 Aug 2020 11:44:27 +0100 Subject: [PATCH 129/298] Remove language link Co-authored-by: per1234 --- Language/Functions/Advanced IO/tone.adoc | 1 - 1 file changed, 1 deletion(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 86b4c1af6..41e3f5031 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -72,7 +72,6 @@ If you want to play different pitches on multiple pins, you need to call `noTone [role="language"] * #LANGUAGE# link:../../analog-io/analogwrite[analogWrite()] -* #LANGUAGE# link:../notone[noTone()] [role="example"] From 1d606277e0b0083f192b5722b24c8468db29fdc4 Mon Sep 17 00:00:00 2001 From: Nick Slocum Date: Mon, 17 Aug 2020 08:21:13 -0400 Subject: [PATCH 130/298] Fix link to "const" reference page. --- Language/Structure/Further Syntax/define.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Further Syntax/define.adoc b/Language/Structure/Further Syntax/define.adoc index 561a6d7e8..df3f8c455 100644 --- a/Language/Structure/Further Syntax/define.adoc +++ b/Language/Structure/Further Syntax/define.adoc @@ -88,7 +88,7 @@ Similarly, including an equal sign after the #define statement will also generat === See also [role="language"] -* #LANGUAGE# link:../../../variables/variable-scope\--qualifiers/const[const] +* #LANGUAGE# link:../../../variables/variable-scope-qualifiers/const[const] * #LANGUAGE# link:../../../variables/constants/constants[Constants] -- From 67d08023ee7ee4149c9458ae748361cbed1ef013 Mon Sep 17 00:00:00 2001 From: Rajat Shinde Date: Mon, 17 Aug 2020 19:55:41 +0530 Subject: [PATCH 131/298] Update define.adoc --- Language/Structure/Further Syntax/define.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Structure/Further Syntax/define.adoc b/Language/Structure/Further Syntax/define.adoc index 78ad5676d..af9686072 100644 --- a/Language/Structure/Further Syntax/define.adoc +++ b/Language/Structure/Further Syntax/define.adoc @@ -24,7 +24,7 @@ subCategories: [ "Further Syntax" ] This can have some unwanted side effects though, if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text). [%hardbreaks] -In general, the `link:../../variables/variable-scope-qualifiers/const[const]` keyword is preferred for defining constants and should be used instead of `#define`. +In general, the `link:../../../variables/variable-scope-qualifiers/const[const]` keyword is preferred for defining constants and should be used instead of `#define`. [%hardbreaks] [float] @@ -88,8 +88,8 @@ Similarly, including an equal sign after the #define statement will also generat === See also [role="language"] -* #LANGUAGE# link:../../variables/variable-scope-qualifiers/const[const] -* #LANGUAGE# link:../../variables/constants/constants[Constants] +* #LANGUAGE# link:../../../variables/variable-scope\--qualifiers/const[const] +* #LANGUAGE# link:../../../variables/constants/constants[Constants] -- // SEE ALSO SECTION ENDS From 449988e80341efd3e0629cacd6b423e8fd346faa Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Tue, 18 Aug 2020 13:44:41 +0200 Subject: [PATCH 132/298] Update long.adoc Implemented changes from Issue 766 --- Language/Variables/Data Types/long.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Data Types/long.adoc b/Language/Variables/Data Types/long.adoc index 061c9c2c9..82ed525d5 100644 --- a/Language/Variables/Data Types/long.adoc +++ b/Language/Variables/Data Types/long.adoc @@ -19,7 +19,7 @@ subCategories: [ "Data Types" ] === Description Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647. -If doing math with integers, at least one of the numbers must be followed by an L, forcing it to be a long. See the link:../../constants/integerconstants[Integer Constants] page for details. +If doing math with integers at least one of the values must be of type long, either an integer constant followed by an L or a variable of type long, forcing it to be a long. See the link:../../constants/integerconstants[Integer Constants] page for details. [%hardbreaks] [float] @@ -28,7 +28,7 @@ If doing math with integers, at least one of the numbers must be followed by an [float] -=== Parameters +=== Description `var`: variable name. + `val`: the value assigned to the variable. @@ -49,7 +49,7 @@ If doing math with integers, at least one of the numbers must be followed by an [source,arduino] ---- -long speedOfLight = 186000L; // see the Integer Constants page for explanation of the 'L' +long speedOfLight_km_s = 300000L; // see the Integer Constants page for explanation of the 'L' ---- -- From 0be6243242f02bc9af28dd0a893167ea6cf156eb Mon Sep 17 00:00:00 2001 From: nor-easter Date: Wed, 19 Aug 2020 00:09:05 -0500 Subject: [PATCH 133/298] Update interrupts.adoc Correct function name: noInterrupts() --- Language/Functions/Interrupts/interrupts.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Interrupts/interrupts.adoc b/Language/Functions/Interrupts/interrupts.adoc index 251ecced8..2158aeed6 100644 --- a/Language/Functions/Interrupts/interrupts.adoc +++ b/Language/Functions/Interrupts/interrupts.adoc @@ -17,7 +17,7 @@ subCategories: [ "Interrupts" ] [float] === Description -Re-enables interrupts (after they've been disabled by link:../nointerrupts[nointerrupts()]. Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code. +Re-enables interrupts (after they've been disabled by link:../nointerrupts[noInterrupts()]. Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code. [%hardbreaks] From ba5358777797a8bbab330dedf71c767930bbb7b7 Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Wed, 19 Aug 2020 11:10:28 +0200 Subject: [PATCH 134/298] Update long.adoc Changed the Speed of light to referenced in Km/s instead of Miles/s. Reverted to Using "Parameters" instead of "description" for heading again. --- Language/Variables/Data Types/long.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/long.adoc b/Language/Variables/Data Types/long.adoc index 82ed525d5..07462b014 100644 --- a/Language/Variables/Data Types/long.adoc +++ b/Language/Variables/Data Types/long.adoc @@ -28,7 +28,7 @@ If doing math with integers at least one of the values must be of type long, eit [float] -=== Description +=== Parameters `var`: variable name. + `val`: the value assigned to the variable. From 1e3f412e763f5826b267aa1ec0f7e3e5e153a9e1 Mon Sep 17 00:00:00 2001 From: Jeremaiha-xmetix <67539861+Jeremaiha-xmetix@users.noreply.github.com> Date: Wed, 19 Aug 2020 16:18:32 +0300 Subject: [PATCH 135/298] Misusage of `strlen_p()` There is no actual reason to put a method that counts characters inside a `for-loop`, such that every iteration will reevaluate the length of `signMessage`. --- Language/Variables/Utilities/PROGMEM.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index b483ad5fe..30993030a 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -86,7 +86,8 @@ void setup() { Serial.println(); // read back a char - for (byte k = 0; k < strlen_P(signMessage); k++) { + int signMessageLength = strlen_P(signMessage); + for (byte k = 0; k < signMessageLength; k++) { myChar = pgm_read_byte_near(signMessage + k); Serial.print(myChar); } From a37fe975ef1c92e89e2ec54f06e1eb546f7d77b1 Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Wed, 26 Aug 2020 12:34:30 +0200 Subject: [PATCH 136/298] Update constants.adoc Added missing word and corrected spelling --- Language/Variables/Constants/constants.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Constants/constants.adoc b/Language/Variables/Constants/constants.adoc index 6bbff458b..ad74c9f6d 100644 --- a/Language/Variables/Constants/constants.adoc +++ b/Language/Variables/Constants/constants.adoc @@ -44,7 +44,7 @@ The meaning of `HIGH` (in reference to a pin) is somewhat different depending on - a voltage greater than 2.0V volts is present at the pin (3.3V boards) [%hardbreaks] -A pin may also be configured as an INPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and subsequently made HIGH with `link:../../../functions/digital-io/digitalwrite[digitalWrite()]`. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can done alternatively by passing `INPUT_PULLUP` as argument to the link:../../../functions/digital-io/pinmode[`pinMode()`] funtion, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. +A pin may also be configured as an INPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and subsequently made HIGH with `link:../../../functions/digital-io/digitalwrite[digitalWrite()]`. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can be done alternatively by passing `INPUT_PULLUP` as argument to the link:../../../functions/digital-io/pinmode[`pinMode()`] function, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. [%hardbreaks] When a pin is configured to OUTPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and set to `HIGH` with link:../../../functions/digital-io/digitalwrite[`digitalWrite()`], the pin is at: From 2cde7a35cb86c2e284dfd8bf18b1ef3ff91ce951 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 29 Aug 2020 10:29:35 -0700 Subject: [PATCH 137/298] Document double quotes syntax of #include directives --- Language/Structure/Further Syntax/include.adoc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Language/Structure/Further Syntax/include.adoc b/Language/Structure/Further Syntax/include.adoc index e4020e65e..478a1ab28 100644 --- a/Language/Structure/Further Syntax/include.adoc +++ b/Language/Structure/Further Syntax/include.adoc @@ -27,6 +27,18 @@ The main reference page for AVR C libraries (AVR is a reference to the Atmel chi Note that `#include`, similar to `link:../define[#define]`, has no semicolon terminator, and the compiler will yield cryptic error messages if you add one. [%hardbreaks] + +[float] +=== Syntax +`#include ` + +`#include "LocalFile.h"` + + +[float] +=== Parameters +`LibraryFile.h`: when the angle brackets syntax is used, the libraries paths will be searched for the file. + +`LocalFile.h`: When the double quotes syntax is used, the folder of the file using the `#include` directive will be searched for the specified file, then the libraries paths if it was not found in the local path. Use this syntax for header files in the sketch's folder. + -- // OVERVIEW SECTION ENDS From 9a16bed58e50ff0a736ed188d768015854620e50 Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Mon, 7 Sep 2020 13:43:59 +0200 Subject: [PATCH 138/298] Revert "Update analogWrite doc" --- Language/Functions/Analog IO/analogWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 1d01bd4c7..95402cba0 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -38,7 +38,7 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C [%hardbreaks] -You do need to call `pinMode()` to set the pin as an output before calling `analogWrite()`. +You do not need to call `pinMode()` to set the pin as an output before calling `analogWrite()`. The `analogWrite` function has nothing to do with the analog pins or the `analogRead` function. [%hardbreaks] From 34c5c0893f84ed41fea4640a9c05f4c67b034721 Mon Sep 17 00:00:00 2001 From: "Simon A. Eugster" Date: Wed, 23 Sep 2020 17:11:22 +0200 Subject: [PATCH 139/298] volatile.adoc: Add suggestions by @cmaglie --- .../Variable Scope & Qualifiers/volatile.adoc | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc index ecf5a5544..79927f386 100644 --- a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc @@ -55,14 +55,14 @@ There are several ways to do this: === Example Code // Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ -The `volatile` modifier ensures that changes to the `state` variable are immediately visible in `loop()`. Without the `volatile` modifier, the `state` variable would be loaded into a register when entering the function and would not be updated anymore until the function ends. +The `volatile` modifier ensures that changes to the `state` variable are immediately visible in `loop()`. Without the `volatile` modifier, the `state` variable may be loaded into a register when entering the function and would not be updated anymore until the function ends. [source,arduino] ---- // Flashes the LED for 1 s if the input has changed // in the previous second. -volatile byte state = LOW; +volatile byte changed = 0; void setup() { pinMode(LED_BUILTIN, OUTPUT); @@ -70,22 +70,21 @@ void setup() { } void loop() { - bool changedInTheMeantime = false; + if (changed == 1) { + // toggle() has been called from interrupts! - byte originalState = state; - delay(1000); - byte newState = state; + // Reset changed to 0 + changed = 0; - if (newState != originalState) { - // toggle() has been called during delay(1000) - changedInTheMeantime = true; + // Blink LED for 200 ms + digitalWrite(LED_BUILTIN, HIGH); + delay(200); + digitalWrite(LED_BUILTIN, LOW); } - - digitalWrite(LED_BUILTIN, changedInTheMeantime ? HIGH : LOW); } void toggle() { - state = !state; + changed = 1; } ---- From 3ef87e10bbb4ea32075b5ed66c13e07977326a92 Mon Sep 17 00:00:00 2001 From: MalcolmBoura Date: Wed, 30 Sep 2020 15:11:16 +0100 Subject: [PATCH 140/298] Update PROGMEM.adoc The strings have to be in flash whether they are loaded at start up (the default) or when needed. Hence using embed or the F macro should have no impact on the flash use. There is a very small time penalty, about 1 clock cycle per character + a function call I expect, but I don't know enough about how the Atmega works to be certain. --- Language/Variables/Utilities/PROGMEM.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index b483ad5fe..de75ee608 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -187,7 +187,7 @@ When an instruction like : Serial.print("Write something on the Serial Monitor"); ---- -is used, the string to be printed is normally saved in RAM. If your sketch prints a lot of stuff on the Serial Monitor, you can easily fill the RAM. If you have free FLASH memory space, you can easily indicate that the string must be saved in FLASH using the syntax: +is used, the string to be printed is normally saved in RAM. If your sketch prints a lot of stuff on the Serial Monitor, you can easily fill the RAM. This can be avoided by not loading strings from the FLASH memory space until they are needed. You can easily indicate that the string is not to be copied to RAM at start up using the syntax: [source,arduino] ---- From 70a96ccd9693646bf322b47b72d15dacd5a3b033 Mon Sep 17 00:00:00 2001 From: TADefx <72205337+TADefx@users.noreply.github.com> Date: Thu, 1 Oct 2020 08:07:05 -0500 Subject: [PATCH 141/298] Update increment.adoc Corrected formatting of the Syntax section, caused by "+" operator that caused the "++" to be hidden and cut-off the lines --- Language/Structure/Compound Operators/increment.adoc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Language/Structure/Compound Operators/increment.adoc b/Language/Structure/Compound Operators/increment.adoc index b9dd49b7b..66ec79ff6 100644 --- a/Language/Structure/Compound Operators/increment.adoc +++ b/Language/Structure/Compound Operators/increment.adoc @@ -24,8 +24,11 @@ Increments the value of a variable by 1. [float] === Syntax -`x++; // increment x by one and returns the old value of x` + -`++x; // increment x by one and returns the new value of x` +[source,arduino] +---- +x++; // increment x by one and returns the old value of x +++x; // increment x by one and returns the new value of x +---- [float] From 2eb7c1e8166f2fa685423e382079cba65c0edd37 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 3 Oct 2020 08:46:27 -0700 Subject: [PATCH 142/298] Use {plus} predefined attribute to escape increment operator Previously, the increment operator in the syntax section was being treated as markup. --- Language/Structure/Compound Operators/increment.adoc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Language/Structure/Compound Operators/increment.adoc b/Language/Structure/Compound Operators/increment.adoc index 66ec79ff6..7419f1ff6 100644 --- a/Language/Structure/Compound Operators/increment.adoc +++ b/Language/Structure/Compound Operators/increment.adoc @@ -24,11 +24,8 @@ Increments the value of a variable by 1. [float] === Syntax -[source,arduino] ----- -x++; // increment x by one and returns the old value of x -++x; // increment x by one and returns the new value of x ----- +`x{plus}{plus}; // increment x by one and returns the old value of x` + +`{plus}{plus}x; // increment x by one and returns the new value of x` [float] From 6e02c42f9722b6a799ff41939342036a2a21be28 Mon Sep 17 00:00:00 2001 From: Sebastiaan Lokhorst Date: Sat, 10 Oct 2020 20:41:22 +0200 Subject: [PATCH 143/298] analogReference now supported by Arduino nRF528x In addition to the "Arduino mbed-enabled Boards" platform, this function is now also supported by the "Arduino nRF528x Boards (Mbed OS)" platform since version 1.1.6. https://github.com/arduino/ArduinoCore-nRF528x-mbedos/pull/81 --- Language/Functions/Analog IO/analogReference.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index e0fd3aed6..33cc8ad87 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -52,7 +52,7 @@ Arduino SAM Boards (Due) * AR_DEFAULT: the default analog reference of 3.3V. This is the only supported option for the Due. -Arduino mbed-enabled Boards (Nano 33 BLE only): only available when using the _Arduino mbed-enabled Boards_ platform, and not when using the _Arduino nRF528x Boards (Mbed OS)_ platform +Arduino mbed-enabled Boards (Nano 33 BLE only): available when using the _Arduino mbed-enabled Boards_ platform, or the _Arduino nRF528x Boards (Mbed OS)_ platform version 1.1.6 or later * AR_VDD: the default 3.3 V reference * AR_INTERNAL: built-in 0.6 V reference From b64c17fb541056fcc4769e03959f6fc0825a9b4c Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 24 Sep 2020 09:45:43 -0700 Subject: [PATCH 144/298] Document limitation of Serial1.begin() config value for Nano 33 BLE boards Add a warning that use of any Serial1.begin() config value other than SERIAL_8N1 on the Arduino Nano 33 BLE boards will cause an Mbed OS crash. --- Language/Functions/Communication/Serial/begin.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Language/Functions/Communication/Serial/begin.adoc b/Language/Functions/Communication/Serial/begin.adoc index f5701a75a..ea8c0f04e 100644 --- a/Language/Functions/Communication/Serial/begin.adoc +++ b/Language/Functions/Communication/Serial/begin.adoc @@ -113,6 +113,8 @@ Thanks to Jeff Gray for the mega example [float] === Notes and Warnings For USB CDC serial ports (e.g. `Serial` on the Leonardo), `Serial.begin()` is irrelevant. You can use any baud rate and configuration for serial communication with these ports. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +The only `config` value supported for `Serial1` on the Arduino Nano 33 BLE and Nano 33 BLE Sense boards is `SERIAL_8N1`. [%hardbreaks] -- From 5c6f13a89c73eaaa347da805660d62039a5921be Mon Sep 17 00:00:00 2001 From: Ubi de Feo Date: Wed, 21 Oct 2020 08:14:53 +0200 Subject: [PATCH 145/298] Include Nano 33 and Portenta (#791) * Include Nano 33 and Portenta These boards are lacking in this piece of documentation, possibly elsewhere * Update Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc Co-authored-by: per1234 * Update Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc Yes! I just discovered that such method is not available and throws an error. I believe it should be added to cores which do not support multiple resolutions, just in case a user obtains a sketch made on an *arm* board and the compilation error makes no sense to them. The method could be just a sinkhole but would prevent the compile error :) Co-authored-by: per1234 * changed subcategory to "Analog I/O" * Sub-category changed back to "Zero, Due & MKR Family" In order to submit a new PR with just the category change Co-authored-by: per1234 --- .../Zero, Due, MKR Family/analogReadResolution.adoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc b/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc index 8dbf51d92..4531306b3 100644 --- a/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc +++ b/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc @@ -16,11 +16,12 @@ subCategories: [ "Zero, Due & MKR Family" ] [float] === Description -analogReadResolution() is an extension of the Analog API for the Arduino Due, Zero and MKR Family. +analogReadResolution() is an extension of the Analog API for the Zero, Due, MKR family, Nano 33 (BLE and IoT) and Portenta. Sets the size (in bits) of the value returned by `analogRead()`. It defaults to 10 bits (returns values between 0-1023) for backward compatibility with AVR based boards. -The *Due, Zero and MKR Family* boards have 12-bit ADC capabilities that can be accessed by changing the resolution to 12. This will return values from `analogRead()` between 0 and 4095. +The *Zero, Due, MKR family and Nano 33 (BLE and IoT)* boards have 12-bit ADC capabilities that can be accessed by changing the resolution to 12. This will return values from `analogRead()` between 0 and 4095. + +The *Portenta H7* has a 16 bit ADC, which will allow values between 0 and 65535. [%hardbreaks] @@ -31,7 +32,7 @@ The *Due, Zero and MKR Family* boards have 12-bit ADC capabilities that can be a [float] === Parameters -`bits`: determines the resolution (in bits) of the value returned by the `analogRead()` function. You can set this between 1 and 32. You can set resolutions higher than 12 but values returned by `analogRead()` will suffer approximation. See the note below for details. +`bits`: determines the resolution (in bits) of the value returned by the `analogRead()` function. You can set this between 1 and 32. You can set resolutions higher than the supported 12 or 16 bits, but values returned by `analogRead()` will suffer approximation. See the note below for details. [float] From 5fc2f4a85a01dea2577d9c517313fce1af902d5a Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Mon, 26 Oct 2020 14:40:07 +0100 Subject: [PATCH 146/298] Update tone.adoc Updated broken links --- Language/Functions/Advanced IO/tone.adoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 41e3f5031..7f4aa3561 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -75,11 +75,11 @@ If you want to play different pitches on multiple pins, you need to call `noTone [role="example"] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone[Tone Melody^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/tonePitchFollower[Pitch Follower^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone3[Tone Keyboard^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/Tone4[Tone Multiple^] -* #EXAMPLE# http://arduino.cc/en/Tutorial/PWM[PWM^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody[Tone Melody^] +* #EXAMPLE# https://arduino.cc/en/Tutorial/tonePitchFollower[Pitch Follower^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneKeyboard[Tone Keyboard^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMultiple[Tone Multiple^] +* #EXAMPLE# https://arduino.cc/en/Tutorial/PWM[PWM^] -- // SEE ALSO SECTION ENDS From 6b2e27d64e8b051cd68b5e50a9cce8bad5044382 Mon Sep 17 00:00:00 2001 From: HansM Date: Mon, 2 Nov 2020 20:20:24 +0100 Subject: [PATCH 147/298] Unified links in tone.adoc. --- Language/Functions/Advanced IO/tone.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 7f4aa3561..04b4debad 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -76,10 +76,10 @@ If you want to play different pitches on multiple pins, you need to call `noTone [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody[Tone Melody^] -* #EXAMPLE# https://arduino.cc/en/Tutorial/tonePitchFollower[Pitch Follower^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/tonePitchFollower[Pitch Follower^] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneKeyboard[Tone Keyboard^] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMultiple[Tone Multiple^] -* #EXAMPLE# https://arduino.cc/en/Tutorial/PWM[PWM^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/PWM[PWM^] -- // SEE ALSO SECTION ENDS From e0c99a3d14cc63f651b2d8a844a1d5cb6ae03c7a Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Mon, 16 Nov 2020 12:16:09 +0100 Subject: [PATCH 148/298] Update tone.adoc added www to links --- Language/Functions/Advanced IO/tone.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 7f4aa3561..04b4debad 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -76,10 +76,10 @@ If you want to play different pitches on multiple pins, you need to call `noTone [role="example"] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody[Tone Melody^] -* #EXAMPLE# https://arduino.cc/en/Tutorial/tonePitchFollower[Pitch Follower^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/tonePitchFollower[Pitch Follower^] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneKeyboard[Tone Keyboard^] * #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMultiple[Tone Multiple^] -* #EXAMPLE# https://arduino.cc/en/Tutorial/PWM[PWM^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/PWM[PWM^] -- // SEE ALSO SECTION ENDS From f4dceaa48b8b57e5df403711ca0427ca14c5c1e1 Mon Sep 17 00:00:00 2001 From: kb7hunter <61283239+kb7hunter@users.noreply.github.com> Date: Mon, 30 Nov 2020 14:53:28 -0700 Subject: [PATCH 149/298] Update if.adoc (#798) The if condition (if true) will execute the FOLLOWING statement, not the preceding statement. --- Language/Structure/Control Structure/if.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/if.adoc b/Language/Structure/Control Structure/if.adoc index f1a79934e..f5c300396 100644 --- a/Language/Structure/Control Structure/if.adoc +++ b/Language/Structure/Control Structure/if.adoc @@ -16,7 +16,7 @@ subCategories: [ "Control Structure" ] -- [float] === Description -The `if` statement checks for a condition and executes the proceeding statement or set of statements if the condition is 'true'. +The `if` statement checks for a condition and executes the following statement or set of statements if the condition is 'true'. [%hardbreaks] [float] From a71ac0215829638ee960864784f6925b45f7b8ef Mon Sep 17 00:00:00 2001 From: adrianTNT Date: Mon, 30 Nov 2020 23:54:54 +0200 Subject: [PATCH 150/298] Update millis.adoc (#797) * Update millis.adoc changed variable named "time" to "my_time", because it was a conflict when compiling on ESP32 board; And it is not a good practice to define such generic variables that could be used in system variables. Using user variables like my_time and my_temp_sensor is much easier to understand for beginners and more intuitive, easier to differentiate from the system variables. * Update millis.adoc --- Language/Functions/Time/millis.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index d031efded..ea3b9ab4e 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -47,16 +47,16 @@ This example code prints on the serial port the number of milliseconds passed si [source,arduino] ---- -unsigned long time; +unsigned long myTime; void setup() { Serial.begin(9600); } void loop() { Serial.print("Time: "); - time = millis(); + myTime = millis(); - Serial.println(time); //prints time since program started + Serial.println(myTime); //prints time since program started delay(1000); // wait a second so as not to send massive amounts of data } ---- From 8b8d129bbd35a5e3142b7acde2477258d64d9f73 Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Tue, 15 Dec 2020 13:50:26 +0100 Subject: [PATCH 151/298] Update while.adoc Fixed While loop link --- Language/Structure/Control Structure/while.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/while.adoc b/Language/Structure/Control Structure/while.adoc index 491cceb88..09b25192c 100644 --- a/Language/Structure/Control Structure/while.adoc +++ b/Language/Structure/Control Structure/while.adoc @@ -71,7 +71,7 @@ while (var < 200) { [role="language"] [role="example"] -* #EXAMPLE# https://arduino.cc/en/Tutorial/WhileLoop[While Loop^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/BuiltInExamples/WhileStatementConditional[While Loop^] -- // SEE ALSO SECTION ENDS From 4d562dba41e9dd6e46fd7b7309549b32960de166 Mon Sep 17 00:00:00 2001 From: cousteau Date: Fri, 25 Dec 2020 17:49:46 +0000 Subject: [PATCH 152/298] Replace "B..." binary constants with "0b..." (#793) Replaced all references to the deprecated "B..." binary format (e.g. B00101010) with the GCC- and C++-compliant "0b..." format (e.g. 0b00101010). This also removes the restriction that binary constants must be 8 bits or less, so I'm removing that part as well. --- .../Structure/Bitwise Operators/bitwiseAnd.adoc | 2 +- .../Structure/Bitwise Operators/bitwiseOr.adoc | 2 +- .../Structure/Bitwise Operators/bitwiseXor.adoc | 4 ++-- .../Compound Operators/compoundBitwiseAnd.adoc | 12 ++++++------ .../Compound Operators/compoundBitwiseOr.adoc | 12 ++++++------ .../Compound Operators/compoundBitwiseXor.adoc | 12 ++++++------ Language/Variables/Constants/integerConstants.adoc | 14 ++++---------- 7 files changed, 26 insertions(+), 32 deletions(-) diff --git a/Language/Structure/Bitwise Operators/bitwiseAnd.adoc b/Language/Structure/Bitwise Operators/bitwiseAnd.adoc index 986a37fcc..eb8a2067b 100644 --- a/Language/Structure/Bitwise Operators/bitwiseAnd.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseAnd.adoc @@ -58,7 +58,7 @@ One of the most common uses of bitwise AND is to select a particular bit (or bit [source,arduino] ---- -PORTD = PORTD & B00000011; // clear out bits 2 - 7, leave pins PD0 and PD1 untouched (xx & 11 == xx) +PORTD = PORTD & 0b00000011; // clear out bits 2 - 7, leave pins PD0 and PD1 untouched (xx & 11 == xx) ---- -- diff --git a/Language/Structure/Bitwise Operators/bitwiseOr.adoc b/Language/Structure/Bitwise Operators/bitwiseOr.adoc index 14d894b8a..c0297fea7 100644 --- a/Language/Structure/Bitwise Operators/bitwiseOr.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseOr.adoc @@ -56,7 +56,7 @@ One of the most common uses of the Bitwise OR is to set multiple bits in a bit-p // Note: This code is AVR architecture specific // set direction bits for pins 2 to 7, leave PD0 and PD1 untouched (xx | 00 == xx) // same as pinMode(pin, OUTPUT) for pins 2 to 7 on Uno or Nano -DDRD = DDRD | B11111100; +DDRD = DDRD | 0b11111100; ---- -- diff --git a/Language/Structure/Bitwise Operators/bitwiseXor.adoc b/Language/Structure/Bitwise Operators/bitwiseXor.adoc index d4677dbf9..995040657 100644 --- a/Language/Structure/Bitwise Operators/bitwiseXor.adoc +++ b/Language/Structure/Bitwise Operators/bitwiseXor.adoc @@ -56,12 +56,12 @@ The ^ operator is often used to toggle (i.e. change from 0 to 1, or 1 to 0) some // Note: This code uses registers specific to AVR microcontrollers (Uno, Nano, Leonardo, Mega, etc.) // it will not compile for other architectures void setup() { - DDRB = DDRB | B00100000; // set PB5 (pin 13 on Uno/Nano, pin 9 on Leonardo/Micro, pin 11 on Mega) as OUTPUT + DDRB = DDRB | 0b00100000; // set PB5 (pin 13 on Uno/Nano, pin 9 on Leonardo/Micro, pin 11 on Mega) as OUTPUT Serial.begin(9600); } void loop() { - PORTB = PORTB ^ B00100000; // invert PB5, leave others untouched + PORTB = PORTB ^ 0b00100000; // invert PB5, leave others untouched delay(100); } ---- diff --git a/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc b/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc index 2e33d7317..aa31bb88a 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseAnd.adoc @@ -54,22 +54,22 @@ Bits that are "bitwise ANDed" with 0 are cleared to 0 so, if myByte is a byte va [source,arduino] ---- -myByte & B00000000 = 0; +myByte & 0b00000000 = 0; ---- Bits that are "bitwise ANDed" with 1 are unchanged so, [source,arduino] ---- -myByte & B11111111 = myByte; +myByte & 0b11111111 = myByte; ---- [%hardbreaks] [float] === Notes and Warnings -Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero (hmmm something philosophical there?) +Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, 0b00000000 is shown for clarity, but zero in any number format is zero (hmmm something philosophical there?) -Consequently - to clear (set to zero) bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise AND operator (&=) with the constant B11111100 +Consequently - to clear (set to zero) bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise AND operator (&=) with the constant 0b11111100 1 0 1 0 1 0 1 0 variable 1 1 1 1 1 1 0 0 mask @@ -93,8 +93,8 @@ So if: [source,arduino] ---- -myByte = B10101010; -myByte &= B11111100; // results in B10101000 +myByte = 0b10101010; +myByte &= 0b11111100; // results in 0b10101000 ---- [%hardbreaks] diff --git a/Language/Structure/Compound Operators/compoundBitwiseOr.adoc b/Language/Structure/Compound Operators/compoundBitwiseOr.adoc index 815d98771..5cae450f2 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseOr.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseOr.adoc @@ -49,22 +49,22 @@ A review of the Bitwise OR `|` operator: Bits that are "bitwise ORed" with 0 are unchanged, so if myByte is a byte variable, [source,arduino] ---- -myByte | B00000000 = myByte; +myByte | 0b00000000 = myByte; ---- Bits that are "bitwise ORed" with 1 are set to 1 so: [source,arduino] ---- -myByte | B11111111 = B11111111; +myByte | 0b11111111 = 0b11111111; ---- [%hardbreaks] [float] === Notes and Warnings -Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero. +Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, 0b00000000 is shown for clarity, but zero in any number format is zero. [%hardbreaks] -Consequently - to set bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise OR operator (|=) with the constant B00000011 +Consequently - to set bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise OR operator (|=) with the constant 0b00000011 1 0 1 0 1 0 1 0 variable 0 0 0 0 0 0 1 1 mask @@ -88,8 +88,8 @@ Here is the same representation with the variables bits replaced with the symbol So if: [source,arduino] ---- -myByte = B10101010; -myByte |= B00000011 == B10101011; +myByte = 0b10101010; +myByte |= 0b00000011 == 0b10101011; ---- -- diff --git a/Language/Structure/Compound Operators/compoundBitwiseXor.adoc b/Language/Structure/Compound Operators/compoundBitwiseXor.adoc index 267d44fd9..8ddecc915 100644 --- a/Language/Structure/Compound Operators/compoundBitwiseXor.adoc +++ b/Language/Structure/Compound Operators/compoundBitwiseXor.adoc @@ -49,22 +49,22 @@ A review of the Bitwise XOR `^` operator: Bits that are "bitwise XORed" with 0 are left unchanged. So if myByte is a byte variable, [source,arduino] ---- -myByte ^ B00000000 = myByte; +myByte ^ 0b00000000 = myByte; ---- Bits that are "bitwise XORed" with 1 are toggled so: [source,arduino] ---- -myByte ^ B11111111 = ~myByte; +myByte ^ 0b11111111 = ~myByte; ---- [%hardbreaks] [float] === Notes and Warnings -Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, B00000000 is shown for clarity, but zero in any number format is zero. +Because we are dealing with bits in a bitwise operator - it is convenient to use the binary formatter with constants. The numbers are still the same value in other representations, they are just not as easy to understand. Also, 0b00000000 is shown for clarity, but zero in any number format is zero. [%hardbreaks] -Consequently - to toggle bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise XOR operator (^=) with the constant B00000011 +Consequently - to toggle bits 0 & 1 of a variable, while leaving the rest of the variable unchanged, use the compound bitwise XOR operator (^=) with the constant 0b00000011 1 0 1 0 1 0 1 0 variable 0 0 0 0 0 0 1 1 mask @@ -88,8 +88,8 @@ Here is the same representation with the variables bits replaced with the symbol So if: [source,arduino] ---- -myByte = B10101010; -myByte ^= B00000011 == B10101001; +myByte = 0b10101010; +myByte ^= 0b00000011 == 0b10101001; ---- -- diff --git a/Language/Variables/Constants/integerConstants.adoc b/Language/Variables/Constants/integerConstants.adoc index d34e50370..71e93ed15 100644 --- a/Language/Variables/Constants/integerConstants.adoc +++ b/Language/Variables/Constants/integerConstants.adoc @@ -32,9 +32,9 @@ Normally, integer constants are treated as base 10 (decimal) integers, but speci | |2 (binary) -|B1111011 -|leading 'B' -|only works with 8 bit values (0 to 255) characters 0&1 valid +|0b1111011 +|leading "0b" +|characters 0&1 valid |8 (octal) |0173 @@ -76,13 +76,7 @@ Only the characters 0 and 1 are valid. === Example Code: [source,arduino] ---- -n = B101; // same as 5 decimal ((1 * 2^2) + (0 * 2^1) + 1) ----- - -The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it is convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as: -[source,arduino] ----- -myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte` +n = 0b101; // same as 5 decimal ((1 * 2^2) + (0 * 2^1) + 1) ---- [%hardbreaks] From 62ee09c29710b26b6c9b853cbe44d56781394531 Mon Sep 17 00:00:00 2001 From: jguy584 <77988812+jguy584@users.noreply.github.com> Date: Mon, 25 Jan 2021 13:53:41 -0500 Subject: [PATCH 153/298] Update attachInterrupt.adoc for MEGA Using pins 20, 21 for interrupts on the MEGA 2560 can cause some real headaches if not aware that they have external pull up resistors on them. The pull ups are there for TWI functionality, and cannot be disabled shy of desoldering the resistors from the board. I can confirm that the 2560 and the ADK both have these resistors. I do not know about the original MEGA, but I assume it has them too. --- Language/Functions/External Interrupts/attachInterrupt.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 0a618e52c..a560620b9 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -22,7 +22,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |Board |Digital Pins Usable For Interrupts |Uno, Nano, Mini, other 328-based |2, 3 |Uno WiFi Rev.2, Nano Every |all digital pins -|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 +|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20*, 21* |Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7 |Zero |all digital pins, except 4 |MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2 @@ -32,6 +32,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |101 |all digital pins (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*) |=================================================== +*Pins 20 and 21 of the MEGA series have external 10Kohm pull-up resistors attached to them that cannot be disabled. [%hardbreaks] [float] From bd73a139012e1cf6cceebc985311decb231d86b3 Mon Sep 17 00:00:00 2001 From: Sebastian Romero Date: Tue, 23 Feb 2021 16:07:20 +0100 Subject: [PATCH 154/298] Add info about resolution on Portenta boards (#818) --- Language/Functions/Time/micros.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/micros.adoc b/Language/Functions/Time/micros.adoc index 92f274ab6..22fc13962 100644 --- a/Language/Functions/Time/micros.adoc +++ b/Language/Functions/Time/micros.adoc @@ -17,7 +17,7 @@ subCategories: [ "Time" ] [float] === Description -Returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function has a resolution of four microseconds (i.e. the value returned is always a multiple of four). On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution of eight microseconds. +Returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes. On the boards from the Arduino Portenta family this function has a resolution of one microsecond on all cores. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function has a resolution of four microseconds (i.e. the value returned is always a multiple of four). On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution of eight microseconds. [%hardbreaks] From c4fcc2497eb135d3981f0588425d201197ffdea5 Mon Sep 17 00:00:00 2001 From: George Keloglou Date: Wed, 10 Mar 2021 02:06:27 +0200 Subject: [PATCH 155/298] Space after slashes for comments. (#716) Co-authored-by: per1234 --- Language/Functions/Time/millis.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index ea3b9ab4e..7ff5f7624 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -56,7 +56,7 @@ void loop() { Serial.print("Time: "); myTime = millis(); - Serial.println(myTime); //prints time since program started + Serial.println(myTime); // prints time since program started delay(1000); // wait a second so as not to send massive amounts of data } ---- From 97aa6957474a9e32cdcff74246a54bca31c87c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 12 Mar 2021 16:18:50 +0100 Subject: [PATCH 156/298] Updated mega row for interrupts --- Language/Functions/External Interrupts/attachInterrupt.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 0a618e52c..0dc26d858 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -22,7 +22,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |Board |Digital Pins Usable For Interrupts |Uno, Nano, Mini, other 328-based |2, 3 |Uno WiFi Rev.2, Nano Every |all digital pins -|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 +|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 (*pins 20 & 21* are not available to use for interrupts while they are used for I2C communication) |Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7 |Zero |all digital pins, except 4 |MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2 From fca865ba7b9ae7244be23f6364ae0986d3196bb9 Mon Sep 17 00:00:00 2001 From: Marco Tedaldi Date: Thu, 18 Mar 2021 10:36:59 +0100 Subject: [PATCH 157/298] Update serialEvent.adoc Add mention of loop() in description. --- Language/Functions/Communication/Serial/serialEvent.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index e554fb882..5201017eb 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -14,7 +14,7 @@ title: serialEvent() [float] === Description -Called when data is available. Use `Serial.read()` to capture this data. +Called at the end of loop() when data is available. Use `Serial.read()` to capture this data. [%hardbreaks] From aa6751cf647f751da64c3eb0d4e894ca4f2258bd Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 28 Mar 2021 21:44:43 -0700 Subject: [PATCH 158/298] Use standard pin name in attachInterrupt() table (#807) The previous pin number 15 in the table for Nano 33 IoT was correct, but users are more familiar with the "An" pin naming style, as marked on the board silkscreen, so it's better to always use those names in the reference. --- Language/Functions/External Interrupts/attachInterrupt.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 0a618e52c..5da092da2 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -26,7 +26,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7 |Zero |all digital pins, except 4 |MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2 -|Nano 33 IoT |2, 3, 9, 10, 11, 13, 15, A5, A7 +|Nano 33 IoT |2, 3, 9, 10, 11, 13, A1, A5, A7 |Nano 33 BLE, Nano 33 BLE Sense |all pins |Due |all digital pins |101 |all digital pins (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*) From e893eb10155b388716742fe516705b42096709dd Mon Sep 17 00:00:00 2001 From: Vincent Tavernier Date: Wed, 21 Apr 2021 18:19:21 +0200 Subject: [PATCH 159/298] Specify behavior of analogWrite on Nano 33 BLE/BLE Sense --- Language/Functions/Analog IO/analogWrite.adoc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 95402cba0..672f398a0 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -25,16 +25,17 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C | Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) | Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) | Uno WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz -| MKR boards * | 0 - 8, 10, A3, A4 | 732 Hz -| MKR1000 WiFi * | 0 - 8, 10, 11, A3, A4 | 732 Hz -| Zero * | 3 - 13, A0, A1 | 732 Hz -| Nano 33 IoT * | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz -| Nano 33 BLE/BLE Sense | 1 - 13, A0 - A7 | 500 Hz -| Due ** | 2-13 | 1000 Hz +| MKR boards ¹ | 0 - 8, 10, A3, A4 | 732 Hz +| MKR1000 WiFi ¹ | 0 - 8, 10, 11, A3, A4 | 732 Hz +| Zero ¹ | 3 - 13, A0, A1 | 732 Hz +| Nano 33 IoT ¹ | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz +| Nano 33 BLE/BLE Sense ² | 1 - 13, A0 - A7 | 500 Hz +| Due ³ | 2-13 | 1000 Hz | 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz |======================================================================================================== -{empty}* In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + -{empty}** In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. +{empty}¹ In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + +{empty}² Only 4 different pins can be used at the same time. Enabling PWM on more than 4 pins will abort the running sketch and require resetting the board to upload a new sketch again. + +{empty}³ In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. [%hardbreaks] From d958580e402e617114be796e8267cf6cffb84a21 Mon Sep 17 00:00:00 2001 From: rohoog <33842942+rohoog@users.noreply.github.com> Date: Fri, 23 Apr 2021 20:49:16 +0200 Subject: [PATCH 160/298] Update ifSerial.adoc I got bitten by this delay in a loop that otherwise would easily keep up with interrupts. I think users should be aware of it! --- Language/Functions/Communication/Serial/ifSerial.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Language/Functions/Communication/Serial/ifSerial.adoc b/Language/Functions/Communication/Serial/ifSerial.adoc index d5a0fa29f..c2988a863 100644 --- a/Language/Functions/Communication/Serial/ifSerial.adoc +++ b/Language/Functions/Communication/Serial/ifSerial.adoc @@ -36,6 +36,11 @@ None === Returns Returns true if the specified serial port is available. This will only return false if querying the Leonardo's USB CDC serial connection before it is ready. Data type: `bool`. + +[float] +=== Warning +This function adds a delay of 10ms in an attempt to solve "open but not quite" situations. Don't use it in tight loops. + -- // OVERVIEW SECTION ENDS From efc1249ce8a5c510ba5e90a77d165819b56f409f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 25 May 2021 13:12:35 +1200 Subject: [PATCH 161/298] Change ''D" to "d" in (#831) Perhaps the code has changed over time, but this documentation change is for the reference to reflect reality. Also consider changing the code to perhaps accept HEX_UPPER & HEX_LOWER. --- Language/Variables/Data Types/stringObject.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/stringObject.adoc b/Language/Variables/Data Types/stringObject.adoc index 396582b3d..b3b04a498 100644 --- a/Language/Variables/Data Types/stringObject.adoc +++ b/Language/Variables/Data Types/stringObject.adoc @@ -36,7 +36,7 @@ gives you the String "13". You can use other bases, however. For example, String thisString = String(13, HEX); ---- -gives you the String "D", which is the hexadecimal representation of the decimal value 13. Or if you prefer binary, +gives you the String "d", which is the hexadecimal representation of the decimal value 13. Or if you prefer binary, [source,arduino] ---- From a7afd807a3e3a1ce45fef911cfaf52ed5eae1e27 Mon Sep 17 00:00:00 2001 From: rohoog <33842942+rohoog@users.noreply.github.com> Date: Sat, 29 May 2021 13:36:26 +0200 Subject: [PATCH 162/298] Update bitshiftRight.adoc Sign extension doesn't need to be avoided for arithmetic use of bit shifting, it actually causes that negative numbers are calculated correctly. Just the rounding is different compared to the division operator. --- .../Structure/Bitwise Operators/bitshiftRight.adoc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Language/Structure/Bitwise Operators/bitshiftRight.adoc b/Language/Structure/Bitwise Operators/bitshiftRight.adoc index f2f98b840..53715a33a 100644 --- a/Language/Structure/Bitwise Operators/bitshiftRight.adoc +++ b/Language/Structure/Bitwise Operators/bitshiftRight.adoc @@ -69,12 +69,19 @@ int x = -16; // binary: 1111111111110000 int y = 3; int result = (unsigned int)x >> y; // binary: 0001111111111110 ---- -If you are careful to avoid sign extension, you can use the right-shift operator `>>` as a way to divide by powers of 2. For example: +Sign extension causes that you can use the right-shift operator `>>` as a way to divide by powers of 2, even negative numbers. For example: [source,arduino] ---- -int x = 1000; -int y = x >> 3; // integer division of 1000 by 8, causing y = 125. +int x = -1000; +int y = x >> 3; // integer division of -1000 by 8, causing y = -125. +---- +But be aware of the rounding with negative numbers: +[source,arduino] +---- +int x = -1001; +int y = x >> 3; // division by shifting always rounds down, causing y = -126 +int z = x / 8; // division operator rounds towards zero, causing z = -125 ---- -- From 465ebf7d63833e471fb06d471412c98de4def7cf Mon Sep 17 00:00:00 2001 From: joshua-8 <59814881+joshua-8@users.noreply.github.com> Date: Wed, 2 Jun 2021 21:32:48 -0700 Subject: [PATCH 163/298] fixed typo (missing comma and space) (#835) --- Language/Functions/Communication/Serial/serialEvent.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index e554fb882..c352bbfc6 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -67,7 +67,7 @@ Nothing `serialEvent()` and `serialEvent1()` don't work on the Arduino SAMD Boards -`serialEvent()`, `serialEvent1()``serialEvent2()`, and `serialEvent3()` don't work on the Arduino Due. +`serialEvent()`, `serialEvent1()`, `serialEvent2()`, and `serialEvent3()` don't work on the Arduino Due. [%hardbreaks] -- From 5e49633c1ece7987a0e1dd9009ac9e8658549271 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 26 Jun 2021 08:06:16 -0700 Subject: [PATCH 164/298] Remove redundant unit from definition of HIGH level (#840) The text contained both the symbol and name of the unit consecutively. --- Language/Variables/Constants/constants.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Constants/constants.adoc b/Language/Variables/Constants/constants.adoc index ad74c9f6d..05f137654 100644 --- a/Language/Variables/Constants/constants.adoc +++ b/Language/Variables/Constants/constants.adoc @@ -41,7 +41,7 @@ When reading or writing to a digital pin there are only two possible values a pi The meaning of `HIGH` (in reference to a pin) is somewhat different depending on whether a pin is set to an `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with `link:../../../functions/digital-io/pinmode[pinMode()]`, and read with `link:../../../functions/digital-io/digitalread[digitalRead()]`, the Arduino (ATmega) will report `HIGH` if: - a voltage greater than 3.0V is present at the pin (5V boards) - - a voltage greater than 2.0V volts is present at the pin (3.3V boards) + - a voltage greater than 2.0V is present at the pin (3.3V boards) [%hardbreaks] A pin may also be configured as an INPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and subsequently made HIGH with `link:../../../functions/digital-io/digitalwrite[digitalWrite()]`. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can be done alternatively by passing `INPUT_PULLUP` as argument to the link:../../../functions/digital-io/pinmode[`pinMode()`] function, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. From 99c2365cfc8c405f7f3458b477ab134677db39a9 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 7 Sep 2021 15:38:30 +1200 Subject: [PATCH 165/298] Update delayMicroseconds.adoc (#847) Improve warning about long delay times , and that they can be extremely brief. --- Language/Functions/Time/delayMicroseconds.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Time/delayMicroseconds.adoc b/Language/Functions/Time/delayMicroseconds.adoc index 0fbf57d84..2c5b02677 100644 --- a/Language/Functions/Time/delayMicroseconds.adoc +++ b/Language/Functions/Time/delayMicroseconds.adoc @@ -19,7 +19,7 @@ subCategories: [ "Time" ] === Description Pauses the program for the amount of time (in microseconds) specified by the parameter. There are a thousand microseconds in a millisecond and a million microseconds in a second. -Currently, the largest value that will produce an accurate delay is 16383. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use `delay()` instead. +Currently, the largest value that will produce an accurate delay is 16383; larger values can produce an extremely short delay. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use `delay()` instead. [%hardbreaks] @@ -71,7 +71,7 @@ void loop() { [float] === Notes and Warnings -This function works very accurately in the range 3 microseconds and up. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times. +This function works very accurately in the range 3 microseconds and up to 16383. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times. Larger delay times may actually delay for an extremely brief time. As of Arduino 0018, delayMicroseconds() no longer disables interrupts. From d91cefb4d256617d98ab13207db17b576af9b322 Mon Sep 17 00:00:00 2001 From: Sebastiaan Lokhorst Date: Sun, 12 Sep 2021 15:57:51 +0200 Subject: [PATCH 166/298] Update analogReference for Mbed OS Boards (#848) * Update analogReference for Mbed OS Boards The Mbed board platforms have been renamed and reorganized and the two previously named platforms (_Arduino mbed-enabled Boards_ and _Arduino nRF528x Boards (Mbed OS)_) no longer exist. * analogReference: Mention Mbed OS platforms separately Co-authored-by: per1234 Co-authored-by: per1234 --- Language/Functions/Analog IO/analogReference.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index 33cc8ad87..8b463de9d 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -52,7 +52,7 @@ Arduino SAM Boards (Due) * AR_DEFAULT: the default analog reference of 3.3V. This is the only supported option for the Due. -Arduino mbed-enabled Boards (Nano 33 BLE only): available when using the _Arduino mbed-enabled Boards_ platform, or the _Arduino nRF528x Boards (Mbed OS)_ platform version 1.1.6 or later +Arduino Mbed OS Nano Boards (Nano 33 BLE), Arduino Mbed OS Edge Boards (Edge Control) * AR_VDD: the default 3.3 V reference * AR_INTERNAL: built-in 0.6 V reference From bed5beee73ad1ae379c671c0db0e4e93a37ea699 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Tue, 21 Sep 2021 21:17:50 +0200 Subject: [PATCH 167/298] Clarification TIMx use by AVR architectures --- Language/Functions/Time/millis.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index dbc70ff54..82cb8da73 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -64,7 +64,9 @@ void loop() { [float] === Notes and Warnings -Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. millis() uses timer0's overflow interrupt. +Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. + +AVR-based architectures program a timer to implement millis(), reconfiguring these timers may result in inaccurate millis() readings. ArduinoCore-AVR relies on TIM0 which is programmed to generate an interrupt every 16384 clock cycles (clock divider set to 64, overflow every 256 ticks). The same holds for ArduinoCore-mega-AVR, except that it uses TIMx if MILLIS_USER_TIMx (0<=x<=3) is defined. -- // HOW TO USE SECTION ENDS From ecd4dfc78bcd4fe12f9e54489cddae38c3ac8070 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Tue, 21 Sep 2021 21:31:38 +0200 Subject: [PATCH 168/298] Clarification Systick use by SAM(D) architectures --- Language/Functions/Time/millis.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index 82cb8da73..0722bd1fb 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -66,7 +66,7 @@ void loop() { === Notes and Warnings Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. -AVR-based architectures program a timer to implement millis(), reconfiguring these timers may result in inaccurate millis() readings. ArduinoCore-AVR relies on TIM0 which is programmed to generate an interrupt every 16384 clock cycles (clock divider set to 64, overflow every 256 ticks). The same holds for ArduinoCore-mega-AVR, except that it uses TIMx if MILLIS_USER_TIMx (0<=x<=3) is defined. +On some architectures reconfiguration of timers may result in inaccurate millis() readings. AVR-based architectures program a timer to implement millis(): ArduinoCore-AVR programs TIM0 to generate an interrupt every 16384 clock cycles (clock divider set to 64, overflow every 256 ticks). The same holds for ArduinoCore-mega-AVR, except that it uses TIMx if MILLIS_USER_TIMx (0<=x<=3) is defined. The ArduinoCore-SAM(D) architectures rely on the Systick timer which is programmed to generate an interrupt every 1 ms. -- // HOW TO USE SECTION ENDS From 36b385799dca3dc2695bfae60ae5a0dd23a7f15b Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Tue, 21 Sep 2021 21:36:29 +0200 Subject: [PATCH 169/298] Simplify language. --- Language/Functions/Time/millis.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index 0722bd1fb..10514ad67 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -66,7 +66,7 @@ void loop() { === Notes and Warnings Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. -On some architectures reconfiguration of timers may result in inaccurate millis() readings. AVR-based architectures program a timer to implement millis(): ArduinoCore-AVR programs TIM0 to generate an interrupt every 16384 clock cycles (clock divider set to 64, overflow every 256 ticks). The same holds for ArduinoCore-mega-AVR, except that it uses TIMx if MILLIS_USER_TIMx (0<=x<=3) is defined. The ArduinoCore-SAM(D) architectures rely on the Systick timer which is programmed to generate an interrupt every 1 ms. +On some architectures reconfiguration of timers may result in inaccurate millis() readings. AVR-based architectures program a timer to implement millis(): ArduinoCore-AVR programs TIM0 to generate an interrupt every 16384 clock cycles (clock divider set to 64, overflow every 256 ticks). The same holds for ArduinoCore-mega-AVR, except that it uses TIMx if MILLIS_USER_TIMx (0<=x<=3) is defined. The ArduinoCore-SAM(D) architectures program the Systick timer to generate an interrupt every 1 ms. -- // HOW TO USE SECTION ENDS From 86383e106bfeedb199383f495a300df289c784e1 Mon Sep 17 00:00:00 2001 From: "Brian A. Danielak" Date: Wed, 20 Oct 2021 14:00:15 -0400 Subject: [PATCH 170/298] Make array size match array literal size (#851) --- Language/Variables/Data Types/array.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/array.adoc b/Language/Variables/Data Types/array.adoc index b038a83db..9e16293a0 100644 --- a/Language/Variables/Data Types/array.adoc +++ b/Language/Variables/Data Types/array.adoc @@ -21,7 +21,7 @@ All of the methods below are valid ways to create (declare) an array. ---- int myInts[6]; int myPins[] = {2, 4, 8, 3, 6}; - int mySensVals[6] = {2, 4, -8, 3, 2}; + int mySensVals[5] = {2, 4, -8, 3, 2}; char message[6] = "hello"; ---- You can declare an array without initializing it as in myInts. From ea5cdd5037233c364e9c68db186c2c53decaf1cc Mon Sep 17 00:00:00 2001 From: jbchilders <58781054+jbchilders@users.noreply.github.com> Date: Fri, 29 Oct 2021 13:40:12 -0400 Subject: [PATCH 171/298] Update for.adoc --- Language/Structure/Control Structure/for.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index 7e02a21f7..6724e1e58 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -51,7 +51,7 @@ for (initialization; condition; increment) { === Example Code [source,arduino] ---- -// Dim an LED using a PWM pin +// Brighten an LED using a PWM pin int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10 void setup() { From afdbba31ec269fd89b7e2b8244a1e1320c864bce Mon Sep 17 00:00:00 2001 From: Melissa <54317642+mkaivo@users.noreply.github.com> Date: Tue, 2 Nov 2021 09:11:27 +0100 Subject: [PATCH 172/298] Add an example code to abs() [CNT-1196] (#841) * Add an example code to abs() CNT-1196 Hi, we got a request to add an example code of abs(). Could this work? It is a pretty straightforward function. See the Jira task here: https://arduino.atlassian.net/browse/CNT-1196 * Update abs.adoc * Update Language/Functions/Math/abs.adoc Co-authored-by: per1234 Co-authored-by: per1234 --- Language/Functions/Math/abs.adoc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Language/Functions/Math/abs.adoc b/Language/Functions/Math/abs.adoc index c24610f7a..d494e4c1f 100644 --- a/Language/Functions/Math/abs.adoc +++ b/Language/Functions/Math/abs.adoc @@ -45,7 +45,34 @@ Calculates the absolute value of a number. // HOW TO USE SECTION STARTS [#howtouse] -- +[float] +=== Example Code +// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ +Prints the absolute value of variable `x` to the Serial Monitor. +[source,arduino] +---- +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + int x = 42; + Serial.print("The absolute value of "); + Serial.print(x); + Serial.print(" is "); + Serial.println(abs(x)); + x = -42; + Serial.print("The absolute value of "); + Serial.print(x); + Serial.print(" is "); + Serial.println(abs(x)); +} + +void loop() { +} +---- +[%hardbreaks] [float] === Notes and Warnings From 251e4d21ad9932d9dc703a4206c7f2662f279dc0 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Fri, 5 Nov 2021 23:39:57 +0100 Subject: [PATCH 173/298] Add missing space in ASCII DOC line break --- Language/Functions/USB/Keyboard/keyboardPrintln.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc index 1ae3551ce..3a6b8b5cc 100644 --- a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc +++ b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc @@ -23,7 +23,7 @@ Sends a keystroke to a connected computer, followed by a newline and carriage re [float] === Syntax `Keyboard.println()` + -`Keyboard.println(character)`+ +`Keyboard.println(character)` + `Keyboard.println(characters)` From dc145796273217bb435519965461c46c20889b22 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Fri, 5 Nov 2021 23:54:51 +0100 Subject: [PATCH 174/298] Copy edit keyboardPrint{,ln}.adoc - a string is sent as multiple keystrokes, not as a single keystroke - these functions return the number of keystrokes sent, which is far smaller than the number of bytes. --- Language/Functions/USB/Keyboard/keyboardPrint.adoc | 6 +++--- Language/Functions/USB/Keyboard/keyboardPrintln.adoc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardPrint.adoc b/Language/Functions/USB/Keyboard/keyboardPrint.adoc index 1f5014d73..f93530145 100644 --- a/Language/Functions/USB/Keyboard/keyboardPrint.adoc +++ b/Language/Functions/USB/Keyboard/keyboardPrint.adoc @@ -14,7 +14,7 @@ title: Keyboard.print() [float] === Description -Sends a keystroke to a connected computer. +Sends one or more keystrokes to a connected computer. `Keyboard.print()` must be called after initiating link:../keyboardbegin[Keyboard.begin()]. [%hardbreaks] @@ -29,12 +29,12 @@ Sends a keystroke to a connected computer. [float] === Parameters `character`: a char or int to be sent to the computer as a keystroke. + -`characters`: a string to be sent to the computer as a keystroke. +`characters`: a string to be sent to the computer as keystrokes. [float] === Returns -Number of bytes sent. Data type: `size_t`. +Number of keystrokes sent. Data type: `size_t`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc index 3a6b8b5cc..43deaf2fa 100644 --- a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc +++ b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc @@ -14,7 +14,7 @@ title: Keyboard.println() [float] === Description -Sends a keystroke to a connected computer, followed by a newline and carriage return. +Sends one or more keystrokes to a connected computer, followed by a newline and carriage return. `Keyboard.println()` must be called after initiating link:../keyboardbegin[Keyboard.begin()]. [%hardbreaks] @@ -30,12 +30,12 @@ Sends a keystroke to a connected computer, followed by a newline and carriage re [float] === Parameters `character`: a char or int to be sent to the computer as a keystroke, followed by newline and carriage return. + -`characters`: a string to be sent to the computer as a keystroke, followed by a newline and carriage return. +`characters`: a string to be sent to the computer as keystrokes, followed by a newline and carriage return. [float] === Returns -Number of bytes sent. Data type: `size_t`. +Number of keystrokes sent. Data type: `size_t`. -- // OVERVIEW SECTION ENDS From 8c498c1836c99b95707bab3ae77cf0c7dc58f7bb Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 6 Nov 2021 00:01:15 +0100 Subject: [PATCH 175/298] Clarify the end of lines sent by Keyboard.println There is no such thing as the "newline" or "carriage return" keys. Instead, Keyboard.println() hits the Return key, more commonly known as the Enter key. --- Language/Functions/USB/Keyboard/keyboardPrintln.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc index 43deaf2fa..062b9c92f 100644 --- a/Language/Functions/USB/Keyboard/keyboardPrintln.adoc +++ b/Language/Functions/USB/Keyboard/keyboardPrintln.adoc @@ -14,7 +14,7 @@ title: Keyboard.println() [float] === Description -Sends one or more keystrokes to a connected computer, followed by a newline and carriage return. +Sends one or more keystrokes to a connected computer, followed by a keystroke on the Enter key. `Keyboard.println()` must be called after initiating link:../keyboardbegin[Keyboard.begin()]. [%hardbreaks] @@ -29,8 +29,8 @@ Sends one or more keystrokes to a connected computer, followed by a newline and [float] === Parameters -`character`: a char or int to be sent to the computer as a keystroke, followed by newline and carriage return. + -`characters`: a string to be sent to the computer as keystrokes, followed by a newline and carriage return. +`character`: a char or int to be sent to the computer as a keystroke, followed by Enter. + +`characters`: a string to be sent to the computer as keystrokes, followed by Enter. [float] From 948c6c568a92dcc39d28160412a7d03c90eb5e61 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 6 Nov 2021 14:31:17 +0100 Subject: [PATCH 176/298] Document the layout parameter to Keyboard.begin() --- .../Functions/USB/Keyboard/keyboardBegin.adoc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardBegin.adoc b/Language/Functions/USB/Keyboard/keyboardBegin.adoc index 1a36f3f90..f2b01694b 100644 --- a/Language/Functions/USB/Keyboard/keyboardBegin.adoc +++ b/Language/Functions/USB/Keyboard/keyboardBegin.adoc @@ -20,12 +20,26 @@ When used with a Leonardo or Due board, `Keyboard.begin()` starts emulating a ke [float] === Syntax -`Keyboard.begin()` +`Keyboard.begin()` + +`Keyboard.begin(layout)` [float] === Parameters -None +`layout`: the keyboard layout to use. This parameter is optional and defaults to `KeyboardLayout_en_US`. + + +[float] +=== Keyboard layouts +Currently, the library supports the following national keyboard layouts: + +* `KeyboardLayout_de_DE`: Germany +* `KeyboardLayout_en_US`: USA +* `KeyboardLayout_es_ES`: Spain +* `KeyboardLayout_fr_FR`: France +* `KeyboardLayout_it_IT`: Italy + +Custom layouts can be created by copying and modifying an existing layout. See the instructions in the file KeyboardLayout.h. [float] From 3a87ec432461b36d5d807fb4fd1e14ab77efdac7 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sun, 21 Nov 2021 15:28:46 +0100 Subject: [PATCH 177/298] keyboardBegin.adoc: Add Notes and Warnings Move the note on custom layouts to this new section, and be more specific on the location of the KeyboardLayout.h file. As per per1234's suggestions. --- Language/Functions/USB/Keyboard/keyboardBegin.adoc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardBegin.adoc b/Language/Functions/USB/Keyboard/keyboardBegin.adoc index f2b01694b..2c27dbf0f 100644 --- a/Language/Functions/USB/Keyboard/keyboardBegin.adoc +++ b/Language/Functions/USB/Keyboard/keyboardBegin.adoc @@ -39,8 +39,6 @@ Currently, the library supports the following national keyboard layouts: * `KeyboardLayout_fr_FR`: France * `KeyboardLayout_it_IT`: Italy -Custom layouts can be created by copying and modifying an existing layout. See the instructions in the file KeyboardLayout.h. - [float] === Returns @@ -82,5 +80,10 @@ void loop() { } ---- + +[float] +=== Notes and Warnings +Custom layouts can be created by copying and modifying an existing layout. See the instructions in the Keyboard library's KeyboardLayout.h file. + -- // HOW TO USE SECTION ENDS From 83ea3575881ee7b7d57fd9f4fda4671cc2bb4391 Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Thu, 2 Dec 2021 15:29:24 +0100 Subject: [PATCH 178/298] Added picture for SPI documentation --- Language/Functions/Communication/SPI/api.adoc | 269 ++++++++++++++++++ .../Communication/SPI/assets/ICSPHeader.jpg | Bin 0 -> 15824 bytes 2 files changed, 269 insertions(+) create mode 100644 Language/Functions/Communication/SPI/api.adoc create mode 100644 Language/Functions/Communication/SPI/assets/ICSPHeader.jpg diff --git a/Language/Functions/Communication/SPI/api.adoc b/Language/Functions/Communication/SPI/api.adoc new file mode 100644 index 000000000..d9e8d455e --- /dev/null +++ b/Language/Functions/Communication/SPI/api.adoc @@ -0,0 +1,269 @@ +--- +title: SPISettings +categories: [ "Functions" ] +subCategories: [ "Communication" ] +--- + +== SPISettings + +[float] +==== Description + +The SPISettings object is used to configure the SPI port for your SPI device. All 3 parameters are combined to a single SPISettings object, which is given to SPI.beginTransaction(). + +When all of your settings are constants, SPISettings should be used directly in SPI.beginTransaction(). See the syntax section below. For constants, this syntax results in smaller and faster code. + +If any of your settings are variables, you may create a SPISettings object to hold the 3 settings. Then you can give the object name to SPI.beginTransaction(). Creating a named SPISettings object may be more efficient when your settings are not constants, especially if the maximum speed is a variable computed or configured, rather than a number you type directly into your sketch. + +==== Syntax + +---- +SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0)) +---- + +NOTE: Best if all 3 settings are constants + +---- +SPISettings mySettting(speedMaximum, dataOrder, dataMode) +---- + +NOTE: Best when any setting is a variable + +==== Parameters + +speedMaximum: The maximum speed of communication. For a SPI chip rated up to 20 MHz, use 20000000. + +dataOrder: MSBFIRST or LSBFIRST + +dataMode : SPI_MODE0, SPI_MODE1, SPI_MODE2, or SPI_MODE3 + +==== Returns + +None. + +[float] +=== `begin()` + +==== Description + +Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high. + +==== Syntax + +---- +SPI.begin() +---- + +==== Parameters + +None + +==== Returns + +None + +[float] +=== `end()` + +==== Description + +Disables the SPI bus (leaving pin modes unchanged). + +==== Syntax + +---- +SPI.end() +---- + +==== Parameters + +None + +==== Returns + +None + +[float] +=== `beginTransaction()` + +==== Description + +Initializes the SPI bus using the defined SPISettings. + +==== Syntax + +---- +SPI.beginTransaction(mySettings); +---- + +==== Parameters + +mySettings: the chosen settings according to SPISettings. + +==== Returns + +None. + +[float] +=== `endTransaction()` + +==== Description + +Stop using the SPI bus. Normally this is called after de-asserting the chip select, to allow other libraries to use the SPI bus. + +==== Syntax + +---- +SPI.endTransaction() +---- + +==== Parameters + +None. + +==== Returns + +None. + +[float] +=== `setBitOrder()` + +==== Description + +This function should not be used in new projects. Use SPISettings with SPI.beginTransaction() to configure SPI parameters. + +Sets the order of the bits shifted out of and into the SPI bus, either LSBFIRST (least-significant bit first) or MSBFIRST (most-significant bit first). + +==== Syntax + +---- +SPI.setBitOrder(order) +---- + +==== Parameters + +order: either LSBFIRST or MSBFIRST + +==== Returns + +None + +[float] +=== `setClockDivider()` + +==== Description + +This function should not be used in new projects. Use SPISettings with SPI.beginTransaction() to configure SPI parameters. + +Sets the SPI clock divider relative to the system clock. On AVR based boards, the dividers available are 2, 4, 8, 16, 32, 64 or 128. The default setting is SPI_CLOCK_DIV4, which sets the SPI clock to one-quarter the frequency of the system clock (4 Mhz for the boards at 16 MHz). + +===== Arduino Due +On the Due, the system clock can be divided by values from 1 to 255. The default value is 21, which sets the clock to 4 MHz like other Arduino boards. + +==== Syntax + +---- +SPI.setClockDivider(divider) +---- + +==== Parameters + +divider (On AVR boards): + +* SPI_CLOCK_DIV2 +* SPI_CLOCK_DIV4 +* SPI_CLOCK_DIV8 +* SPI_CLOCK_DIV16 +* SPI_CLOCK_DIV32 +* SPI_CLOCK_DIV64 +* SPI_CLOCK_DIV128 + +slaveSelectPin: + +* slave device SS pin (Arduino Due only) + +divider (Arduino Due only): + +* a number from 1 to 255 (Arduino Due only) + +==== Returns + +None + +[float] +=== `setDataMode()` + +==== Description + +This function should not be used in new projects. Use SPISettings with SPI.beginTransaction() to configure SPI parameters. + +Sets the SPI data mode: that is, clock polarity and phase. See the Wikipedia article on SPI for details. + +==== Syntax + +---- +SPI.setDataMode(mode) +---- + +==== Parameters + +mode: + +* SPI_MODE0 +* SPI_MODE1 +* SPI_MODE2 +* SPI_MODE3 + +slaveSelectPin + +* slave device SS pin (Arduino Due only) + +==== Returns + +None + +[float] +=== `transfer()` + +==== Description + +SPI transfer is based on a simultaneous send and receive: the received data is returned in receivedVal (or receivedVal16). In case of buffer transfers the received data is stored in the buffer in-place (the old data is replaced with the data received). + +==== Syntax + +---- +receivedVal = SPI.transfer(val) +receivedVal16 = SPI.transfer16(val16) +SPI.transfer(buffer, size) +---- + +==== Parameters + +* val: the byte to send out over the bus +* val16: the two bytes variable to send out over the bus +* buffer: the array of data to be transferred + +==== Returns + +the received data + +[float] +=== `usingInterrupt()` + +==== Description + +If your program will perform SPI transactions within an interrupt, call this function to register the interrupt number or name with the SPI library. This allows SPI.beginTransaction() to prevent usage conflicts. Note that the interrupt specified in the call to usingInterrupt() will be disabled on a call to beginTransaction() and re-enabled in endTransaction(). + +==== Syntax + +---- +SPI.usingInterrupt(interruptNumber) +---- + +==== Parameters + +interruptNumber: the associated interrupt number. + +==== Returns + +None. diff --git a/Language/Functions/Communication/SPI/assets/ICSPHeader.jpg b/Language/Functions/Communication/SPI/assets/ICSPHeader.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e2c463ed4918425984f94591e46aed8cbcb10a73 GIT binary patch literal 15824 zcmbt*RZv{Pm-paK@ZjzibZ~bK?#@7P3rui=ySoKqybP+PypGF2k^cQkoeE+|J42i@_z#O&*AqT045^9 z2=E94MG1h$go43@dLICg0H6TSF#q8L{<|R{!oedU!$QM+u=y|mP_WR@9~}w`4i@EO z%f~t#JQM-|5gQ8!7Z39@5)_LH=*pk1sS7 z3@jW1JmLqJ3ljhX_?UiR!$89#eC&dP{$OHa0pPJIaM&ruRB@>|5KQsJo&Bjf)zr=6 z>w4eU0H`n@pqMb201?3b>@e|nvP$19=aB-F_43sfUHg`2@MG)pFV4eM1trA(T;D)Vex{e6uMVzx ztf!d*$xNbim*r8^x{{{v0QnUQN5PU_AMvD>1M|7{Dby#`sQn^e;YIK#yij9qk?K1P(g z-WX}W9%<*rK}VZ`2?L&wZMSPs)0o5#J-j1}DuZM|_xOVW9VWL2WFj@zMam4AfRAT* zl#0^7i%N>f8xpK8ON6T%FnGvVk`GgKkQ^@FgJ3J4SQ#(psWcZ>L?Xw~n4CRUUa;iY z&cHYW&VHn)3FwO${XrFEsB1N*;qTJ2ht}FoQq|}+<8-IFYL}X6F5RxU_;gXn;=XbZ zJ5=z6v{ZhAiM1s@h~!h(SyU^gvyNn0Z4SfX+OJ=2#KG4!@MTv zom8~{B)U$rOlWW(_PA!BRi7=9MNa&3W&jQo!xoaL7n+)3KH;dM8;mI;X9(M`ayJ0d z)i6!CFnG7!c!$CbjqF8z#!&@d&F+Xa{$|S>T?&vb@Wdzo3(JmLgKgD#tzZ<_g0G?D z6z4fZ3C6Bt#3M}0`dCuSL}jQYoSdd<_qm}&LD>_?)xy=Zt&O8Tp%AOQH{|y#o*E)~ z1r?5~g#fOr8_3m!fJ9dZ9u|T4`(-H6c!VvAw4pf0&U#;BD#m)bGfS21%Tq!q&U~48 zLlljT^#mQ?8194dJ0QnLd3U+HTjF(U;7sHU=^cjp#`*%~&pGHY@

pUz9*=J49jy6tdK#Ea4}SR z^^j20CFPB{A(t64*N85Zv|H;|^h;}3%=n~cMu!H4Ai5v5^uXt<>YK2MVM0Rj!SS(u zMAnTZWZOBzhkR3xGE^iUqw*$6^=2Mk)ox*%;Zk%SCRE2tQf z=O*q<=%2~$lsa9Ti|1ws3M>-?dp>KZ4TM*(C~dZh$n{Dpzm;t2JMQmaWB+@S4!>Vr zneG7*T)AAn1DJ5n@;T36tI@6n-kdL2K2{=6ln<*}x9iH-J{y-A9_0u#4ZJFt_q>{& zqx@lud+iKB*v!5x5;*UiXYp$8H0|PitMu?;*lgLiJ+>mcVm=z#HsV6mEUCSD+5WcY zQ@tTmumIVQ3mnuWF!X(Fb<(^SUJeMzk}2MfzvJI^R2_r)Drak$Yug%Kav_I4crw11 z7!6FTW$}CmSlOY4Ru`dq-> zOm&ZDyZ9Dm1||RI8&Hsnc8SPNg~+Z=8yK|AC7rK^UKOMLY9SJ>m3Z{;HHn7@(lnmA2aD406?ajO*a{SmN&yx7cMfC;?u zT?}o36H>9qm}ZE#aJjCN_7!96LGVJH-di$MFe)>;t`!g}S(N8#(R&AoU$Bso_!c%^ z^e@@eOY4{2aZmgv?0o8%t>0I@{vspa#$YME0DUw3p>6o08;$6i(4UXM#aCa#WpPdg}`JckvbHx8%GCEm^YOHb@^KZ;S$vgu-Qp|9 zOL%W;oTqj@|f4{Z5`88OsI4q5C@pv+Ij-J>l{kOX`Gttwyh1L6ukS%S$&n`l^Ix?UDgnU>4_{?& z%7~A_ZrdAI;(?84h_ZlAgc3uDMe655k}pzBnWV%VGCG@TToSL3=i%21?*QB0r3^-n zxYY^Zs7Q5GcpU%S8Fs}KA_v6}Ftmf=5>Zd30v9KGoEW|W;O#l^oN%?1mXSE907TWm zwj+w%GfF9%?dt|M?ChvCjT;fdgwe(%-7AO|W<$kHt1o<2LLDzqeD7PQqSGB%-CesNISJC}^NGG#SLhne=sOrZjRnuEYL^75Ihm2kM_F3}wV%SgOpCwYl*dGUY7`N^g%4JNj6w7|EUV`jC zX&|YFrZ+!k&(4PKK}AQF1k?T~2rmpgVJ7XE7?x}u?`F{C3|~LcI<`~ZPld@ISBtDM z|5Xu1tss(tZO1l-mZy!mNM@)+Fu37m_p`46RRjP0;;%;sLnC(+yP5kY6rH6i8Tirt z#azqVp*W~!$_x)a3*{c#*>B0!h-yZWvGr3q{15P529X>j+52ppYYl3Q?X4&4Pwh}v zr;a8Ty(udPx@33$DlGC<^T%SN<8t)=8$ne`-d(L71y~nZT&fh~3r%_u zT8F%XlQ!SXp3b%+n*p-VwV?F1gl$QViOe6|#h7DwkUIllo#CEqXC|dA2%w z%8oa$GMv&2|B*s87XPlVK;hvj*0?sZVu9EmWt9?mqJETu%Hp?6C7if-Afr1Nfp-2a z?Yfao#*S~RuNgclL|usoh!OuFs$ou-Yy^0RRi$;oY|SjJG=sIJaL;&e^a2F+0&=sP zs!ib4K1JgtrTP*9Vfs=eu;6@UJsY|52;vkQr#c5_KH}b3zXVh&LqH6^XgUqWr~c`) zo@L>$iz4fEGH;1*tB0@Z&sr7N#-fkYDNoafci(2a90%V4J4y4>ifxI$`H zD)XwYx3j zBxo&VCOI$v=_T*`9S_@_cxrVEi5nJg#uuC4jaln;VcVoV7PQ><#>dLpL=rP+mDT?q z(=F#lT~6^8UEt*!t3rNcJl{MR-xOW~|Jq*3#JRcXK1Dwf5w-D=`I>H7fQy7eXR>CB zCfqwTw3<*x3Acd6@y~&>j>Rq~GephOlyMQCF~HI9-*|%~VNKJLa-zg0am(%0YSFJv zcGq@)@zrl`gCVkd$1-Bk)ENJI0@8;{w&H$8PM~1A>|kT^3o6pg7Hw0laOgoM4ve9Vb!VBrEoCbK z)D~3Tq2!dhDUsp7+FX9xsaAEi*{feKw%x!vZD#8&8BM{~q!qgAJNwGY#Aqp-Oj;#~ z#Z)7i{NkpkM#EXeh-n+Zo*o#evc7ZsZ=YJ&uWbwFJY#sA_D?cOyjUwA$rf)EvJy$q zJ#AL@+dFLiOQLMds%h!xJL14s#ZTEVwa*1aZ8uI&j0#%)7tvq!mPHm4%LmYRX6n~& zlt|OIOiR)J7%(IBO@z%mVJmxA+OUHxk7HF7ncr%T5~k@B<$vfcIsKvOI;Q3e@t0sR zbrdXW=>U$~H*Von{z1z_{Q8GMnf-Y)^;{ue!PZIFR3UY>;a~JAp(Ke3Rq-9(fDwrF zS9Gq1?Vqwm(nroOpc1*Bsu*}9i7Od4AfYm-O0`C8;b|$pssMzNjGU|=Rl`pE-L78s zA(n)Nxmnj7-#V)60B=V}+TdTFob4CELW}(#qK4u{pUuWx9;o&}@6(E4z3R4TpL2ER zs)f~vNa})!1XrHXB1J_G*P*XY9%||=QFz!?a49pKy!M8bcw3+*m0$8V@i`gRa;i+d zIT;A$oc)@qv7<6m>aFLB%Q@Pcmw3Nf+N(mM97|V22ib|4C zy6U?$3V^`TwcS9ph98r=0(i5^p)6P!H)5)v$YAtK8)!oGH7Y9=QJw5{EL56cL0z&B zHzryMk0M6PXMayBR=A9hPaBD-wt{gSH{7I)pMx>JCei!*ny>*LBn4EhVrr^N)n)^q5ei;yZ)bCB*y4=?^)w;{H9F z?zhM%9T>iNs-)+nw0>nqE)SDpFJ_2z6uP+c4v2gpqiUZY07~Ng1|R|kl@FZRzB5+lGpy567JfIfahqESbomY~ zl$NB}O*)FufYb2W1~P>GF>a^WQJ3y^MuEH+tftp~p z7cDnibRUqbE3DJdXys&L+OSmA#yr=-g|3uJdi+w4V9FO{*`QC@<5uhWLVi~!JCj#f zIWY)W43MVe+d+(t;J1J&mTZ|pWG?B04KTpb4yRZmw0Gn!k~Hp*Cvuj-2JThobzif6 zch;bN2ka1BrA|TycPf7dh+%`S#r6o|>cZiad;U%KjnWKvNqxo*5)RPHT45tX_IFoZ zi*0`DHUrV>6y4EQWm9%CJwzePYXvQ6w6S^U#2vd?sm_(RQ6=? zV51_{=*b9d^E20F7rYRv3*D+F)^QX~>oMk`rWQbHp^c&wqNAVaNSNTLWjQ1eZ5`P1 z7IrW9=_nKAvDQe`9eHlXty#Vc6kq09{7wKjK6%?y{YknS_F$XYLF6*8!pDPmwH7si zm4gCF{SzKYJ13k{Il<0C9I5l8?x(g6-g$VeJWljyP6A8zOq=d< z$rI{$5RMdiQbQ1YuylfmC%-in(cGZzl-QFs zwA(Bjfm^>twyXXKe(8*OeW|5V;__;dLa8-tV2dqMkL zsT!=cF^3y7Cl4OCo&y_}t7gZ9Om$-L7~5d%>KU3J&GVNv@0<=T_tzk|q{qi5n5nK~ z8M>w~Jds?jqxme#M)-`CxHZ{#PPS6JEm+5Ut|*n6*T~7JCsJWBGY5@JER{ETPwUCW zSdF}_*x4pAv|MkB6Ai==C;2IP<+r`cCRW1LHw$W|W;G<+Wz1kMm0EI#OB2w-_Qshp zaR(dbTf4YO;Cojo1Ahy8z{z%>X%ey;VWg@BgpVdYrzcNL2fPmgaMFTizsU`U2Ip>-h*WZj-Y!X6Uz zhh7{b%amRmJBo%unJuXVe~3NGJf}+oym5Zpx_#4(vA#LoQ%rGem6FVf`_6h;3PPW~e*d))jBHO++-p#a}#GU`>Z zjjP~`YoSK6Vmp0wA@0iVCUv~zJ;feRn$SLv#8a|)-nYhetk|Vz+y;Jh6x9JD>k{L$ z`}}ZhYitWG>70DcyMZzy46B5SLLg0oGkgCMDm(imL}99$!qKp+_s~6BE;{q{iE5v< zDKpr`S2>aT2FFW)F@xxDgGC;vNo~vn?stn|h63oEz5#bNb0RW$wo%7@6*T1%$lW`@ z+A8y6yZpd4m`C$eAz7LOIBiinzEP8c5}sSHjv%dezzmRHFd;x~5cQQdhR>n<8HL9Q zjgybxjgy?`AWJ=(BN%Kyo8DdAI$(nb<>EZJ9>U7ciT^Dz12(FZBa!+lEC=fbE$Cs- z*&-uaS%!^Vb&PBJ|D{%s zX=_QFBAzUvb5hFzwfP+|h9e;iE$i-hDfo+w5u@?KbJt+rjfNJ+(00YKX5MC}gBV9- zM1JfUGmI@AA@dQbp|D8)HbocxX@WNtd+)>TWQ{0pWo)Z#l%@(B@FssnuS6Qx>9!!-Fs5m z!>VUQ&v+Yc(tY(g&1Pk18gEX;R>8*vhOP&Um$wgy2VxAcO0dsVQ;oL!_!7dRux-ny zA#=-{%JXhE(tpgq89^=v@{c1R*D=mzeanVj)AA+)zBCJRii#`w45suv_R39Jm|SBe z@<^#_*I{pUDQ~}Rc|DYrJWsJVe?{T6ik%8bGuf&P!rx896$>o!1Phi{RYIDT4(>jXzh<|CPHNjCMz%~XKfW|CHQjhH zqYCTSpyMHirg@^8LSbov?b4($NmusLWE*ajCmS$eCK~qVX>Fz!;CoEN?+E@+|1-o z_o(2{EvOVdqd+GpYNf}b)heZAX2B*P!4`Z61TsU+O--q!BLH%!Dyi+ZweL*Df(>klFTua)EY>W{u+c#_Dvk8HjUdqt#thxamhBr^GaLg= zSZQ?rT!#=By;?32$p`WJ0P^7k(TWnDH4SqqiL1PvL&1Dqre3X?-URe{>#5pfLH zj0pu&xFlhB<5t(w)c&vzN6u+^IuE@%m6rAKL|nLHXb8mGp7LE%MFE#%CCmd}wBl<4 z6-?SA9xIC(5F-1837lflor&_M*swwv?2s&{bkM^jL8}-~x5aJsuZq78J&yU*=}SH) z?L!);Nh55jteVv?_R8Uw0hxCmBWGiJ=&4;pOUM55{AgwwDi#LCH2PlaN*aH+`A9Zc zD_5Q^3Iv*$!U#s5LMGbmBVu-z6;}y8O52&Ge8Y=}qp7GN!3-+cKtj7$!PU|;;Y*dbyfx|N{AKSyiD%83lyS}Ax6)@iqQtppX(KZavTzq9PsPr6spPIhC;T`_ZY zjvAWrlQ#Px;9J@}JkgdU7VUB%E3aj#$-p}l?NyUT^(dW$fA#uXOBJv4X88_C*zbPs z%%;ghn$=;^?l}3wyx0JYa3e&TNStKG1Y@rY!J;TCB!+A+mR(|?a(+3>KdDre@wR;B zc8jg&UxsAJCw95hkdh^u^H)F4$>X?fCEyu*QLfs)u+qzEoGSa9_n&5|~VCyd`ONrmp2R6RxELg5}ZI z>{{}GK|J3kn=}g#*o`0}(OVU|{MHLB7WviR>mVpe{FOi^U6s-Ae*&_br?O30u^8@a zQ>W39Xq#}uW%S56YQkP3&0u?3;D@=+SoGB<7p-v?++K~9eTXe=xi3&DqMp9G5bc)D z-<-0N0{&@njdAy2l$&|$%>BqoFERT1mU+?^qwVx!hrV~=dpdKx{(a(t_}AgQeb5@6 z8*y4?&K${nBhLL2uvDCRNaeQpqpS>>VT^ecTn~oQICGLqxOMQmR!&sG@?O9;bilcqD zLJe4z-Ci8itwKr%G2EmmYvdC#zkw@Q-q}CPqp)T%WdWknLB%WIsjIA2h2nLlfautB zY;UBlcp+4a+Ro-uA&&f6Z$b2~Uk}{4Qs#!Dt~vBc!j1R7Ls7R{S*p+CE_fnx7u43I zmtAr@uc&2rX(6sd(RAy|XB8M9G8w}{LE(UC&Z}16tN6!S42JL6{aY=BOu`YkYaIz0 zR$%h_YCUfM=RU`xNvYhS6G1z{R_Sbpel}QA`${2xw<|~!1Tq$vWy@b0#d3&981cA6 zuyANi2K#g~RN>US2wS{}QCOapjve)uC@}B35i|TQQY>Q(a(j}ED=xN!0eGXG|D=uR zSO}2e8|gID5nP*3D_2uIaS=jimAxpozOtkNm4KE>Eae)o;V~%~D6e@U1^DQ9<(=n{ zXciz@EvMBiy3=nWQRXRslS=Xpy&-P*iZCc1^=IGD)s+P$n}mVcPrwDH19`H5%Yr=`Ej8b4r1NT?gRRHzR zcz3^Winj8PPqHYr%~vghQr4qeqW)MpqYU8$m+-1-MltXWIY(Uuy#t6+kWRMhcyzZ8 z_lk1xa%%3QwR$bM9aDS|?6l&%Q>!IQHpcT7Yg8adp`;XwExZq(N3v>*jf_R_xD^DMA$%|(6_ zf==#NT% zOOi@6TfMezywc5$)E&lb9gA^MrcUR8QrZlWs)4l!*QE>Mpi9f^-U?XL`2MLo)@hD2 zzWrOfn`eQ>=&!QaTCjm=bYEnB?mc{G)Zz~~Xf}%KTS~#%y3baqSh~V5V+j>}@$9H1 zVF?+I$UX9?L|6)Z;d4xGnv673!-n5N7_xL0Iu!^MOt@KhfjTb>ca(|JB>ZLd0pTTiEokiSNU8Xse5@Dux#xK1vPL z!Nd}y#G`@j2-)Al=ahHV7T0EU)q}CIFd65e5FZFgTcP72*B*F)%rm)8)%0NNu1?N= zBTFZisqP{6%nzu0c&rJIxWiQ+r(-r3kB29~p2{La!xl(+xVC2Z%o2<&Y}e07_j)8* zby6OeYe%HhWRQ+T{j<+XZ%({oNz*qRtKN#4pp|MUzipq?R>^;W)A7gVWot|QfkfX6 zrK9?z-_`j|`q+^qAaVqxP*rbY--E*)W~ILtMuenUZz*^2cH$Qfk+$ zFmYQh(FLWAoPf^hbV%dneHcyXDT3kpBQJkkZ{7hmg=aEo9Zg#~6tm0aCH7b)WeP6$|1V8dt#C@Xv77b2L^vAhYB62?nc(32qst`nE_rBC;erYkh3WDgt^r~o{dHyycWm} z5n18++kpP_Z^KhXcl5l=5&a*2s>X1bue`p=&phLYhuuGX4u5x{tj0e)#OC{zdUua_ zeVy)n2hg3p4!`-uX8vkzL=L3Z1DmU|f>&N|QNbYNZyB5yLgmg*S;QYE z`FS^uu~#mgGh|cE(7E-ws%5Zo)oov*B1*#qBJ~u6#|o~h!#4kdV=H#MJVCF+-xR~< zoq1OKtZQ}uD%`PeS8#bW>3o3_dR;~y&yxM{0@k!Kan&9f585_ugj+(a}sfm936 zO4WRWmR5%VPnG}<(BIdV0Ht5V&s6j6*OPiR5t+^LIS?gbkgm~x0!galg?)@d@wAcpvqvaeMS}X0)Al71s2`Iyhz=t&s8`)$XOYqBeMI zVUFt?<5Ahr<9Kn#x21Zg@KD-@sE&xqAb1Bp*V`$l4;_{5UghWNK>eC&R&;R_OTe5>RNC%~m%TgVuK=(hAGeeExYvXVNr$@5Lhl{8Au6pf6?cW_q! zsbM)g5ejTN+;)u$ZabeM-fB~i4I^t@}Iv_hZNvI8d|E;5ud zv?8JT&ZJm9^fG-J=Ol064o0ULjcN*~4eaN$0jba88XB{N|6>0+$%g+Z4F&5zO{=KQghpIg~PP&ByHkv9R{xcxtwo-^QpR4PT z+V(ubamyiBU>m<^jcLDZvTZ$PKvF&VJ;-mgGtzvCpZz6bm^HqyX~WWEHu6Xsi+h4kg>Sf(`lQn@ z-;Y{JQfWXb@g&;35uPqsg=xyqF!EcA;EWu44h4P!=y&HBW21#G4AIy%JK= zuX+R)zqp0>{?3-PK0udZga^{MXGo<>RPxmxS2}(a_~O;xNmIA8)(IvRsR#AhoD}~q zlsMChTzCgCG>JL?q$lEUH!U5Nk?M&qmMP+pEk{N6w0+Q##6c7vZg zor!N6GjjklDtUqQtv++0QkKxLpwYo=WG4SP|70+$1h3jisF!~x$@OiZqu)^2WbWa5 zHLPazrm~`a8iw^!d;$sTiiY7*Y`=nINM8si=2#i)mwE$Z*n=MsuBG5`XLqp=x?`0> zuVqiNWMFN$pAo(KF0T7bzfv=U$M!U}>HH$rlD3Am^ksrXqNQ;rAOm;UK!?^WA1R|^ z99@e&NRSmhgfAfo61V;txYnY&n%q!ST17yNf z50iMw0|X8Ttz#S6{KGiq-4h~c_9^0rNs?HWx81C)i{na&)l{+$aiCFt+++KoF5Xw` z9ZG68?#>-V>St{)p@n5?P1OW=^;7N|2Iu$fw*^tR+qI;noEg)9KQ}GYs67HTPO%EF zR%E*`dT}JfRge0Zn#t%mn?^47jO zXq}UYm!A?2o1AuM;4E2Y%*VNC;p?$$Y>Z=1{_Xwo(Yzh z9}U1^U@w+pm*s?>n&?Y-7*gNVBn8{~$Ak9}*rP1q$VFfcs*ZUIc5z334^s8O<9R1l zxE~Ek%f+nBYbz}hF)vf+T3qq;I}#wWN)^oe1Ytd@CMT>mEgTbNtKAvZH80xFUq-~( z9PsP918pFooMdFSk-tz=kOSFh^;{Rdit$PAhVA-_7`5h?1eo^x49+}BJ_6Ll5**v| z&C6BBcpnm(=r(gPY1db@&Le2dy>M% zL|iHoXr28_Ca27Y#4$w+p?AOV1(B|-A^D;?by}P=#n0(V zIJU|7lr3`xwWO61XUK-cM^X{hzvNY&J_8_7aM&rRO@|U|N58Lj&A=PHX@nWfVAID| zbcocKRAed=WuZHLe;9bhzG+AG(A_S(0iPGyB9vTK;W2+E_O|rZOsAPxmwgED)N!3t zxYaGMkfTIHdmd3O#u;OZ^iH4->K$Mz{tmch-~MNJsjGO!L2bQ%senqT2oo(YGH#wXC#FFysMU(dT$L>(x8np91S0WN(Y zd+o2ltyZ*{t>)ulVi*2jwQ;x^n;PO&C$|ssD{!N-6G=F*Di}N1Us%;c73AZ%oObJP zlJctCK;csqQiSR;7z)*GOG;|ikMQYo7013lx)6(J zCBFR;efYvZGJ+t0HY+sn)q>X? zEi`l2921GERy65Nan~_?TywLGe-DwInkW$EEtPrKvlp8Ml;4hj|njd#0kMH*!s@vMcT9y-c2q(y#q|T(H;lHKJy2` zC8Z55$qsh)z>fda-$B;jK}#Gk9U6+WuVk~8WGe#JKx{Q_o@ulgBh8j>7)~USe`=5b zZE}o~%KI7Ve@H}WXu2OA?ocHYQcWYnOQ2st?&2>c}urjZ_Vk1@;qk~e|X zdq>(DVrjB%Qb&IARjGA5^n5baQ7Z-`Y7vZJjcDH8Hm_*;ofFj0$M3We>oaAz(Ix}nN>{S2V z2DuDuR z(XT%9;pF)p@KNPb_-ozEvDPQ>NO;Wri1g#0>>}IgGT-m&K6v{Z@wol@BS24edMC2q zy8N)YPl84aD=GbRn_ZP%429_PXQJ{nczz%+9uW>X08tklf=WJQoi~UB&NKlN*{A4B zSjjt=soNNKV3}q6W^FFCCs_owg#Pt(sw5KhjYLo4Hz8L z@?_kO!V17PaQc}8-C+ET&_v!W1cCluuephB3x5ctEt_4pRVrpuvFGQa#V5oAMW31Q zG7Mi-u%Ne77`DQnyObr3OuOd&hA~0Q$MdrUNvW`4P(v(* z{qpkMqoPq+l%?$MzU)=`Vl$%Ec~i*r>{^?D!K?O6zYOPPv1H#=t3yywC)l0_9!1mP9S=hyG03bAox@9LSB0y$Y9cxlQ09HOTzb0E3^EyW zPL3%6IH;)k_^((D<~0P4!!-o^>Ukg!aYpaPIE=vBiIQV{yvT85V38(r3_nR|p%}qMu;lW|%6uHZ$=H z@oSEBMp6qo69eUhF^$>RieMQm7DN{0Wnm0;)9pupQ^n0q0cb;A`e{PpHS4 zs!zTBofgs2{Dk}iXC}(Z{-0o_SRuIN%y!|bvwK-6us{Y7fM|egH=wrA;$g3j zb#Noa>|A_8fxV#Sa~_?G;qs*=UE-H~*%JViH~>0W6IqB}(_}37lbGgD3nDvwXdqQ- zfNf0%-l$o8^GaiJ@vkODHl2AqzHB$u#LQHa-S} z#(rqVhi{j6Bx*cb7_vtgXFr57R$|2KJNov`gXA?(Fw54=P*%9RH8x)N?_I|ug|?=N z*X>z!8FBy;tU3{;u8N8D0KuNP1`$atIx_(ZL#YZsk(a02q~-Oh-AdCzTXJZ!tIbxk zXL8*gEfa0-Q-^Z@3Rx{P^k*_+QB0I9mm0N-R2Tb%l~m^}oa-7h)=t|EVB6OC658J* z?OXK8tZc!S3P{lp6FbH%xD>;1>ozyNzwGr0L11oMux|NFQGTRpN-394S-9KakYqcN z8}DugC-w-_g_VJ-R-|-Uc)<#<={HAMf17JT7)5)2RT5QiZ*R~H{BvQQSL zFM>sE$N-AQu(|Ny6x;SyXA*w1!LEO@n|i1pn4o|;5Yd>3JjoG`Bx|2QV<=c+xg96T z2+C&Z71dY9$Xg1~h)OzZ7$#)Wc Date: Thu, 2 Dec 2021 19:00:37 -0800 Subject: [PATCH 179/298] Revert "Added picture for SPI documentation" This reverts commit 83ea3575881ee7b7d57fd9f4fda4671cc2bb4391. The Arduino Language reference is only used for the documentation of the Arduino programming language. Documentation of libraries is done in the individual library reference pages: https://www.arduino.cc/en/Reference/SPISettings --- Language/Functions/Communication/SPI/api.adoc | 269 ------------------ .../Communication/SPI/assets/ICSPHeader.jpg | Bin 15824 -> 0 bytes 2 files changed, 269 deletions(-) delete mode 100644 Language/Functions/Communication/SPI/api.adoc delete mode 100644 Language/Functions/Communication/SPI/assets/ICSPHeader.jpg diff --git a/Language/Functions/Communication/SPI/api.adoc b/Language/Functions/Communication/SPI/api.adoc deleted file mode 100644 index d9e8d455e..000000000 --- a/Language/Functions/Communication/SPI/api.adoc +++ /dev/null @@ -1,269 +0,0 @@ ---- -title: SPISettings -categories: [ "Functions" ] -subCategories: [ "Communication" ] ---- - -== SPISettings - -[float] -==== Description - -The SPISettings object is used to configure the SPI port for your SPI device. All 3 parameters are combined to a single SPISettings object, which is given to SPI.beginTransaction(). - -When all of your settings are constants, SPISettings should be used directly in SPI.beginTransaction(). See the syntax section below. For constants, this syntax results in smaller and faster code. - -If any of your settings are variables, you may create a SPISettings object to hold the 3 settings. Then you can give the object name to SPI.beginTransaction(). Creating a named SPISettings object may be more efficient when your settings are not constants, especially if the maximum speed is a variable computed or configured, rather than a number you type directly into your sketch. - -==== Syntax - ----- -SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0)) ----- - -NOTE: Best if all 3 settings are constants - ----- -SPISettings mySettting(speedMaximum, dataOrder, dataMode) ----- - -NOTE: Best when any setting is a variable - -==== Parameters - -speedMaximum: The maximum speed of communication. For a SPI chip rated up to 20 MHz, use 20000000. - -dataOrder: MSBFIRST or LSBFIRST - -dataMode : SPI_MODE0, SPI_MODE1, SPI_MODE2, or SPI_MODE3 - -==== Returns - -None. - -[float] -=== `begin()` - -==== Description - -Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high. - -==== Syntax - ----- -SPI.begin() ----- - -==== Parameters - -None - -==== Returns - -None - -[float] -=== `end()` - -==== Description - -Disables the SPI bus (leaving pin modes unchanged). - -==== Syntax - ----- -SPI.end() ----- - -==== Parameters - -None - -==== Returns - -None - -[float] -=== `beginTransaction()` - -==== Description - -Initializes the SPI bus using the defined SPISettings. - -==== Syntax - ----- -SPI.beginTransaction(mySettings); ----- - -==== Parameters - -mySettings: the chosen settings according to SPISettings. - -==== Returns - -None. - -[float] -=== `endTransaction()` - -==== Description - -Stop using the SPI bus. Normally this is called after de-asserting the chip select, to allow other libraries to use the SPI bus. - -==== Syntax - ----- -SPI.endTransaction() ----- - -==== Parameters - -None. - -==== Returns - -None. - -[float] -=== `setBitOrder()` - -==== Description - -This function should not be used in new projects. Use SPISettings with SPI.beginTransaction() to configure SPI parameters. - -Sets the order of the bits shifted out of and into the SPI bus, either LSBFIRST (least-significant bit first) or MSBFIRST (most-significant bit first). - -==== Syntax - ----- -SPI.setBitOrder(order) ----- - -==== Parameters - -order: either LSBFIRST or MSBFIRST - -==== Returns - -None - -[float] -=== `setClockDivider()` - -==== Description - -This function should not be used in new projects. Use SPISettings with SPI.beginTransaction() to configure SPI parameters. - -Sets the SPI clock divider relative to the system clock. On AVR based boards, the dividers available are 2, 4, 8, 16, 32, 64 or 128. The default setting is SPI_CLOCK_DIV4, which sets the SPI clock to one-quarter the frequency of the system clock (4 Mhz for the boards at 16 MHz). - -===== Arduino Due -On the Due, the system clock can be divided by values from 1 to 255. The default value is 21, which sets the clock to 4 MHz like other Arduino boards. - -==== Syntax - ----- -SPI.setClockDivider(divider) ----- - -==== Parameters - -divider (On AVR boards): - -* SPI_CLOCK_DIV2 -* SPI_CLOCK_DIV4 -* SPI_CLOCK_DIV8 -* SPI_CLOCK_DIV16 -* SPI_CLOCK_DIV32 -* SPI_CLOCK_DIV64 -* SPI_CLOCK_DIV128 - -slaveSelectPin: - -* slave device SS pin (Arduino Due only) - -divider (Arduino Due only): - -* a number from 1 to 255 (Arduino Due only) - -==== Returns - -None - -[float] -=== `setDataMode()` - -==== Description - -This function should not be used in new projects. Use SPISettings with SPI.beginTransaction() to configure SPI parameters. - -Sets the SPI data mode: that is, clock polarity and phase. See the Wikipedia article on SPI for details. - -==== Syntax - ----- -SPI.setDataMode(mode) ----- - -==== Parameters - -mode: - -* SPI_MODE0 -* SPI_MODE1 -* SPI_MODE2 -* SPI_MODE3 - -slaveSelectPin - -* slave device SS pin (Arduino Due only) - -==== Returns - -None - -[float] -=== `transfer()` - -==== Description - -SPI transfer is based on a simultaneous send and receive: the received data is returned in receivedVal (or receivedVal16). In case of buffer transfers the received data is stored in the buffer in-place (the old data is replaced with the data received). - -==== Syntax - ----- -receivedVal = SPI.transfer(val) -receivedVal16 = SPI.transfer16(val16) -SPI.transfer(buffer, size) ----- - -==== Parameters - -* val: the byte to send out over the bus -* val16: the two bytes variable to send out over the bus -* buffer: the array of data to be transferred - -==== Returns - -the received data - -[float] -=== `usingInterrupt()` - -==== Description - -If your program will perform SPI transactions within an interrupt, call this function to register the interrupt number or name with the SPI library. This allows SPI.beginTransaction() to prevent usage conflicts. Note that the interrupt specified in the call to usingInterrupt() will be disabled on a call to beginTransaction() and re-enabled in endTransaction(). - -==== Syntax - ----- -SPI.usingInterrupt(interruptNumber) ----- - -==== Parameters - -interruptNumber: the associated interrupt number. - -==== Returns - -None. diff --git a/Language/Functions/Communication/SPI/assets/ICSPHeader.jpg b/Language/Functions/Communication/SPI/assets/ICSPHeader.jpg deleted file mode 100644 index e2c463ed4918425984f94591e46aed8cbcb10a73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15824 zcmbt*RZv{Pm-paK@ZjzibZ~bK?#@7P3rui=ySoKqybP+PypGF2k^cQkoeE+|J42i@_z#O&*AqT045^9 z2=E94MG1h$go43@dLICg0H6TSF#q8L{<|R{!oedU!$QM+u=y|mP_WR@9~}w`4i@EO z%f~t#JQM-|5gQ8!7Z39@5)_LH=*pk1sS7 z3@jW1JmLqJ3ljhX_?UiR!$89#eC&dP{$OHa0pPJIaM&ruRB@>|5KQsJo&Bjf)zr=6 z>w4eU0H`n@pqMb201?3b>@e|nvP$19=aB-F_43sfUHg`2@MG)pFV4eM1trA(T;D)Vex{e6uMVzx ztf!d*$xNbim*r8^x{{{v0QnUQN5PU_AMvD>1M|7{Dby#`sQn^e;YIK#yij9qk?K1P(g z-WX}W9%<*rK}VZ`2?L&wZMSPs)0o5#J-j1}DuZM|_xOVW9VWL2WFj@zMam4AfRAT* zl#0^7i%N>f8xpK8ON6T%FnGvVk`GgKkQ^@FgJ3J4SQ#(psWcZ>L?Xw~n4CRUUa;iY z&cHYW&VHn)3FwO${XrFEsB1N*;qTJ2ht}FoQq|}+<8-IFYL}X6F5RxU_;gXn;=XbZ zJ5=z6v{ZhAiM1s@h~!h(SyU^gvyNn0Z4SfX+OJ=2#KG4!@MTv zom8~{B)U$rOlWW(_PA!BRi7=9MNa&3W&jQo!xoaL7n+)3KH;dM8;mI;X9(M`ayJ0d z)i6!CFnG7!c!$CbjqF8z#!&@d&F+Xa{$|S>T?&vb@Wdzo3(JmLgKgD#tzZ<_g0G?D z6z4fZ3C6Bt#3M}0`dCuSL}jQYoSdd<_qm}&LD>_?)xy=Zt&O8Tp%AOQH{|y#o*E)~ z1r?5~g#fOr8_3m!fJ9dZ9u|T4`(-H6c!VvAw4pf0&U#;BD#m)bGfS21%Tq!q&U~48 zLlljT^#mQ?8194dJ0QnLd3U+HTjF(U;7sHU=^cjp#`*%~&pGHY@

pUz9*=J49jy6tdK#Ea4}SR z^^j20CFPB{A(t64*N85Zv|H;|^h;}3%=n~cMu!H4Ai5v5^uXt<>YK2MVM0Rj!SS(u zMAnTZWZOBzhkR3xGE^iUqw*$6^=2Mk)ox*%;Zk%SCRE2tQf z=O*q<=%2~$lsa9Ti|1ws3M>-?dp>KZ4TM*(C~dZh$n{Dpzm;t2JMQmaWB+@S4!>Vr zneG7*T)AAn1DJ5n@;T36tI@6n-kdL2K2{=6ln<*}x9iH-J{y-A9_0u#4ZJFt_q>{& zqx@lud+iKB*v!5x5;*UiXYp$8H0|PitMu?;*lgLiJ+>mcVm=z#HsV6mEUCSD+5WcY zQ@tTmumIVQ3mnuWF!X(Fb<(^SUJeMzk}2MfzvJI^R2_r)Drak$Yug%Kav_I4crw11 z7!6FTW$}CmSlOY4Ru`dq-> zOm&ZDyZ9Dm1||RI8&Hsnc8SPNg~+Z=8yK|AC7rK^UKOMLY9SJ>m3Z{;HHn7@(lnmA2aD406?ajO*a{SmN&yx7cMfC;?u zT?}o36H>9qm}ZE#aJjCN_7!96LGVJH-di$MFe)>;t`!g}S(N8#(R&AoU$Bso_!c%^ z^e@@eOY4{2aZmgv?0o8%t>0I@{vspa#$YME0DUw3p>6o08;$6i(4UXM#aCa#WpPdg}`JckvbHx8%GCEm^YOHb@^KZ;S$vgu-Qp|9 zOL%W;oTqj@|f4{Z5`88OsI4q5C@pv+Ij-J>l{kOX`Gttwyh1L6ukS%S$&n`l^Ix?UDgnU>4_{?& z%7~A_ZrdAI;(?84h_ZlAgc3uDMe655k}pzBnWV%VGCG@TToSL3=i%21?*QB0r3^-n zxYY^Zs7Q5GcpU%S8Fs}KA_v6}Ftmf=5>Zd30v9KGoEW|W;O#l^oN%?1mXSE907TWm zwj+w%GfF9%?dt|M?ChvCjT;fdgwe(%-7AO|W<$kHt1o<2LLDzqeD7PQqSGB%-CesNISJC}^NGG#SLhne=sOrZjRnuEYL^75Ihm2kM_F3}wV%SgOpCwYl*dGUY7`N^g%4JNj6w7|EUV`jC zX&|YFrZ+!k&(4PKK}AQF1k?T~2rmpgVJ7XE7?x}u?`F{C3|~LcI<`~ZPld@ISBtDM z|5Xu1tss(tZO1l-mZy!mNM@)+Fu37m_p`46RRjP0;;%;sLnC(+yP5kY6rH6i8Tirt z#azqVp*W~!$_x)a3*{c#*>B0!h-yZWvGr3q{15P529X>j+52ppYYl3Q?X4&4Pwh}v zr;a8Ty(udPx@33$DlGC<^T%SN<8t)=8$ne`-d(L71y~nZT&fh~3r%_u zT8F%XlQ!SXp3b%+n*p-VwV?F1gl$QViOe6|#h7DwkUIllo#CEqXC|dA2%w z%8oa$GMv&2|B*s87XPlVK;hvj*0?sZVu9EmWt9?mqJETu%Hp?6C7if-Afr1Nfp-2a z?Yfao#*S~RuNgclL|usoh!OuFs$ou-Yy^0RRi$;oY|SjJG=sIJaL;&e^a2F+0&=sP zs!ib4K1JgtrTP*9Vfs=eu;6@UJsY|52;vkQr#c5_KH}b3zXVh&LqH6^XgUqWr~c`) zo@L>$iz4fEGH;1*tB0@Z&sr7N#-fkYDNoafci(2a90%V4J4y4>ifxI$`H zD)XwYx3j zBxo&VCOI$v=_T*`9S_@_cxrVEi5nJg#uuC4jaln;VcVoV7PQ><#>dLpL=rP+mDT?q z(=F#lT~6^8UEt*!t3rNcJl{MR-xOW~|Jq*3#JRcXK1Dwf5w-D=`I>H7fQy7eXR>CB zCfqwTw3<*x3Acd6@y~&>j>Rq~GephOlyMQCF~HI9-*|%~VNKJLa-zg0am(%0YSFJv zcGq@)@zrl`gCVkd$1-Bk)ENJI0@8;{w&H$8PM~1A>|kT^3o6pg7Hw0laOgoM4ve9Vb!VBrEoCbK z)D~3Tq2!dhDUsp7+FX9xsaAEi*{feKw%x!vZD#8&8BM{~q!qgAJNwGY#Aqp-Oj;#~ z#Z)7i{NkpkM#EXeh-n+Zo*o#evc7ZsZ=YJ&uWbwFJY#sA_D?cOyjUwA$rf)EvJy$q zJ#AL@+dFLiOQLMds%h!xJL14s#ZTEVwa*1aZ8uI&j0#%)7tvq!mPHm4%LmYRX6n~& zlt|OIOiR)J7%(IBO@z%mVJmxA+OUHxk7HF7ncr%T5~k@B<$vfcIsKvOI;Q3e@t0sR zbrdXW=>U$~H*Von{z1z_{Q8GMnf-Y)^;{ue!PZIFR3UY>;a~JAp(Ke3Rq-9(fDwrF zS9Gq1?Vqwm(nroOpc1*Bsu*}9i7Od4AfYm-O0`C8;b|$pssMzNjGU|=Rl`pE-L78s zA(n)Nxmnj7-#V)60B=V}+TdTFob4CELW}(#qK4u{pUuWx9;o&}@6(E4z3R4TpL2ER zs)f~vNa})!1XrHXB1J_G*P*XY9%||=QFz!?a49pKy!M8bcw3+*m0$8V@i`gRa;i+d zIT;A$oc)@qv7<6m>aFLB%Q@Pcmw3Nf+N(mM97|V22ib|4C zy6U?$3V^`TwcS9ph98r=0(i5^p)6P!H)5)v$YAtK8)!oGH7Y9=QJw5{EL56cL0z&B zHzryMk0M6PXMayBR=A9hPaBD-wt{gSH{7I)pMx>JCei!*ny>*LBn4EhVrr^N)n)^q5ei;yZ)bCB*y4=?^)w;{H9F z?zhM%9T>iNs-)+nw0>nqE)SDpFJ_2z6uP+c4v2gpqiUZY07~Ng1|R|kl@FZRzB5+lGpy567JfIfahqESbomY~ zl$NB}O*)FufYb2W1~P>GF>a^WQJ3y^MuEH+tftp~p z7cDnibRUqbE3DJdXys&L+OSmA#yr=-g|3uJdi+w4V9FO{*`QC@<5uhWLVi~!JCj#f zIWY)W43MVe+d+(t;J1J&mTZ|pWG?B04KTpb4yRZmw0Gn!k~Hp*Cvuj-2JThobzif6 zch;bN2ka1BrA|TycPf7dh+%`S#r6o|>cZiad;U%KjnWKvNqxo*5)RPHT45tX_IFoZ zi*0`DHUrV>6y4EQWm9%CJwzePYXvQ6w6S^U#2vd?sm_(RQ6=? zV51_{=*b9d^E20F7rYRv3*D+F)^QX~>oMk`rWQbHp^c&wqNAVaNSNTLWjQ1eZ5`P1 z7IrW9=_nKAvDQe`9eHlXty#Vc6kq09{7wKjK6%?y{YknS_F$XYLF6*8!pDPmwH7si zm4gCF{SzKYJ13k{Il<0C9I5l8?x(g6-g$VeJWljyP6A8zOq=d< z$rI{$5RMdiQbQ1YuylfmC%-in(cGZzl-QFs zwA(Bjfm^>twyXXKe(8*OeW|5V;__;dLa8-tV2dqMkL zsT!=cF^3y7Cl4OCo&y_}t7gZ9Om$-L7~5d%>KU3J&GVNv@0<=T_tzk|q{qi5n5nK~ z8M>w~Jds?jqxme#M)-`CxHZ{#PPS6JEm+5Ut|*n6*T~7JCsJWBGY5@JER{ETPwUCW zSdF}_*x4pAv|MkB6Ai==C;2IP<+r`cCRW1LHw$W|W;G<+Wz1kMm0EI#OB2w-_Qshp zaR(dbTf4YO;Cojo1Ahy8z{z%>X%ey;VWg@BgpVdYrzcNL2fPmgaMFTizsU`U2Ip>-h*WZj-Y!X6Uz zhh7{b%amRmJBo%unJuXVe~3NGJf}+oym5Zpx_#4(vA#LoQ%rGem6FVf`_6h;3PPW~e*d))jBHO++-p#a}#GU`>Z zjjP~`YoSK6Vmp0wA@0iVCUv~zJ;feRn$SLv#8a|)-nYhetk|Vz+y;Jh6x9JD>k{L$ z`}}ZhYitWG>70DcyMZzy46B5SLLg0oGkgCMDm(imL}99$!qKp+_s~6BE;{q{iE5v< zDKpr`S2>aT2FFW)F@xxDgGC;vNo~vn?stn|h63oEz5#bNb0RW$wo%7@6*T1%$lW`@ z+A8y6yZpd4m`C$eAz7LOIBiinzEP8c5}sSHjv%dezzmRHFd;x~5cQQdhR>n<8HL9Q zjgybxjgy?`AWJ=(BN%Kyo8DdAI$(nb<>EZJ9>U7ciT^Dz12(FZBa!+lEC=fbE$Cs- z*&-uaS%!^Vb&PBJ|D{%s zX=_QFBAzUvb5hFzwfP+|h9e;iE$i-hDfo+w5u@?KbJt+rjfNJ+(00YKX5MC}gBV9- zM1JfUGmI@AA@dQbp|D8)HbocxX@WNtd+)>TWQ{0pWo)Z#l%@(B@FssnuS6Qx>9!!-Fs5m z!>VUQ&v+Yc(tY(g&1Pk18gEX;R>8*vhOP&Um$wgy2VxAcO0dsVQ;oL!_!7dRux-ny zA#=-{%JXhE(tpgq89^=v@{c1R*D=mzeanVj)AA+)zBCJRii#`w45suv_R39Jm|SBe z@<^#_*I{pUDQ~}Rc|DYrJWsJVe?{T6ik%8bGuf&P!rx896$>o!1Phi{RYIDT4(>jXzh<|CPHNjCMz%~XKfW|CHQjhH zqYCTSpyMHirg@^8LSbov?b4($NmusLWE*ajCmS$eCK~qVX>Fz!;CoEN?+E@+|1-o z_o(2{EvOVdqd+GpYNf}b)heZAX2B*P!4`Z61TsU+O--q!BLH%!Dyi+ZweL*Df(>klFTua)EY>W{u+c#_Dvk8HjUdqt#thxamhBr^GaLg= zSZQ?rT!#=By;?32$p`WJ0P^7k(TWnDH4SqqiL1PvL&1Dqre3X?-URe{>#5pfLH zj0pu&xFlhB<5t(w)c&vzN6u+^IuE@%m6rAKL|nLHXb8mGp7LE%MFE#%CCmd}wBl<4 z6-?SA9xIC(5F-1837lflor&_M*swwv?2s&{bkM^jL8}-~x5aJsuZq78J&yU*=}SH) z?L!);Nh55jteVv?_R8Uw0hxCmBWGiJ=&4;pOUM55{AgwwDi#LCH2PlaN*aH+`A9Zc zD_5Q^3Iv*$!U#s5LMGbmBVu-z6;}y8O52&Ge8Y=}qp7GN!3-+cKtj7$!PU|;;Y*dbyfx|N{AKSyiD%83lyS}Ax6)@iqQtppX(KZavTzq9PsPr6spPIhC;T`_ZY zjvAWrlQ#Px;9J@}JkgdU7VUB%E3aj#$-p}l?NyUT^(dW$fA#uXOBJv4X88_C*zbPs z%%;ghn$=;^?l}3wyx0JYa3e&TNStKG1Y@rY!J;TCB!+A+mR(|?a(+3>KdDre@wR;B zc8jg&UxsAJCw95hkdh^u^H)F4$>X?fCEyu*QLfs)u+qzEoGSa9_n&5|~VCyd`ONrmp2R6RxELg5}ZI z>{{}GK|J3kn=}g#*o`0}(OVU|{MHLB7WviR>mVpe{FOi^U6s-Ae*&_br?O30u^8@a zQ>W39Xq#}uW%S56YQkP3&0u?3;D@=+SoGB<7p-v?++K~9eTXe=xi3&DqMp9G5bc)D z-<-0N0{&@njdAy2l$&|$%>BqoFERT1mU+?^qwVx!hrV~=dpdKx{(a(t_}AgQeb5@6 z8*y4?&K${nBhLL2uvDCRNaeQpqpS>>VT^ecTn~oQICGLqxOMQmR!&sG@?O9;bilcqD zLJe4z-Ci8itwKr%G2EmmYvdC#zkw@Q-q}CPqp)T%WdWknLB%WIsjIA2h2nLlfautB zY;UBlcp+4a+Ro-uA&&f6Z$b2~Uk}{4Qs#!Dt~vBc!j1R7Ls7R{S*p+CE_fnx7u43I zmtAr@uc&2rX(6sd(RAy|XB8M9G8w}{LE(UC&Z}16tN6!S42JL6{aY=BOu`YkYaIz0 zR$%h_YCUfM=RU`xNvYhS6G1z{R_Sbpel}QA`${2xw<|~!1Tq$vWy@b0#d3&981cA6 zuyANi2K#g~RN>US2wS{}QCOapjve)uC@}B35i|TQQY>Q(a(j}ED=xN!0eGXG|D=uR zSO}2e8|gID5nP*3D_2uIaS=jimAxpozOtkNm4KE>Eae)o;V~%~D6e@U1^DQ9<(=n{ zXciz@EvMBiy3=nWQRXRslS=Xpy&-P*iZCc1^=IGD)s+P$n}mVcPrwDH19`H5%Yr=`Ej8b4r1NT?gRRHzR zcz3^Winj8PPqHYr%~vghQr4qeqW)MpqYU8$m+-1-MltXWIY(Uuy#t6+kWRMhcyzZ8 z_lk1xa%%3QwR$bM9aDS|?6l&%Q>!IQHpcT7Yg8adp`;XwExZq(N3v>*jf_R_xD^DMA$%|(6_ zf==#NT% zOOi@6TfMezywc5$)E&lb9gA^MrcUR8QrZlWs)4l!*QE>Mpi9f^-U?XL`2MLo)@hD2 zzWrOfn`eQ>=&!QaTCjm=bYEnB?mc{G)Zz~~Xf}%KTS~#%y3baqSh~V5V+j>}@$9H1 zVF?+I$UX9?L|6)Z;d4xGnv673!-n5N7_xL0Iu!^MOt@KhfjTb>ca(|JB>ZLd0pTTiEokiSNU8Xse5@Dux#xK1vPL z!Nd}y#G`@j2-)Al=ahHV7T0EU)q}CIFd65e5FZFgTcP72*B*F)%rm)8)%0NNu1?N= zBTFZisqP{6%nzu0c&rJIxWiQ+r(-r3kB29~p2{La!xl(+xVC2Z%o2<&Y}e07_j)8* zby6OeYe%HhWRQ+T{j<+XZ%({oNz*qRtKN#4pp|MUzipq?R>^;W)A7gVWot|QfkfX6 zrK9?z-_`j|`q+^qAaVqxP*rbY--E*)W~ILtMuenUZz*^2cH$Qfk+$ zFmYQh(FLWAoPf^hbV%dneHcyXDT3kpBQJkkZ{7hmg=aEo9Zg#~6tm0aCH7b)WeP6$|1V8dt#C@Xv77b2L^vAhYB62?nc(32qst`nE_rBC;erYkh3WDgt^r~o{dHyycWm} z5n18++kpP_Z^KhXcl5l=5&a*2s>X1bue`p=&phLYhuuGX4u5x{tj0e)#OC{zdUua_ zeVy)n2hg3p4!`-uX8vkzL=L3Z1DmU|f>&N|QNbYNZyB5yLgmg*S;QYE z`FS^uu~#mgGh|cE(7E-ws%5Zo)oov*B1*#qBJ~u6#|o~h!#4kdV=H#MJVCF+-xR~< zoq1OKtZQ}uD%`PeS8#bW>3o3_dR;~y&yxM{0@k!Kan&9f585_ugj+(a}sfm936 zO4WRWmR5%VPnG}<(BIdV0Ht5V&s6j6*OPiR5t+^LIS?gbkgm~x0!galg?)@d@wAcpvqvaeMS}X0)Al71s2`Iyhz=t&s8`)$XOYqBeMI zVUFt?<5Ahr<9Kn#x21Zg@KD-@sE&xqAb1Bp*V`$l4;_{5UghWNK>eC&R&;R_OTe5>RNC%~m%TgVuK=(hAGeeExYvXVNr$@5Lhl{8Au6pf6?cW_q! zsbM)g5ejTN+;)u$ZabeM-fB~i4I^t@}Iv_hZNvI8d|E;5ud zv?8JT&ZJm9^fG-J=Ol064o0ULjcN*~4eaN$0jba88XB{N|6>0+$%g+Z4F&5zO{=KQghpIg~PP&ByHkv9R{xcxtwo-^QpR4PT z+V(ubamyiBU>m<^jcLDZvTZ$PKvF&VJ;-mgGtzvCpZz6bm^HqyX~WWEHu6Xsi+h4kg>Sf(`lQn@ z-;Y{JQfWXb@g&;35uPqsg=xyqF!EcA;EWu44h4P!=y&HBW21#G4AIy%JK= zuX+R)zqp0>{?3-PK0udZga^{MXGo<>RPxmxS2}(a_~O;xNmIA8)(IvRsR#AhoD}~q zlsMChTzCgCG>JL?q$lEUH!U5Nk?M&qmMP+pEk{N6w0+Q##6c7vZg zor!N6GjjklDtUqQtv++0QkKxLpwYo=WG4SP|70+$1h3jisF!~x$@OiZqu)^2WbWa5 zHLPazrm~`a8iw^!d;$sTiiY7*Y`=nINM8si=2#i)mwE$Z*n=MsuBG5`XLqp=x?`0> zuVqiNWMFN$pAo(KF0T7bzfv=U$M!U}>HH$rlD3Am^ksrXqNQ;rAOm;UK!?^WA1R|^ z99@e&NRSmhgfAfo61V;txYnY&n%q!ST17yNf z50iMw0|X8Ttz#S6{KGiq-4h~c_9^0rNs?HWx81C)i{na&)l{+$aiCFt+++KoF5Xw` z9ZG68?#>-V>St{)p@n5?P1OW=^;7N|2Iu$fw*^tR+qI;noEg)9KQ}GYs67HTPO%EF zR%E*`dT}JfRge0Zn#t%mn?^47jO zXq}UYm!A?2o1AuM;4E2Y%*VNC;p?$$Y>Z=1{_Xwo(Yzh z9}U1^U@w+pm*s?>n&?Y-7*gNVBn8{~$Ak9}*rP1q$VFfcs*ZUIc5z334^s8O<9R1l zxE~Ek%f+nBYbz}hF)vf+T3qq;I}#wWN)^oe1Ytd@CMT>mEgTbNtKAvZH80xFUq-~( z9PsP918pFooMdFSk-tz=kOSFh^;{Rdit$PAhVA-_7`5h?1eo^x49+}BJ_6Ll5**v| z&C6BBcpnm(=r(gPY1db@&Le2dy>M% zL|iHoXr28_Ca27Y#4$w+p?AOV1(B|-A^D;?by}P=#n0(V zIJU|7lr3`xwWO61XUK-cM^X{hzvNY&J_8_7aM&rRO@|U|N58Lj&A=PHX@nWfVAID| zbcocKRAed=WuZHLe;9bhzG+AG(A_S(0iPGyB9vTK;W2+E_O|rZOsAPxmwgED)N!3t zxYaGMkfTIHdmd3O#u;OZ^iH4->K$Mz{tmch-~MNJsjGO!L2bQ%senqT2oo(YGH#wXC#FFysMU(dT$L>(x8np91S0WN(Y zd+o2ltyZ*{t>)ulVi*2jwQ;x^n;PO&C$|ssD{!N-6G=F*Di}N1Us%;c73AZ%oObJP zlJctCK;csqQiSR;7z)*GOG;|ikMQYo7013lx)6(J zCBFR;efYvZGJ+t0HY+sn)q>X? zEi`l2921GERy65Nan~_?TywLGe-DwInkW$EEtPrKvlp8Ml;4hj|njd#0kMH*!s@vMcT9y-c2q(y#q|T(H;lHKJy2` zC8Z55$qsh)z>fda-$B;jK}#Gk9U6+WuVk~8WGe#JKx{Q_o@ulgBh8j>7)~USe`=5b zZE}o~%KI7Ve@H}WXu2OA?ocHYQcWYnOQ2st?&2>c}urjZ_Vk1@;qk~e|X zdq>(DVrjB%Qb&IARjGA5^n5baQ7Z-`Y7vZJjcDH8Hm_*;ofFj0$M3We>oaAz(Ix}nN>{S2V z2DuDuR z(XT%9;pF)p@KNPb_-ozEvDPQ>NO;Wri1g#0>>}IgGT-m&K6v{Z@wol@BS24edMC2q zy8N)YPl84aD=GbRn_ZP%429_PXQJ{nczz%+9uW>X08tklf=WJQoi~UB&NKlN*{A4B zSjjt=soNNKV3}q6W^FFCCs_owg#Pt(sw5KhjYLo4Hz8L z@?_kO!V17PaQc}8-C+ET&_v!W1cCluuephB3x5ctEt_4pRVrpuvFGQa#V5oAMW31Q zG7Mi-u%Ne77`DQnyObr3OuOd&hA~0Q$MdrUNvW`4P(v(* z{qpkMqoPq+l%?$MzU)=`Vl$%Ec~i*r>{^?D!K?O6zYOPPv1H#=t3yywC)l0_9!1mP9S=hyG03bAox@9LSB0y$Y9cxlQ09HOTzb0E3^EyW zPL3%6IH;)k_^((D<~0P4!!-o^>Ukg!aYpaPIE=vBiIQV{yvT85V38(r3_nR|p%}qMu;lW|%6uHZ$=H z@oSEBMp6qo69eUhF^$>RieMQm7DN{0Wnm0;)9pupQ^n0q0cb;A`e{PpHS4 zs!zTBofgs2{Dk}iXC}(Z{-0o_SRuIN%y!|bvwK-6us{Y7fM|egH=wrA;$g3j zb#Noa>|A_8fxV#Sa~_?G;qs*=UE-H~*%JViH~>0W6IqB}(_}37lbGgD3nDvwXdqQ- zfNf0%-l$o8^GaiJ@vkODHl2AqzHB$u#LQHa-S} z#(rqVhi{j6Bx*cb7_vtgXFr57R$|2KJNov`gXA?(Fw54=P*%9RH8x)N?_I|ug|?=N z*X>z!8FBy;tU3{;u8N8D0KuNP1`$atIx_(ZL#YZsk(a02q~-Oh-AdCzTXJZ!tIbxk zXL8*gEfa0-Q-^Z@3Rx{P^k*_+QB0I9mm0N-R2Tb%l~m^}oa-7h)=t|EVB6OC658J* z?OXK8tZc!S3P{lp6FbH%xD>;1>ozyNzwGr0L11oMux|NFQGTRpN-394S-9KakYqcN z8}DugC-w-_g_VJ-R-|-Uc)<#<={HAMf17JT7)5)2RT5QiZ*R~H{BvQQSL zFM>sE$N-AQu(|Ny6x;SyXA*w1!LEO@n|i1pn4o|;5Yd>3JjoG`Bx|2QV<=c+xg96T z2+C&Z71dY9$Xg1~h)OzZ7$#)Wc Date: Tue, 14 Dec 2021 14:59:11 +0100 Subject: [PATCH 180/298] Update length.adoc --- Language/Variables/Data Types/String/Functions/length.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/String/Functions/length.adoc b/Language/Variables/Data Types/String/Functions/length.adoc index a0b644b42..3ced638e9 100644 --- a/Language/Variables/Data Types/String/Functions/length.adoc +++ b/Language/Variables/Data Types/String/Functions/length.adoc @@ -34,7 +34,7 @@ Returns the length of the String, in characters. (Note that this doesn't include [float] === Returns -The length of the String in characters. +The length of the String in characters as an unsigned int. -- // OVERVIEW SECTION ENDS From a1ccc71b7b0f5890f32da743d337ad5246667cb6 Mon Sep 17 00:00:00 2001 From: Kristoffer Engdahl Date: Mon, 20 Dec 2021 11:02:40 +0100 Subject: [PATCH 181/298] Update Language/Variables/Data Types/String/Functions/length.adoc Co-authored-by: per1234 --- Language/Variables/Data Types/String/Functions/length.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/String/Functions/length.adoc b/Language/Variables/Data Types/String/Functions/length.adoc index 3ced638e9..d3703282e 100644 --- a/Language/Variables/Data Types/String/Functions/length.adoc +++ b/Language/Variables/Data Types/String/Functions/length.adoc @@ -34,7 +34,7 @@ Returns the length of the String, in characters. (Note that this doesn't include [float] === Returns -The length of the String in characters as an unsigned int. +The length of the String in characters. Data type: `unsigned int`. -- // OVERVIEW SECTION ENDS From 897ef471908c2e27a8ba30d98cf9bd125aff68cf Mon Sep 17 00:00:00 2001 From: YClayton <94257246+YClayton@users.noreply.github.com> Date: Fri, 24 Dec 2021 11:40:40 -0600 Subject: [PATCH 182/298] Update compoundMultiplication.adoc Change Example Code from: x = 2; x *= 2; // x now contains 4 ---- Change it to: x = 2; x *= 3; // x now contains 6 ---- Just makes it a little clearer, since 2+2=4 and 2*2=4. Too many twos. --- .../Structure/Compound Operators/compoundMultiplication.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Compound Operators/compoundMultiplication.adoc b/Language/Structure/Compound Operators/compoundMultiplication.adoc index b2ec543ab..cd5f56582 100644 --- a/Language/Structure/Compound Operators/compoundMultiplication.adoc +++ b/Language/Structure/Compound Operators/compoundMultiplication.adoc @@ -47,7 +47,7 @@ This is a convenient shorthand to perform multiplication of a variable with anot [source,arduino] ---- x = 2; -x *= 2; // x now contains 4 +x *= 3; // x now contains 6 ---- From 11c51188575cb1070c794acb249668016765e641 Mon Sep 17 00:00:00 2001 From: Stefan Lenz Date: Sun, 26 Dec 2021 19:05:52 +0100 Subject: [PATCH 183/298] Update PROGMEM.adoc The use of pgm_read_word() in the example is wrong and only works on 16 bit systems. We are dealing with a pointer here so the correct function would be pgm_read_ptr(). --- Language/Variables/Utilities/PROGMEM.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index b483ad5fe..7dc5e44e7 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -151,7 +151,7 @@ void loop() { for (int i = 0; i < 6; i++) { - strcpy_P(buffer, (char *)pgm_read_word(&(string_table[i]))); // Necessary casts and dereferencing, just copy. + strcpy_P(buffer, (char *)pgm_read_ptr(&(string_table[i]))); // Necessary casts and dereferencing, just copy. Serial.println(buffer); delay(500); } From d74e42bad35a23300e90dee83b58d6ca06390a4e Mon Sep 17 00:00:00 2001 From: "Oscar (Coda)" <58069739+Core-l@users.noreply.github.com> Date: Mon, 10 Jan 2022 18:17:43 +0000 Subject: [PATCH 184/298] Strange results in floating point 6.0 / 3.0 != 2.0 is an incorrect example because floats can represent all three numbers perfectly, so the result is equal. 9.0 / 0.3 != 30.0 is a better example, it produces the correct result in double precision but not in single precision. --- Language/Variables/Data Types/float.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/float.adoc b/Language/Variables/Data Types/float.adoc index 8882397ed..fd89b97a5 100644 --- a/Language/Variables/Data Types/float.adoc +++ b/Language/Variables/Data Types/float.adoc @@ -67,7 +67,7 @@ If doing math with floats, you need to add a decimal point, otherwise it will be The float data type has only 6-7 decimal digits of precision. That means the total number of digits, not the number to the right of the decimal point. Unlike other platforms, where you can get more precision by using a double (e.g. up to 15 digits), on the Arduino, double is the same size as float. -Floating point numbers are not exact, and may yield strange results when compared. For example 6.0 / 3.0 may not equal 2.0. You should instead check that the absolute value of the difference between the numbers is less than some small number. +Floating point numbers are not exact, and may yield strange results when compared. For example 9.0 / 0.3 may not quite equal 30.0. You should instead check that the absolute value of the difference between the numbers is less than some small number. Conversion from floating point to integer math results in truncation: [source,arduino] From d57814d89f503317c0e4f033da62fe98774141df Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 18 Jan 2022 16:22:28 +1300 Subject: [PATCH 185/298] Mention millis() not ticking every millisecond Mention millis() ticking every 1.024 mS, skipping a value every 41 or 42, and maybe using micros for short accurate timings. --- Language/Functions/Time/millis.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index 7ff5f7624..d1a2917a6 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -66,6 +66,10 @@ void loop() { === Notes and Warnings Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. +Note that millis() is incremented (for 16 MHz AVR chips and some others) every 1.024 milliseconds, then incrementing by 2 (rather than 1) every 41 or 42 ticks, to pull it back into synch; thus some millis() values are skipped. For accurate timing over short intervals, consider using micros(). + +Note that millis() will wrap around to 0 after about 49 days (micros in about 71 minutes). + -- // HOW TO USE SECTION ENDS From a6035d7ef4b944998deafadb12df6f5677f0045b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 19 Jan 2022 15:50:55 +0100 Subject: [PATCH 186/298] Migrate & convert SPI docs from older platform --- Language/Functions/Communication/SPI.adoc | 52 +++++++++++++++++++ .../Communication/SPI/SPISettings.adoc | 42 +++++++++++++++ .../Functions/Communication/SPI/begin.adoc | 33 ++++++++++++ .../Communication/SPI/beginTransaction.adoc | 33 ++++++++++++ Language/Functions/Communication/SPI/end.adoc | 33 ++++++++++++ .../Communication/SPI/endTransaction.adoc | 33 ++++++++++++ .../Communication/SPI/setBitOrder.adoc | 35 +++++++++++++ .../Communication/SPI/setClockDivider.adoc | 47 +++++++++++++++++ .../Communication/SPI/setDataMode.adoc | 41 +++++++++++++++ .../Functions/Communication/SPI/transfer.adoc | 40 ++++++++++++++ .../Communication/SPI/usingInterrupt.adoc | 33 ++++++++++++ 11 files changed, 422 insertions(+) create mode 100644 Language/Functions/Communication/SPI.adoc create mode 100644 Language/Functions/Communication/SPI/SPISettings.adoc create mode 100644 Language/Functions/Communication/SPI/begin.adoc create mode 100644 Language/Functions/Communication/SPI/beginTransaction.adoc create mode 100644 Language/Functions/Communication/SPI/end.adoc create mode 100644 Language/Functions/Communication/SPI/endTransaction.adoc create mode 100644 Language/Functions/Communication/SPI/setBitOrder.adoc create mode 100644 Language/Functions/Communication/SPI/setClockDivider.adoc create mode 100644 Language/Functions/Communication/SPI/setDataMode.adoc create mode 100644 Language/Functions/Communication/SPI/transfer.adoc create mode 100644 Language/Functions/Communication/SPI/usingInterrupt.adoc diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc new file mode 100644 index 000000000..b77499d5c --- /dev/null +++ b/Language/Functions/Communication/SPI.adoc @@ -0,0 +1,52 @@ +--- +title: SPI +categories: [ "Functions" ] +subCategories: [ "Communication" ] +--- + + += SPI + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + + +This library allows you to communicate with SPI devices, with the Arduino as the controller device. This library is bundled with every Arduino platform (avr, megaavr, mbed, samd, sam, arc32), so *you do not need to install* the library separately. + +To use this library + +`#include ` + +To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/learn/communication/spi[Arduino & Serial Peripheral Interface (SPI)] guide. + +-- +// OVERVIEW SECTION ENDS + + +// FUNCTIONS SECTION STARTS +[#functions] +-- + +''' + +[float] +=== Functions +link:../SPI/SPISettings[SPISettings] + +link:../SPI/begin[begin()] + +link:../SPI/beginTransaction[beginTransaction()] + +link:../SPI/end[end()] + +link:../SPI/setBitOrder[setBitOrder()] + +link:../SPI/setClockDivider[setClockDivider()] + +link:../SPI/setDataMode[setDataMode()] + +link:../SPI/transfer[transfer()] + +link:../SPI/usingInterrupt[usingInterrupt()] + +''' + +-- +// SEEALSO SECTION ENDS diff --git a/Language/Functions/Communication/SPI/SPISettings.adoc b/Language/Functions/Communication/SPI/SPISettings.adoc new file mode 100644 index 000000000..d8c7351af --- /dev/null +++ b/Language/Functions/Communication/SPI/SPISettings.adoc @@ -0,0 +1,42 @@ +--- +title: SPISettings +--- + += SPISettings + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The `SPISettings` object is used to configure the SPI port for your SPI device. All 3 parameters are combined to a single `SPISettings` object, which is given to `SPI.beginTransaction()`. + +When all of your settings are constants, SPISettings should be used directly in `SPI.beginTransaction()`. See the syntax section below. For constants, this syntax results in smaller and faster code. + +If any of your settings are variables, you may create a SPISettings object to hold the 3 settings. Then you can give the object name to SPI.beginTransaction(). Creating a named SPISettings object may be more efficient when your settings are not constants, especially if the maximum speed is a variable computed or configured, rather than a number you type directly into your sketch. + +[float] +=== Syntax +`SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0))` +Note: Best if all 3 settings are constants + +`SPISettings mySettting(speedMaximum, dataOrder, dataMode)` +Note: Best when any setting is a variable'' + + +[float] +=== Parameters +`speedMaximum`: The maximum speed of communication. For a SPI chip rated up to 20 MHz, use 20000000. + +`dataOrder`: MSBFIRST or LSBFIRST + +`dataMode`: SPI_MODE0, SPI_MODE1, SPI_MODE2, or SPI_MODE3 + + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/begin.adoc b/Language/Functions/Communication/SPI/begin.adoc new file mode 100644 index 000000000..757e57c6c --- /dev/null +++ b/Language/Functions/Communication/SPI/begin.adoc @@ -0,0 +1,33 @@ +--- +title: SPI.begin() +--- + += SPI.begin() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high. + + +[float] +=== Syntax +`SPI.begin()` + + +[float] +=== Parameters +None. + + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/beginTransaction.adoc b/Language/Functions/Communication/SPI/beginTransaction.adoc new file mode 100644 index 000000000..6c9f63b7f --- /dev/null +++ b/Language/Functions/Communication/SPI/beginTransaction.adoc @@ -0,0 +1,33 @@ +--- +title: SPI.beginTransaction() +--- + += SPI.beginTransaction() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Initializes the SPI bus using the defined link:SPISettings[SPISettings]. + + +[float] +=== Syntax +`SPI.beginTransaction(mySettings)` + + +[float] +=== Parameters +mySettings: the chosen settings according to link:SPISettings[SPISettings]. + + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/end.adoc b/Language/Functions/Communication/SPI/end.adoc new file mode 100644 index 000000000..76eef8025 --- /dev/null +++ b/Language/Functions/Communication/SPI/end.adoc @@ -0,0 +1,33 @@ +--- +title: SPI.end() +--- + += SPI.end() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Disables the SPI bus (leaving pin modes unchanged). + + +[float] +=== Syntax +`SPI.end()` + + +[float] +=== Parameters +None. + + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/endTransaction.adoc b/Language/Functions/Communication/SPI/endTransaction.adoc new file mode 100644 index 000000000..4bf8ec891 --- /dev/null +++ b/Language/Functions/Communication/SPI/endTransaction.adoc @@ -0,0 +1,33 @@ +--- +title: SPI.endTransaction() +--- + += SPI.endTransaction() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +Stop using the SPI bus. Normally this is called after de-asserting the chip select, to allow other libraries to use the SPI bus. + + +[float] +=== Syntax +`SPI.endTransaction()` + + +[float] +=== Parameters +None. + + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/setBitOrder.adoc b/Language/Functions/Communication/SPI/setBitOrder.adoc new file mode 100644 index 000000000..b1e09d264 --- /dev/null +++ b/Language/Functions/Communication/SPI/setBitOrder.adoc @@ -0,0 +1,35 @@ +--- +title: SPI.setBitOrder() +--- + += SPI.setBitOrder() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function should not be used in new projects. Use link:SPISettings[SPISettings]. with link:beginTransaction[SPI.beginTransaction()]. to configure SPI parameters. + +Sets the order of the bits shifted out of and into the SPI bus, either LSBFIRST (least-significant bit first) or MSBFIRST (most-significant bit first). + + +[float] +=== Syntax +`SPI.setBitOrder(order)` + + +[float] +=== Parameters +order: either LSBFIRST or MSBFIRST + + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/setClockDivider.adoc b/Language/Functions/Communication/SPI/setClockDivider.adoc new file mode 100644 index 000000000..2aad770e1 --- /dev/null +++ b/Language/Functions/Communication/SPI/setClockDivider.adoc @@ -0,0 +1,47 @@ +--- +title: SPI.setClockDivider() +--- + += SPI.setClockDivider() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function should not be used in new projects. Use link:SPISettings[SPISettings]. with link:beginTransaction[SPI.beginTransaction()]. to configure SPI parameters. + +Sets the SPI clock divider relative to the system clock. On AVR based boards, the dividers available are 2, 4, 8, 16, 32, 64 or 128. The default setting is SPI_CLOCK_DIV4, which sets the SPI clock to one-quarter the frequency of the system clock (4 Mhz for the boards at 16 MHz). + +*For Arduino Due:* On the Due, the system clock can be divided by values from 1 to 255. The default value is 21, which sets the clock to 4 MHz like other Arduino boards. + + +[float] +=== Syntax +`SPI.setClockDivider(divider)` + + +[float] +=== Parameters + +divider (only AVR boards): +* SPI_CLOCK_DIV2 +* SPI_CLOCK_DIV4 +* SPI_CLOCK_DIV8 +* SPI_CLOCK_DIV16 +* SPI_CLOCK_DIV32 +* SPI_CLOCK_DIV64 +* SPI_CLOCK_DIV128 + +chipSelectPin: peripheral device CS pin (Arduino Due only) +divider: a number from 1 to 255 (Arduino Due only) + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/setDataMode.adoc b/Language/Functions/Communication/SPI/setDataMode.adoc new file mode 100644 index 000000000..4a0472fa1 --- /dev/null +++ b/Language/Functions/Communication/SPI/setDataMode.adoc @@ -0,0 +1,41 @@ +--- +title: SPI.setDataMode() +--- + += SPI.setDataMode() + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function should not be used in new projects. Use link:SPISettings[SPISettings]. with link:beginTransaction[SPI.beginTransaction()]. to configure SPI parameters. + +Sets the SPI data mode: that is, clock polarity and phase. See the Wikipedia article on http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus:[SPI] for details. + +[float] +=== Syntax +`SPI.setDataMode(mode)` + + +[float] +=== Parameters + +mode: + +* SPI_MODE0 +* SPI_MODE1 +* SPI_MODE2 +* SPI_MODE3 + + +chipSelectPin - peripheral device CS pin (Arduino Due only) + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/transfer.adoc b/Language/Functions/Communication/SPI/transfer.adoc new file mode 100644 index 000000000..ff59a3b3c --- /dev/null +++ b/Language/Functions/Communication/SPI/transfer.adoc @@ -0,0 +1,40 @@ +--- +title: SPI.transfer() +--- + += SPI.transfer() + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +SPI transfer is based on a simultaneous send and receive: the received data is returned in receivedVal (or receivedVal16). In case of buffer transfers the received data is stored in the buffer in-place (the old data is replaced with the data received). + +[float] +=== Syntax + +`receivedVal = SPI.transfer(val)` + +`receivedVal16 = SPI.transfer16(val16)` + +`SPI.transfer(buffer, size)` + + +[float] +=== Parameters + +* val: the byte to send out over the bus +* val16: the two bytes variable to send out over the bus +* buffer: the array of data to be transferred + + +[float] +=== Returns +The received data. + +-- +// OVERVIEW SECTION ENDS + diff --git a/Language/Functions/Communication/SPI/usingInterrupt.adoc b/Language/Functions/Communication/SPI/usingInterrupt.adoc new file mode 100644 index 000000000..7769ba39d --- /dev/null +++ b/Language/Functions/Communication/SPI/usingInterrupt.adoc @@ -0,0 +1,33 @@ +--- +title: SPI.usingInterrupt() +--- + += SPI.usingInterrupt() + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +If your program will perform SPI transactions within an interrupt, call this function to register the interrupt number or name with the SPI library. This allows `SPI.beginTransaction()` to prevent usage conflicts. Note that the interrupt specified in the call to usingInterrupt() will be disabled on a call to `beginTransaction()` and re-enabled in `endTransaction().` + +[float] +=== Syntax + +`SPI.usingInterrupt(interruptNumber)` + + +[float] +=== Parameters + +interruptNumber: the associated interrupt number. + +[float] +=== Returns +None. + +-- +// OVERVIEW SECTION ENDS + From b92545196f62f1ce4b6385419b10a84e9ebba6b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 21 Jan 2022 17:59:12 +0100 Subject: [PATCH 187/298] Update links with lowercase --- Language/Functions/Communication/SPI.adoc | 18 +++++++++--------- .../Communication/SPI/SPISettings.adoc | 3 ++- .../Communication/SPI/beginTransaction.adoc | 4 ++-- .../Communication/SPI/setBitOrder.adoc | 2 +- .../Communication/SPI/setClockDivider.adoc | 7 ++++--- .../Communication/SPI/setDataMode.adoc | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index b77499d5c..7d8f82036 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -36,15 +36,15 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le [float] === Functions -link:../SPI/SPISettings[SPISettings] + -link:../SPI/begin[begin()] + -link:../SPI/beginTransaction[beginTransaction()] + -link:../SPI/end[end()] + -link:../SPI/setBitOrder[setBitOrder()] + -link:../SPI/setClockDivider[setClockDivider()] + -link:../SPI/setDataMode[setDataMode()] + -link:../SPI/transfer[transfer()] + -link:../SPI/usingInterrupt[usingInterrupt()] +link:../spi/spisettings[SPISettings] + +link:../spi/begin[begin()] + +link:../spi/begintransaction[beginTransaction()] + +link:../spi/end[end()] + +link:../spi/setbitorder[setBitOrder()] + +link:../spi/setclockdivider[setClockDivider()] + +link:../spi/setdatamode[setDataMode()] + +link:../spi/transfer[transfer()] + +link:../spi/usinginterrupt[usingInterrupt()] ''' diff --git a/Language/Functions/Communication/SPI/SPISettings.adoc b/Language/Functions/Communication/SPI/SPISettings.adoc index d8c7351af..a0586c8b6 100644 --- a/Language/Functions/Communication/SPI/SPISettings.adoc +++ b/Language/Functions/Communication/SPI/SPISettings.adoc @@ -22,12 +22,13 @@ If any of your settings are variables, you may create a SPISettings object to ho `SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0))` Note: Best if all 3 settings are constants -`SPISettings mySettting(speedMaximum, dataOrder, dataMode)` +`SPISettings mySetting(speedMaximum, dataOrder, dataMode)` Note: Best when any setting is a variable'' [float] === Parameters + `speedMaximum`: The maximum speed of communication. For a SPI chip rated up to 20 MHz, use 20000000. + `dataOrder`: MSBFIRST or LSBFIRST + `dataMode`: SPI_MODE0, SPI_MODE1, SPI_MODE2, or SPI_MODE3 diff --git a/Language/Functions/Communication/SPI/beginTransaction.adoc b/Language/Functions/Communication/SPI/beginTransaction.adoc index 6c9f63b7f..3b5147aff 100644 --- a/Language/Functions/Communication/SPI/beginTransaction.adoc +++ b/Language/Functions/Communication/SPI/beginTransaction.adoc @@ -11,7 +11,7 @@ title: SPI.beginTransaction() [float] === Description -Initializes the SPI bus using the defined link:SPISettings[SPISettings]. +Initializes the SPI bus using the defined link:../spisettings[SPISettings]. [float] @@ -21,7 +21,7 @@ Initializes the SPI bus using the defined link:SPISettings[SPISettings]. [float] === Parameters -mySettings: the chosen settings according to link:SPISettings[SPISettings]. +mySettings: the chosen settings according to link:../spisettings[SPISettings]. [float] diff --git a/Language/Functions/Communication/SPI/setBitOrder.adoc b/Language/Functions/Communication/SPI/setBitOrder.adoc index b1e09d264..c67d40c1e 100644 --- a/Language/Functions/Communication/SPI/setBitOrder.adoc +++ b/Language/Functions/Communication/SPI/setBitOrder.adoc @@ -11,7 +11,7 @@ title: SPI.setBitOrder() [float] === Description -This function should not be used in new projects. Use link:SPISettings[SPISettings]. with link:beginTransaction[SPI.beginTransaction()]. to configure SPI parameters. +This function should not be used in new projects. Use link:../spisettings[SPISettings]. with link:../begintransaction[SPI.beginTransaction()]. to configure SPI parameters. Sets the order of the bits shifted out of and into the SPI bus, either LSBFIRST (least-significant bit first) or MSBFIRST (most-significant bit first). diff --git a/Language/Functions/Communication/SPI/setClockDivider.adoc b/Language/Functions/Communication/SPI/setClockDivider.adoc index 2aad770e1..edb835c99 100644 --- a/Language/Functions/Communication/SPI/setClockDivider.adoc +++ b/Language/Functions/Communication/SPI/setClockDivider.adoc @@ -11,7 +11,7 @@ title: SPI.setClockDivider() [float] === Description -This function should not be used in new projects. Use link:SPISettings[SPISettings]. with link:beginTransaction[SPI.beginTransaction()]. to configure SPI parameters. +This function should not be used in new projects. Use link:../spisettings[SPISettings]. with link:../begintransaction[SPI.beginTransaction()]. to configure SPI parameters. Sets the SPI clock divider relative to the system clock. On AVR based boards, the dividers available are 2, 4, 8, 16, 32, 64 or 128. The default setting is SPI_CLOCK_DIV4, which sets the SPI clock to one-quarter the frequency of the system clock (4 Mhz for the boards at 16 MHz). @@ -27,6 +27,7 @@ Sets the SPI clock divider relative to the system clock. On AVR based boards, th === Parameters divider (only AVR boards): + * SPI_CLOCK_DIV2 * SPI_CLOCK_DIV4 * SPI_CLOCK_DIV8 @@ -35,8 +36,8 @@ divider (only AVR boards): * SPI_CLOCK_DIV64 * SPI_CLOCK_DIV128 -chipSelectPin: peripheral device CS pin (Arduino Due only) -divider: a number from 1 to 255 (Arduino Due only) +*chipSelectPin*: peripheral device CS pin (Arduino Due only) +*divider*: a number from 1 to 255 (Arduino Due only) [float] === Returns diff --git a/Language/Functions/Communication/SPI/setDataMode.adoc b/Language/Functions/Communication/SPI/setDataMode.adoc index 4a0472fa1..4089e5e89 100644 --- a/Language/Functions/Communication/SPI/setDataMode.adoc +++ b/Language/Functions/Communication/SPI/setDataMode.adoc @@ -10,7 +10,7 @@ title: SPI.setDataMode() [float] === Description -This function should not be used in new projects. Use link:SPISettings[SPISettings]. with link:beginTransaction[SPI.beginTransaction()]. to configure SPI parameters. +This function should not be used in new projects. Use link:../spisettings[SPISettings]. with link:../begintransaction[SPI.beginTransaction()]. to configure SPI parameters. Sets the SPI data mode: that is, clock polarity and phase. See the Wikipedia article on http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus:[SPI] for details. From 1c575d03fe52a00f3090b2609c172fb0b2f1d58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 14 Feb 2022 11:45:06 +0100 Subject: [PATCH 188/298] Add Wire Documentation --- Language/Functions/Communication/Wire.adoc | 78 +++++++++++++ .../Communication/Wire/available.adoc | 30 +++++ .../Functions/Communication/Wire/begin.adoc | 31 ++++++ .../Communication/Wire/beginTransmission.adoc | 28 +++++ .../Wire/clearWireTimeoutFlag.adoc | 37 ++++++ .../Functions/Communication/Wire/end.adoc | 31 ++++++ .../Communication/Wire/endTransmission.adoc | 34 ++++++ .../Wire/getWireTimeoutFlag.adoc | 37 ++++++ .../Communication/Wire/onReceive.adoc | 30 +++++ .../Communication/Wire/onRequest.adoc | 30 +++++ .../Functions/Communication/Wire/read.adoc | 54 +++++++++ .../Communication/Wire/requestFrom.adoc | 33 ++++++ .../Communication/Wire/setClock.adoc | 28 +++++ .../Communication/Wire/setWireTimeout.adoc | 105 ++++++++++++++++++ .../Functions/Communication/Wire/write.adoc | 61 ++++++++++ 15 files changed, 647 insertions(+) create mode 100644 Language/Functions/Communication/Wire.adoc create mode 100644 Language/Functions/Communication/Wire/available.adoc create mode 100644 Language/Functions/Communication/Wire/begin.adoc create mode 100644 Language/Functions/Communication/Wire/beginTransmission.adoc create mode 100644 Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc create mode 100644 Language/Functions/Communication/Wire/end.adoc create mode 100644 Language/Functions/Communication/Wire/endTransmission.adoc create mode 100644 Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc create mode 100644 Language/Functions/Communication/Wire/onReceive.adoc create mode 100644 Language/Functions/Communication/Wire/onRequest.adoc create mode 100644 Language/Functions/Communication/Wire/read.adoc create mode 100644 Language/Functions/Communication/Wire/requestFrom.adoc create mode 100644 Language/Functions/Communication/Wire/setClock.adoc create mode 100644 Language/Functions/Communication/Wire/setWireTimeout.adoc create mode 100644 Language/Functions/Communication/Wire/write.adoc diff --git a/Language/Functions/Communication/Wire.adoc b/Language/Functions/Communication/Wire.adoc new file mode 100644 index 000000000..943ba09f3 --- /dev/null +++ b/Language/Functions/Communication/Wire.adoc @@ -0,0 +1,78 @@ +--- +title: Wire +categories: [ "Functions" ] +subCategories: [ "Communication" ] +--- + + += Wire + + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + + +This library allows you to communicate with I2C/TWI devices. On the Arduino boards with the R3 layout (1.0 pinout), the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. The Arduino Due has two I2C/TWI interfaces SDA1 and SCL1 are near to the AREF pin and the additional one is on pins 20 and 21. + +As a reference the table below shows where TWI pins are located on various Arduino boards. + +[cols="1,1"] +|=== +|Board +|I2C/TWI pins + +|UNO, Ethernet +|A4 (SDA), A5 (SCL) + +|Mega2560 +|20 (SDA), 21 (SCL) + +|Leonardo +|20 (SDA), 21 (SCL), SDA1, SCL1 +|=== + + +As of Arduino 1.0, the library inherits from the Stream functions, making it consistent with other read/write libraries. Because of this, `send()` and `receive()` have been replaced with `read()` and `write()`. + +Recent versions of the Wire library can use timeouts to prevent a lockup in the face of certain problems on the bus, but this is not enabled by default (yet) in current versions. It is recommended to always enable these timeouts when using the Wire library. See the Wire.setWireTimeout function for more details. + +*Note:* There are both 7 and 8-bit versions of I2C addresses. 7 bits identify the device, and the eighth bit determines if it's being written to or read from. The Wire library uses 7 bit addresses throughout. If you have a datasheet or sample code that uses 8-bit address, you'll want to drop the low bit (i.e. shift the value one bit to the right), yielding an address between 0 and 127. However the addresses from 0 to 7 are not used because are reserved so the first address that can be used is 8. Please note that a pull-up resistor is needed when connecting SDA/SCL pins. Please refer to the examples for more information. MEGA 2560 board has pull-up resistors on pins 20 and 21 onboard. + +*The Wire library implementation uses a 32 byte buffer, therefore any communication should be within this limit. Exceeding bytes in a single transmission will just be dropped.* + +To use this library: + +`#include ` + +-- +// OVERVIEW SECTION ENDS + +//FUNCTION SECTION STARTS +[#functions] +-- + +''' +[float] +=== Functions +link:../wire/begin[begin()] + +link:../wire/end[end()] + +link:../wire/requestfrom[requestFrom()] + +link:../wire/begintransmission[beginTransmission()] + +link:../wire/write[write()] + +link:../wire/available[available()] + +link:../wire/read[read()] + +link:../wire/setclock[setClock()] + +link:../wire/onreceive[onReceive()] + +link:../wire/onrequest[onRequest()] + +link:../wire/setwiretimeout[setWireTimeout()] + +link:../wire/clearwiretimeoutflag[clearWireTimeoutFlag()] + +link:../wire/getwiretimeoutflag[getWireTimeoutFlag()] + +''' + +-- +// FUNCTION SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/available.adoc b/Language/Functions/Communication/Wire/available.adoc new file mode 100644 index 000000000..db375e9ee --- /dev/null +++ b/Language/Functions/Communication/Wire/available.adoc @@ -0,0 +1,30 @@ +--- +title: available() +--- + += available + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function returns the number of bytes available for retrieval with `read()`. This function should be called on a controller device after a call to `requestFrom()` or on a peripheral inside the `onReceive()` handler. `available()` inherits from the Stream utility class. + +[float] +=== Syntax +`Wire.available()` + +[float] +=== Parameters + +None. + +[float] +=== Returns + +The number of bytes available for reading. + +-- +//OVERVIEW SECTION STARTS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/begin.adoc b/Language/Functions/Communication/Wire/begin.adoc new file mode 100644 index 000000000..cbd0dea14 --- /dev/null +++ b/Language/Functions/Communication/Wire/begin.adoc @@ -0,0 +1,31 @@ +--- +title: begin() +--- += begin + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +This function initializes the Wire library and join the I2C bus as a controller or a peripheral. This function should normally be called only once. + +[float] +=== Syntax + +`Wire.begin()` + +`Wire.begin(address)` + +[float] +=== Parameters +* _address_: the 7-bit slave address (optional); if not specified, join the bus as a controller device. + +[float] +=== Returns +None. +-- + +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/beginTransmission.adoc b/Language/Functions/Communication/Wire/beginTransmission.adoc new file mode 100644 index 000000000..ffc686af5 --- /dev/null +++ b/Language/Functions/Communication/Wire/beginTransmission.adoc @@ -0,0 +1,28 @@ +--- +title: beginTransmission() +--- + += beginTransmission + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function begins a transmission to the I2C peripheral device with the given address. Subsequently, queue bytes for transmission with the `write()` function and transmit them by calling `endTransmission()`. + +[float] +=== Syntax + +`Wire.beginTransmission(address)` + +[float] +=== Parameters +* _address_: the 7-bit address of the device to transmit to. + +[float] +=== Returns +None. +-- +//OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc b/Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc new file mode 100644 index 000000000..b5a44711f --- /dev/null +++ b/Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc @@ -0,0 +1,37 @@ +--- +title: clearWireTimeoutFlag() +--- += clearWireTimeoutFlag + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +Clears the timeout flag. + +Timeouts might not be enabled by default. See the documentation for `Wire.setWireTimeout()` for more information on how to configure timeouts and how they work. + + +[float] +=== Syntax + +`Wire.clearTimeout()` + +[float] +=== Parameters +None. + +[float] +=== Returns +* bool: The current value of the flag + +[float] +=== Portability Notes +This function was not available in the original version of the Wire library and might still not be available on all platforms. Code that needs to be portable across platforms and versions can use the `WIRE_HAS_TIMEOUT` macro, which is only defined when `Wire.setWireTimeout()`, `Wire.getWireTimeoutFlag()` and `Wire.clearWireTimeout()` are all available. + +-- + +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/end.adoc b/Language/Functions/Communication/Wire/end.adoc new file mode 100644 index 000000000..74871fba4 --- /dev/null +++ b/Language/Functions/Communication/Wire/end.adoc @@ -0,0 +1,31 @@ +--- +title: end() +--- += end + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +Disable the Wire library, reversing the effect of `Wire.begin()`. To use the Wire library again after this, call `Wire.begin()` again. + +*Note:* This function was not available in the original version of the Wire library and might still not be available on all platforms. Code that needs to be portable across platforms and versions can use the `WIRE_HAS_END` macro, which is only defined when `Wire.end()` is available. + +[float] +=== Syntax + +`Wire.end()` + +[float] +=== Parameters +None. + +[float] +=== Returns +None. +-- + +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/endTransmission.adoc b/Language/Functions/Communication/Wire/endTransmission.adoc new file mode 100644 index 000000000..94efab0c1 --- /dev/null +++ b/Language/Functions/Communication/Wire/endTransmission.adoc @@ -0,0 +1,34 @@ +--- +title: endTransmission() +--- + += endTransmission + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function ends a transmission to a peripheral device that was begun by `beginTransmission()` and transmits the bytes that were queued by `write()`. As of Arduino 1.0.1, `endTransmission()` accepts a boolean argument changing its behavior for compatibility with certain I2C devices. If true, `endTransmission()` sends a stop message after transmission, releasing the I2C bus. If false, `endTransmission()` sends a restart message after transmission. The bus will not be released, which prevents another controller device from transmitting between messages. This allows one controller device to send multiple transmissions while in control. The default value is true. + +[float] +=== Syntaxx +`Wire.endTransmission()` +`Wire.endTransmission(stop)` + +[float] +=== Parameterss + +* _stop_: true or false. True will send a stop message, releasing the bus after transmission. False will send a restart, keeping the connection active. +[float] +=== Returns + +* _0_: success. +* _1_: data too long to fit in transmit buffer. +* _2_: received NACK on transmit of address. +* _3_: received NACK on transmit of data. +* _4_: other error. +* _5_: timeout +-- +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc b/Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc new file mode 100644 index 000000000..25c5301d2 --- /dev/null +++ b/Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc @@ -0,0 +1,37 @@ +--- +title: getWireTimeoutFlag() +--- += getWireTimeoutFlag + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +Checks whether a timeout has occured since the last time the flag was cleared. + +This flag is set is set whenever a timeout occurs and cleared when `Wire.clearWireTimeoutFlag()` is called, or when the timeout is changed using `Wire.setWireTimeout()`. + + +[float] +=== Syntax + +`Wire.getWireTimeoutFlag()` + +[float] +=== Parameters +None. + +[float] +=== Returns +* bool: The current value of the flag + +[float] +=== Portability Notes +This function was not available in the original version of the Wire library and might still not be available on all platforms. Code that needs to be portable across platforms and versions can use the `WIRE_HAS_TIMEOUT` macro, which is only defined when `Wire.setWireTimeout()`, `Wire.getWireTimeoutFlag()` and `Wire.clearWireTimeout()` are all available. + +-- + +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/onReceive.adoc b/Language/Functions/Communication/Wire/onReceive.adoc new file mode 100644 index 000000000..7b102215d --- /dev/null +++ b/Language/Functions/Communication/Wire/onReceive.adoc @@ -0,0 +1,30 @@ +--- +title: onReceieve() +--- + += onReceive + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +This function registers a function to be called when a peripheral device receives a transmission from a controller device. + +[float] +=== Syntax +`Wire.onReceive(handler)` + +[float] +=== Parameters + +* _handler_: the function to be called when the peripheral device receives data; this should take a single int parameter (the number of bytes read from the controller device) and return nothing. + +[float] +=== Returns + +None. +-- +//OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Wire/onRequest.adoc b/Language/Functions/Communication/Wire/onRequest.adoc new file mode 100644 index 000000000..3b56c9a8d --- /dev/null +++ b/Language/Functions/Communication/Wire/onRequest.adoc @@ -0,0 +1,30 @@ +--- +title: onRequest() +--- + += onRequest + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function registers a function to be called when a controller device requests data from a peripheral device. + +[float] +=== Syntax +`Wire.onRequest(handler)` + +[float] +=== Parameters + +* _handler_: the function to be called, takes no parameters and returns nothing. + +[float] +=== Returns + +None. + +-- +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/read.adoc b/Language/Functions/Communication/Wire/read.adoc new file mode 100644 index 000000000..73f56240f --- /dev/null +++ b/Language/Functions/Communication/Wire/read.adoc @@ -0,0 +1,54 @@ +--- +title: read() +--- + += read + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function reads a byte that was transmitted from a peripheral device to a controller device after a call to `requestFrom()` or was transmitted from a controller device to a peripheral device. `read()` inherits from the Stream utility class. + +[float] +=== Syntax +`Wire.read()` + +[float] +=== Parameters + +None. + +[float] +=== Returns + +The next byte received. + +[float] +=== Example + +``` +#include + +void setup() { + Wire.begin(); // Join I2C bus (address is optional for controller device) + Serial.begin(9600); // Start serial for output +} + +void loop() { + Wire.requestFrom(2, 6); // Request 6 bytes from slave device number two + + // Slave may send less than requested + while(Wire.available()) { + char c = Wire.read(); // Receive a byte as character + Serial.print(c); // Print the character + } + + delay(500); +} +``` + +-- +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/requestFrom.adoc b/Language/Functions/Communication/Wire/requestFrom.adoc new file mode 100644 index 000000000..ca9f2a441 --- /dev/null +++ b/Language/Functions/Communication/Wire/requestFrom.adoc @@ -0,0 +1,33 @@ +--- +title: requestFrom() +--- + += requestFrom + +// OVERVIEW SECTION STARTS +[#overview] + +-- + +[float] +=== Description +This function is used by the controller device to request bytes from a peripheral device. The bytes may then be retrieved with the `available()` and `read()` functions. As of Arduino 1.0.1, `requestFrom()` accepts a boolean argument changing its behavior for compatibility with certain I2C devices. If true, `requestFrom()` sends a stop message after the request, releasing the I2C bus. If false, `requestFrom()` sends a restart message after the request. The bus will not be released, which prevents another master device from requesting between messages. This allows one master device to send multiple requests while in control. The default value is true. + +[float] +=== Syntax +`Wire.requestFrom(address, quantity)` + +`Wire.requestFrom(address, quantity, stop)` + +[float] +=== Parameters +* _address_: the 7-bit slave address of the device to request bytes from. +* _quantity_: the number of bytes to request. +* _stop_: true or false. true will send a stop message after the request, releasing the bus. False will continually send a restart after the request, keeping the connection active. + +[float] +=== Returns +* _byte_ : the number of bytes returned from the peripheral device. + +-- +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/setClock.adoc b/Language/Functions/Communication/Wire/setClock.adoc new file mode 100644 index 000000000..f47de0c20 --- /dev/null +++ b/Language/Functions/Communication/Wire/setClock.adoc @@ -0,0 +1,28 @@ +--- +title: setClock() +--- + += setClock + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function modifies the clock frequency for I2C communication. I2C peripheral devices have no minimum working clock frequency, however 100KHz is usually the baseline. + +[float] +=== Syntax +`Wire.setClock(clockFrequency)` + +[float] +=== Parameters +* _clockFrequency_: the value (in Hertz) of the desired communication clock. Accepted values are 100000 (standard mode) and 400000 (fast mode). Some processors also support 10000 (low speed mode), 1000000 (fast mode plus) and 3400000 (high speed mode). Please refer to the specific processor documentation to make sure the desired mode is supported. + +[float] +=== Returns + +None. +-- +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/setWireTimeout.adoc b/Language/Functions/Communication/Wire/setWireTimeout.adoc new file mode 100644 index 000000000..761e6797c --- /dev/null +++ b/Language/Functions/Communication/Wire/setWireTimeout.adoc @@ -0,0 +1,105 @@ +--- +title: setWireTimeout() +--- += setWireTimeout + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description + +Sets the timeout for Wire transmissions in master mode. + +*Note:* these timeouts are almost always an indication of an underlying problem, such as misbehaving devices, noise, insufficient shielding, or other electrical problems. These timeouts will prevent your sketch from locking up, but not solve these problems. In such situations there will often (also) be data corruption which doesn't result in a timeout or other error and remains undetected. So when a timeout happens, it is likely that some data previously read or written is also corrupted. Additional measures might be needed to more reliably detect such issues (e.g. checksums or reading back written values) and recover from them (e.g. full system reset). This timeout and such additional measures should be seen as a last line of defence, when possible the underlying cause should be fixed instead. + +[float] +=== Syntax + +`Wire.setWireTimeout(timeout, reset_on_timeout)` + +`Wire.setWireTimeout()` + +[float] +=== Parameters +* `timeout a timeout`: timeout in microseconds, if zero then timeout checking is disabled +* `reset_on_timeout`: if true then Wire hardware will be automatically reset on timeout + +When this function is called without parameters, a default timeout is configured that should be sufficient to prevent lockups in a typical single-master configuration. + +[float] +=== Returns +None. + +[float] +=== Example Code + +``` +#include + +void setup() { + Wire.begin(); // join i2c bus (address optional for master) + #if defined(WIRE_HAS_TIMEOUT) + Wire.setWireTimeout(3000 /* us */, true /* reset_on_timeout */); + #endif +} + +byte x = 0; + +void loop() { + /* First, send a command to the other device */ + Wire.beginTransmission(8); // transmit to device #8 + Wire.write(123); // send command + byte error = Wire.endTransmission(); // run transaction + if (error) { + Serial.println("Error occured when writing"); + if (error == 5) + Serial.println("It was a timeout"); + } + + delay(100); + + /* Then, read the result */ + #if defined(WIRE_HAS_TIMEOUT) + Wire.clearWireTimeoutFlag(); + #endif + byte len = Wire.requestFrom(8, 1); // request 1 byte from device #8 + if (len == 0) { + Serial.println("Error occured when reading"); + #if defined(WIRE_HAS_TIMEOUT) + if (Wire.getWireTimeoutFlag()) + Serial.println("It was a timeout"); + #endif + } + + delay(100); +} +``` + +[float] +=== Notes and Warnings + +How this timeout is implemented might vary between different platforms, but typically a timeout condition is triggered when waiting for (some part of) the transaction to complete (e.g. waiting for the bus to become available again, waiting for an ACK bit, or maybe waiting for the entire transaction to be completed). + +When such a timeout condition occurs, the transaction is aborted and `endTransmission()` or `requestFrom()` will return an error code or zero bytes respectively. While this will not resolve the bus problem by itself (i.e. it does not remove a short-circuit), it will at least prevent blocking potentially indefinitely and allow your software to detect and maybe solve this condition. + +If `reset_on_timeout` was set to true and the platform supports this, the Wire hardware is also reset, which can help to clear any incorrect state inside the Wire hardware module. For example, on the AVR platform, this can be required to restart communications after a noise-induced timeout. + +When a timeout is triggered, a flag is set that can be queried with `getWireTimeoutFlag()` and must be cleared manually using `clearWireTimeoutFlag()` (and is also cleared when `setWireTimeout()` is called). + +Note that this timeout can also trigger while waiting for clock stretching or waiting for a second master to complete its transaction. So make sure to adapt the timeout to accomodate for those cases if needed. A typical timeout would be 25ms (which is the maximum clock stretching allowed by the SMBus protocol), but (much) shorter values will usually also work. + + +[float] +=== Portability Notes + +This function was not available in the original version of the Wire library and might still not be available on all platforms. Code that needs to be portable across platforms and versions can use the `WIRE_HAS_TIMEOUT` macro, which is only defined when `Wire.setWireTimeout()`, `Wire.getWireTimeoutFlag()` and `Wire.clearWireTimeout()` are all available. + +When this timeout feature was introduced on the AVR platform, it was initially kept disabled by default for compatibility, expecting it to become enabled at a later point. This means the default value of the timeout can vary between (versions of) platforms. The default timeout settings are available from the `WIRE_DEFAULT_TIMEOUT` and `WIRE_DEFAULT_RESET_WITH_TIMEOUT` macro. + +If you require the timeout to be disabled, it is recommended you disable it by default using `setWireTimeout(0)`, even though that is currently the default. + +-- + +//OVERVIEW SECTION ENDS \ No newline at end of file diff --git a/Language/Functions/Communication/Wire/write.adoc b/Language/Functions/Communication/Wire/write.adoc new file mode 100644 index 000000000..3bd29962d --- /dev/null +++ b/Language/Functions/Communication/Wire/write.adoc @@ -0,0 +1,61 @@ +--- +title: write() +--- + += write + +//OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +This function writes data from a peripheral device in response to a request from a controller device, or queues bytes for transmission from a controller to peripheral device (in-between calls to `beginTransmission()` and `endTransmission()`). + +[float] +=== Syntax +`Wire.write(value)` +`Wire.write(string)` +`Wire.write(data, length)` + +[float] +=== Parameters +* _value_: a value to send as a single byte. +* _string_: a string to send as a series of bytes. +* _data_: an array of data to send as bytes. +* _length_: the number of bytes to transmit. + +[float] +=== Returns + +The number of bytes written (reading this number is optional). +[float] +=== Example + +``` +#include + +byte val = 0; + +void setup() { + Wire.begin(); // Join I2C bus +} + +void loop() { + Wire.beginTransmission(44); // Transmit to device number 44 (0x2C) + + Wire.write(val); // Sends value byte + Wire.endTransmission(); // Stop transmitting + + val++; // Increment value + + // if reached 64th position (max) + if(val == 64) { + val = 0; // Start over from lowest value + } + + delay(500); +} +``` +-- +//OVERVIEW SECTION ENDS From 6291a271e3f1ae42a40bbc1859bfded3c39aa88a Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 19 Mar 2022 22:44:38 +0100 Subject: [PATCH 189/298] keyboardModifiers: split modifiers and special keys Language/Functions/USB/Keyboard/keyboardModifiers.adoc contains a table of key macros described as "modifier keys". Most entries in this table, however, are not modifiers: arrow keys, function keys, etc. Split the table in two: one table for the actual modifiers, and another one for all the other key macros, collectively described as "special keys". --- .../USB/Keyboard/keyboardModifiers.adoc | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 6ff0b9c75..55dabfbe9 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -1,11 +1,11 @@ --- -title: Keyboard Modifiers +title: Keyboard Modifiers and Special Keys --- -= Keyboard Modifiers += Keyboard modifiers and special keys // OVERVIEW SECTION STARTS @@ -16,9 +16,11 @@ title: Keyboard Modifiers === Description The `Keyboard.write()` and `Keyboard.press()` and `Keyboard.release()` commands don’t work with every possible ASCII character, only those that correspond to a key on the keyboard. For example, backspace works, but many of the other non-printable characters produce unpredictable results. For capital letters (and other keys), what’s sent is shift plus the character (i.e. the equivalent of pressing both of those keys on the keyboard). [%hardbreaks] -A modifier key is a special key on a computer keyboard that modifies the normal action of another key when the two are pressed in combination. -[%hardbreaks] For more on ASCII values and the characters or functions they represent, see http://www.asciitable.com/[asciitable.com] + +[float] +=== Keyboard modifiers +A modifier key is a special key on a computer keyboard that modifies the normal action of another key when the two are pressed in combination. [%hardbreaks] For multiple key presses use link:../keyboardpress[Keyboard.press]() [%hardbreaks] @@ -37,6 +39,17 @@ The definitions of the modifier keys are listed below: |KEY_RIGHT_SHIFT |0x85 |133 |KEY_RIGHT_ALT |0x86 |134 |KEY_RIGHT_GUI |0x87 |135 +|=== + +[float] +=== Special keys +These are four keys within the alphanumeric cluster of a keyboard (Tab, Caps Lock, Backspace and Return) as well as all keys from outside that cluster (Escape, function keys, Home, End, arrow keys...). + +The following special keys have been defined: + +|=== +|Key |Hexadecimal value |Decimal value + |KEY_UP_ARROW |0xDA |218 |KEY_DOWN_ARROW |0xD9 |217 |KEY_LEFT_ARROW |0xD8 |216 From ed21ef0a041c9b69850c0fe54d08e7b6596e602d Mon Sep 17 00:00:00 2001 From: Takahiro FUJIWARA Date: Sat, 26 Mar 2022 20:33:39 +0100 Subject: [PATCH 190/298] update print.doc -- In case of floating-point and specify the number of decimal places, Serial.print() supports rounding. 0 to 4 then rounddown, 5 to 9 then round up. so the original text Serial.print(1.23456, 4) gives "1.2345" should be: Serial.print(1.23456, 4) gives "1.2346" I checked the result on TINKERCAD and update line is correct. --- Language/Functions/Communication/Serial/print.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index ff3cbe14a..eb2d5732f 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -30,7 +30,7 @@ An optional second parameter specifies the base (format) to use; permitted value * `_Serial_.print(78, HEX)` gives "4E" + * `_Serial_.print(1.23456, 0)` gives "1" + * `_Serial_.print(1.23456, 2)` gives "1.23" + -* `_Serial_.print(1.23456, 4)` gives "1.2345" +* `_Serial_.print(1.23456, 4)` gives "1.2346" You can pass flash-memory based strings to `_Serial_.print()` by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example: From 5af83af0450ec1c14c135054cf69df5939c482ca Mon Sep 17 00:00:00 2001 From: Matt Borja <3855027+mattborja@users.noreply.github.com> Date: Wed, 13 Apr 2022 01:14:01 -0700 Subject: [PATCH 191/298] Fix misspellings in headings Headings: - "Syntax" - "Parameters" --- Language/Functions/Communication/Wire/endTransmission.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Communication/Wire/endTransmission.adoc b/Language/Functions/Communication/Wire/endTransmission.adoc index 94efab0c1..2040ca993 100644 --- a/Language/Functions/Communication/Wire/endTransmission.adoc +++ b/Language/Functions/Communication/Wire/endTransmission.adoc @@ -13,12 +13,12 @@ title: endTransmission() This function ends a transmission to a peripheral device that was begun by `beginTransmission()` and transmits the bytes that were queued by `write()`. As of Arduino 1.0.1, `endTransmission()` accepts a boolean argument changing its behavior for compatibility with certain I2C devices. If true, `endTransmission()` sends a stop message after transmission, releasing the I2C bus. If false, `endTransmission()` sends a restart message after transmission. The bus will not be released, which prevents another controller device from transmitting between messages. This allows one controller device to send multiple transmissions while in control. The default value is true. [float] -=== Syntaxx +=== Syntax `Wire.endTransmission()` `Wire.endTransmission(stop)` [float] -=== Parameterss +=== Parameters * _stop_: true or false. True will send a stop message, releasing the bus after transmission. False will send a restart, keeping the connection active. [float] @@ -31,4 +31,4 @@ This function ends a transmission to a peripheral device that was begun by `begi * _4_: other error. * _5_: timeout -- -//OVERVIEW SECTION ENDS \ No newline at end of file +//OVERVIEW SECTION ENDS From 1b6b2cb898f049d65c4760c872417216a4894076 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Wed, 20 Apr 2022 14:48:30 +0200 Subject: [PATCH 192/298] keyboardModifiers: rewrite the introductory text The main purpose of the page Language/Functions/USB/Keyboard/keyboardModifiers.adoc is to list the macros representing keys. Refocus the text accordingly. --- .../USB/Keyboard/keyboardModifiers.adoc | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 55dabfbe9..8d0053633 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -14,19 +14,26 @@ title: Keyboard Modifiers and Special Keys [float] === Description -The `Keyboard.write()` and `Keyboard.press()` and `Keyboard.release()` commands don’t work with every possible ASCII character, only those that correspond to a key on the keyboard. For example, backspace works, but many of the other non-printable characters produce unpredictable results. For capital letters (and other keys), what’s sent is shift plus the character (i.e. the equivalent of pressing both of those keys on the keyboard). +When given a printable ASCII character as an argument, the functions `Keyboard.write()`, `Keyboard.press()` and `Keyboard.release()` simulate actuations on the corresponding keys. These functions can also handle ASCII characters that require pressing a key in combination with Shift or, on international keyboards, AltGr. For example: +[source,arduino] +---- +Keyboard.write('a'); // press and release the 'A' key +Keyboard.write('A'); // press Shift and 'A', then release both +---- +A typical keyboard, however, has many keys that do not match a printable ASCII character. In order to simulate those keys, the library provides a set of macros that can be passed as arguments to `Keyboard.write()`, `Keyboard.press()` and `Keyboard.release()`. For example, the key combination Shift-F2 can be generated by: +[source,arduino] +---- +Keyboard.press(KEY_LEFT_SHIFT); // press and hold Shift +Keyboard.press(KEY_F2); // press and hold F2 +Keyboard.releaseAll(); // release both +---- +Note that, in order to press multiple keys simultaneously, one has to use link:../keyboardpress[`Keyboard.press()`] rather than link:../keyboardwrite[`Keyboard.write()`], as the latter just “hits” the keys (it presses and immediate releases them). [%hardbreaks] -For more on ASCII values and the characters or functions they represent, see http://www.asciitable.com/[asciitable.com] +The available macros are listed below: [float] === Keyboard modifiers -A modifier key is a special key on a computer keyboard that modifies the normal action of another key when the two are pressed in combination. -[%hardbreaks] -For multiple key presses use link:../keyboardpress[Keyboard.press]() -[%hardbreaks] -The definitions of the modifier keys are listed below: -[%hardbreaks] - +These are eight keys within the alphanumeric cluster of the keyboard that are meant to modify the normal action of another key when the two are pressed in combination. Whereas Shift and AltGr are used to access extra characters, the others are mostly used for keyboard shortcuts. |=== |Key |Hexadecimal value |Decimal value @@ -43,9 +50,7 @@ The definitions of the modifier keys are listed below: [float] === Special keys -These are four keys within the alphanumeric cluster of a keyboard (Tab, Caps Lock, Backspace and Return) as well as all keys from outside that cluster (Escape, function keys, Home, End, arrow keys...). - -The following special keys have been defined: +These are all the keys that do not match a printable ASCII character and are not modifiers, including all keys outside the alphanumeric cluster. |=== |Key |Hexadecimal value |Decimal value From 42081fa836411589b5748d6fdf00396b493a6331 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 2 Apr 2022 18:23:45 +0200 Subject: [PATCH 193/298] keyboardModifiers: split keys into smaller groups Language/Functions/USB/Keyboard/keyboardModifiers.adoc contains a long list of macros corresponding to keys. Make this list easier to parse by organizing the keys into meaningful groups. --- .../USB/Keyboard/keyboardModifiers.adoc | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 8d0053633..42f0b1a95 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -52,24 +52,44 @@ These are eight keys within the alphanumeric cluster of the keyboard that are me === Special keys These are all the keys that do not match a printable ASCII character and are not modifiers, including all keys outside the alphanumeric cluster. +[float] +==== Within the alphanumeric cluster + |=== |Key |Hexadecimal value |Decimal value -|KEY_UP_ARROW |0xDA |218 -|KEY_DOWN_ARROW |0xD9 |217 -|KEY_LEFT_ARROW |0xD8 |216 -|KEY_RIGHT_ARROW |0xD7 |215 -|KEY_BACKSPACE |0xB2 |178 |KEY_TAB |0xB3 |179 +|KEY_CAPS_LOCK |0xC1 |193 +|KEY_BACKSPACE |0xB2 |178 |KEY_RETURN |0xB0 |176 -|KEY_ESC |0xB1 |177 +|=== + +[float] +==== Navigation cluster + +|=== +|Key |Hexadecimal value |Decimal value + |KEY_INSERT |0xD1 |209 |KEY_DELETE |0xD4 |212 -|KEY_PAGE_UP |0xD3 |211 -|KEY_PAGE_DOWN |0xD6 |214 |KEY_HOME |0xD2 |210 |KEY_END |0xD5 |213 -|KEY_CAPS_LOCK |0xC1 |193 +|KEY_PAGE_UP |0xD3 |211 +|KEY_PAGE_DOWN |0xD6 |214 +|KEY_UP_ARROW |0xDA |218 +|KEY_DOWN_ARROW |0xD9 |217 +|KEY_LEFT_ARROW |0xD8 |216 +|KEY_RIGHT_ARROW |0xD7 |215 +|=== + +[float] +==== Escape and function keys +The library can simulate function keys up to F24, even though few keyboards have the F13… F24 keys. + +|=== +|Key |Hexadecimal value |Decimal value + +|KEY_ESC |0xB1 |177 |KEY_F1 |0xC2 |194 |KEY_F2 |0xC3 |195 |KEY_F3 |0xC4 |196 From a7b4ff990af68a2007842c50f933c8cb3d1eaf43 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 2 Apr 2022 20:34:54 +0200 Subject: [PATCH 194/298] keyboardModifiers: add notes to ambiguous keys In Language/Functions/USB/Keyboard/keyboardModifiers.adoc, add explanatory notes for keys with ambiguous names: - KEY_{LEFT,RIGHT}_GUI are the OS logo keys, "command" on Mac - KEY_{LEFT,RIGHT}_ALT is "option" on Mac - KEY_RIGHT_ALT can be labeled "AltGr". --- .../USB/Keyboard/keyboardModifiers.adoc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 42f0b1a95..30e85b935 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -36,16 +36,16 @@ The available macros are listed below: These are eight keys within the alphanumeric cluster of the keyboard that are meant to modify the normal action of another key when the two are pressed in combination. Whereas Shift and AltGr are used to access extra characters, the others are mostly used for keyboard shortcuts. |=== -|Key |Hexadecimal value |Decimal value - -|KEY_LEFT_CTRL |0x80 |128 -|KEY_LEFT_SHIFT |0x81 |129 -|KEY_LEFT_ALT |0x82 |130 -|KEY_LEFT_GUI |0x83 |131 -|KEY_RIGHT_CTRL |0x84 |132 -|KEY_RIGHT_SHIFT |0x85 |133 -|KEY_RIGHT_ALT |0x86 |134 -|KEY_RIGHT_GUI |0x87 |135 +|Key |Hexadecimal value |Decimal value |Notes + +|KEY_LEFT_CTRL |0x80 |128 | +|KEY_LEFT_SHIFT |0x81 |129 | +|KEY_LEFT_ALT |0x82 |130 |option (⌥) on Mac +|KEY_LEFT_GUI |0x83 |131 |OS logo, command (⌘) on Mac +|KEY_RIGHT_CTRL |0x84 |132 | +|KEY_RIGHT_SHIFT |0x85 |133 | +|KEY_RIGHT_ALT |0x86 |134 |also AltGr, option (⌥) on Mac +|KEY_RIGHT_GUI |0x87 |135 |OS logo, command (⌘) on Mac |=== [float] From 0a0c5b4bfc3f1aca0cbd85d52b91ea03e0a9106c Mon Sep 17 00:00:00 2001 From: Siesta <90094025+Pbaodoge@users.noreply.github.com> Date: Sun, 24 Apr 2022 08:15:43 +0700 Subject: [PATCH 195/298] Fixed grammar mistake --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index cbe8fde78..90010049d 100644 --- a/README.adoc +++ b/README.adoc @@ -47,7 +47,7 @@ reference-en │ ├── Functions │ ├── Structure │ └── Variables -├── LICENCE.md +├── LICENSE.md └── README.adoc ---- From eba85e412125418ec3d480ff24edbed292666888 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 7 May 2022 14:31:32 +0200 Subject: [PATCH 196/298] keyboardModifiers: Implement review suggestions Apply changes suggested by @per1234 on pull-request review: - fix typo - use common conventions for key names and key combinations - reduce unnecessary verbosity. Co-authored-by: per1234 --- .../USB/Keyboard/keyboardModifiers.adoc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 30e85b935..f6b86b558 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -20,37 +20,37 @@ When given a printable ASCII character as an argument, the functions `Keyboard.w Keyboard.write('a'); // press and release the 'A' key Keyboard.write('A'); // press Shift and 'A', then release both ---- -A typical keyboard, however, has many keys that do not match a printable ASCII character. In order to simulate those keys, the library provides a set of macros that can be passed as arguments to `Keyboard.write()`, `Keyboard.press()` and `Keyboard.release()`. For example, the key combination Shift-F2 can be generated by: +A typical keyboard, however, has many keys that do not match a printable ASCII character. In order to simulate those keys, the library provides a set of macros that can be passed as arguments to `Keyboard.write()`, `Keyboard.press()` and `Keyboard.release()`. For example, the key combination Shift+F2 can be generated by: [source,arduino] ---- Keyboard.press(KEY_LEFT_SHIFT); // press and hold Shift Keyboard.press(KEY_F2); // press and hold F2 Keyboard.releaseAll(); // release both ---- -Note that, in order to press multiple keys simultaneously, one has to use link:../keyboardpress[`Keyboard.press()`] rather than link:../keyboardwrite[`Keyboard.write()`], as the latter just “hits” the keys (it presses and immediate releases them). +Note that, in order to press multiple keys simultaneously, one has to use link:../keyboardpress[`Keyboard.press()`] rather than link:../keyboardwrite[`Keyboard.write()`], as the latter just “hits” the keys (it presses and immediately releases them). [%hardbreaks] The available macros are listed below: [float] === Keyboard modifiers -These are eight keys within the alphanumeric cluster of the keyboard that are meant to modify the normal action of another key when the two are pressed in combination. Whereas Shift and AltGr are used to access extra characters, the others are mostly used for keyboard shortcuts. +These keys are meant to modify the normal action of another key when the two are pressed in combination. |=== |Key |Hexadecimal value |Decimal value |Notes |KEY_LEFT_CTRL |0x80 |128 | |KEY_LEFT_SHIFT |0x81 |129 | -|KEY_LEFT_ALT |0x82 |130 |option (⌥) on Mac -|KEY_LEFT_GUI |0x83 |131 |OS logo, command (⌘) on Mac +|KEY_LEFT_ALT |0x82 |130 |Option (⌥) on Mac +|KEY_LEFT_GUI |0x83 |131 |OS logo, Command (⌘) on Mac |KEY_RIGHT_CTRL |0x84 |132 | |KEY_RIGHT_SHIFT |0x85 |133 | -|KEY_RIGHT_ALT |0x86 |134 |also AltGr, option (⌥) on Mac -|KEY_RIGHT_GUI |0x87 |135 |OS logo, command (⌘) on Mac +|KEY_RIGHT_ALT |0x86 |134 |also AltGr, Option (⌥) on Mac +|KEY_RIGHT_GUI |0x87 |135 |OS logo, Command (⌘) on Mac |=== [float] === Special keys -These are all the keys that do not match a printable ASCII character and are not modifiers, including all keys outside the alphanumeric cluster. +These are all the keys that do not match a printable ASCII character and are not modifiers. [float] ==== Within the alphanumeric cluster @@ -84,7 +84,7 @@ These are all the keys that do not match a printable ASCII character and are not [float] ==== Escape and function keys -The library can simulate function keys up to F24, even though few keyboards have the F13… F24 keys. +The library can simulate function keys up to F24. |=== |Key |Hexadecimal value |Decimal value From 33e17beba9825ea31d8c1a0bdcfd5c5a2ae9fb0e Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 7 May 2022 21:57:38 +0200 Subject: [PATCH 197/298] Keyboard.begin(): add Danish and Swedish layouts Version 1.0.4 of the Keyboard library added the Danish and Swedish keyboard layouts. Update the documentation of Keyboard.begin() accordingly. --- Language/Functions/USB/Keyboard/keyboardBegin.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Language/Functions/USB/Keyboard/keyboardBegin.adoc b/Language/Functions/USB/Keyboard/keyboardBegin.adoc index 2c27dbf0f..bdeaab7e7 100644 --- a/Language/Functions/USB/Keyboard/keyboardBegin.adoc +++ b/Language/Functions/USB/Keyboard/keyboardBegin.adoc @@ -33,11 +33,13 @@ When used with a Leonardo or Due board, `Keyboard.begin()` starts emulating a ke === Keyboard layouts Currently, the library supports the following national keyboard layouts: +* `KeyboardLayout_da_DK`: Denmark * `KeyboardLayout_de_DE`: Germany * `KeyboardLayout_en_US`: USA * `KeyboardLayout_es_ES`: Spain * `KeyboardLayout_fr_FR`: France * `KeyboardLayout_it_IT`: Italy +* `KeyboardLayout_sv_SE`: Sweden [float] From daff214c6f675d64a699bd8482030fb88d59b0b0 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sat, 7 May 2022 21:58:06 +0200 Subject: [PATCH 198/298] KeyboardModifiers: add more key macros Version 1.0.4 of the Keyboard library added macros for more special keys, completing the coverage of a full-size PC keyboard. Some language-specific layouts also added their own macros for keys matching non-ASCII characters. Update KeyboardModifiers.adoc accordingly. --- .../USB/Keyboard/keyboardModifiers.adoc | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index f6b86b558..068bd5e05 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -62,6 +62,7 @@ These are all the keys that do not match a printable ASCII character and are not |KEY_CAPS_LOCK |0xC1 |193 |KEY_BACKSPACE |0xB2 |178 |KEY_RETURN |0xB0 |176 +|KEY_MENU |0xED |237 |=== [float] @@ -82,6 +83,31 @@ These are all the keys that do not match a printable ASCII character and are not |KEY_RIGHT_ARROW |0xD7 |215 |=== +[float] +==== Numeric keypad + +|=== +|Key |Hexadecimal value |Decimal value + +|KEY_NUM_LOCK |0xDB |219 +|KEY_KP_SLASH |0xDC |220 +|KEY_KP_ASTERISK |0xDD |221 +|KEY_KP_MINUS |0xDE |222 +|KEY_KP_PLUS |0xDF |223 +|KEY_KP_ENTER |0xE0 |224 +|KEY_KP_1 |0xE1 |225 +|KEY_KP_2 |0xE2 |226 +|KEY_KP_3 |0xE3 |227 +|KEY_KP_4 |0xE4 |228 +|KEY_KP_5 |0xE5 |229 +|KEY_KP_6 |0xE6 |230 +|KEY_KP_7 |0xE7 |231 +|KEY_KP_8 |0xE8 |232 +|KEY_KP_9 |0xE9 |233 +|KEY_KP_0 |0xEA |234 +|KEY_KP_DOT |0xEB |235 +|=== + [float] ==== Escape and function keys The library can simulate function keys up to F24. @@ -116,5 +142,37 @@ The library can simulate function keys up to F24. |KEY_F24 |0xFB |251 |=== +[float] +==== Function control keys +These are three rarely used keys that sit above the navigation cluster. + +|=== +|Key |Hexadecimal value |Decimal value |Notes + +|KEY_PRINT_SCREEN |0xCE |206 |Print Screen or PrtSc / SysRq +|KEY_SCROLL_LOCK |0xCF |207 | +|KEY_PAUSE |0xD0 |208 |Pause / Break +|=== + +[float] +==== International keyboard layouts + +Some national layouts define extra keys. For example, the Swedish and Danish layouts define `KEY_A_RING` as `0xB7`, which is the key to the right of “P”, labeled “Å” on those layouts and “{”/“[” on the US layout. In order to use those definitions, one has to include the proper Keyboard_*.h file. For example: + +[source,arduino] +---- +#include +#include // extra key definitions from Swedish layout + +void setup() { + Keyboard.begin(KeyboardLayout_sv_SE); // use the Swedish layout + Keyboard.write(KEY_A_RING); +} + +void loop() {} // do-nothing loop +---- + +For the list of layout-specific key definitions, see the respective Keyboard_*.h file within the library sources. + -- // OVERVIEW SECTION ENDS From d50b693f4c41da0a243eb0766ec8fab63a38b3d3 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Sun, 8 May 2022 09:53:31 +0200 Subject: [PATCH 199/298] keyboardModifiers: Implement review suggestion Reduce unnecessary verbosity. Co-authored-by: per1234 --- Language/Functions/USB/Keyboard/keyboardModifiers.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc index 068bd5e05..3ecd403df 100644 --- a/Language/Functions/USB/Keyboard/keyboardModifiers.adoc +++ b/Language/Functions/USB/Keyboard/keyboardModifiers.adoc @@ -144,7 +144,7 @@ The library can simulate function keys up to F24. [float] ==== Function control keys -These are three rarely used keys that sit above the navigation cluster. +These are three keys that sit above the navigation cluster. |=== |Key |Hexadecimal value |Decimal value |Notes From 272d3ddda2b1d8828b9bd8a0904f9fef67df86d6 Mon Sep 17 00:00:00 2001 From: Arnold <48472227+Arnold-n@users.noreply.github.com> Date: Sun, 8 May 2022 14:17:24 +0200 Subject: [PATCH 200/298] Update Language/Functions/Time/millis.adoc Co-authored-by: per1234 --- Language/Functions/Time/millis.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Time/millis.adoc b/Language/Functions/Time/millis.adoc index 10514ad67..4dc89865c 100644 --- a/Language/Functions/Time/millis.adoc +++ b/Language/Functions/Time/millis.adoc @@ -66,7 +66,7 @@ void loop() { === Notes and Warnings Please note that the return value for millis() is of type `unsigned long`, logic errors may occur if a programmer tries to do arithmetic with smaller data types such as `int`. Even signed `long` may encounter errors as its maximum value is half that of its unsigned counterpart. -On some architectures reconfiguration of timers may result in inaccurate millis() readings. AVR-based architectures program a timer to implement millis(): ArduinoCore-AVR programs TIM0 to generate an interrupt every 16384 clock cycles (clock divider set to 64, overflow every 256 ticks). The same holds for ArduinoCore-mega-AVR, except that it uses TIMx if MILLIS_USER_TIMx (0<=x<=3) is defined. The ArduinoCore-SAM(D) architectures program the Systick timer to generate an interrupt every 1 ms. +Reconfiguration of the microcontroller's timers may result in inaccurate `millis()` readings. The "Arduino AVR Boards" and "Arduino megaAVR Boards" cores use Timer0 to generate `millis()`. The "Arduino ARM (32-bits) Boards" and "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" cores use the SysTick timer. -- // HOW TO USE SECTION ENDS From a7fe5efa3b4454b40ccbfd690fe26b04f8f4bf5d Mon Sep 17 00:00:00 2001 From: redfast00 <10746993+redfast00@users.noreply.github.com> Date: Sun, 8 May 2022 15:06:45 +0200 Subject: [PATCH 201/298] Add note that seed should be non-zero (#867) * Add note that seed should be non-zero After losing about a half hour debugging why my code wasn't deterministic when it should be, I found out that `randomSeed` doesn't do anything when the `seed` is zero (https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/WMath.cpp#L30) * Move warning to new notes and warnings section --- Language/Functions/Random Numbers/randomSeed.adoc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Random Numbers/randomSeed.adoc b/Language/Functions/Random Numbers/randomSeed.adoc index 6e9292223..13ee2ad5e 100644 --- a/Language/Functions/Random Numbers/randomSeed.adoc +++ b/Language/Functions/Random Numbers/randomSeed.adoc @@ -32,7 +32,7 @@ Conversely, it can occasionally be useful to use pseudo-random sequences that re [float] === Parameters -`seed`: number to initialize the pseudo-random sequence. Allowed data types: `unsigned long`. +`seed`: non-zero number to initialize the pseudo-random sequence. Allowed data types: `unsigned long`. [float] @@ -69,6 +69,11 @@ void loop() { delay(50); } ---- +[%hardbreaks] + +[float] +=== Notes and Warnings +If the `seed` is 0, `randomSeed(seed)` will have no effect. -- // HOW TO USE SECTION ENDS From 020b3a22b1a31cbba12dfc030b9361685934d877 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 9 May 2022 14:28:55 -0400 Subject: [PATCH 202/298] Update flush.adoc (#777) * Update flush.adoc * Update Language/Functions/Communication/Serial/flush.adoc Co-authored-by: per1234 Co-authored-by: per1234 --- Language/Functions/Communication/Serial/flush.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/flush.adoc b/Language/Functions/Communication/Serial/flush.adoc index c3c6f43b8..b4cdcac72 100644 --- a/Language/Functions/Communication/Serial/flush.adoc +++ b/Language/Functions/Communication/Serial/flush.adoc @@ -16,7 +16,7 @@ title: Serial.flush() === Description Waits for the transmission of outgoing serial data to complete. (Prior to Arduino 1.0, this instead removed any buffered incoming serial data.) -`flush()` inherits from the link:../flush[Stream] utility class. +`flush()` inherits from the link:../../stream/streamflush[Stream] utility class. [%hardbreaks] From 9866b8a3a62909f4ce6784e8f388af8b2b8c84ec Mon Sep 17 00:00:00 2001 From: rohoog <33842942+rohoog@users.noreply.github.com> Date: Wed, 18 May 2022 22:15:13 +0200 Subject: [PATCH 203/298] Move the remark to the standard Notes and Warnings section --- Language/Functions/Communication/Serial/ifSerial.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Language/Functions/Communication/Serial/ifSerial.adoc b/Language/Functions/Communication/Serial/ifSerial.adoc index c2988a863..42b3b48d7 100644 --- a/Language/Functions/Communication/Serial/ifSerial.adoc +++ b/Language/Functions/Communication/Serial/ifSerial.adoc @@ -37,10 +37,6 @@ None Returns true if the specified serial port is available. This will only return false if querying the Leonardo's USB CDC serial connection before it is ready. Data type: `bool`. -[float] -=== Warning -This function adds a delay of 10ms in an attempt to solve "open but not quite" situations. Don't use it in tight loops. - -- // OVERVIEW SECTION ENDS @@ -71,5 +67,9 @@ void loop() { } ---- +[float] +=== Notes and Warnings +This function adds a delay of 10ms in an attempt to solve "open but not quite" situations. Don't use it in tight loops. + -- // HOW TO USE SECTION ENDS From ac442c99b8c08b11f050beccf103acdbe58ed949 Mon Sep 17 00:00:00 2001 From: Marco Tedaldi Date: Sun, 5 Jun 2022 08:23:13 +0200 Subject: [PATCH 204/298] Update Language/Functions/Communication/Serial/serialEvent.adoc Co-authored-by: per1234 --- Language/Functions/Communication/Serial/serialEvent.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index 5201017eb..b3260884a 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -14,7 +14,7 @@ title: serialEvent() [float] === Description -Called at the end of loop() when data is available. Use `Serial.read()` to capture this data. +Called at the end of link:../../../../structure/sketch/loop[`loop()`] when data is available. Use `Serial.read()` to capture this data. [%hardbreaks] From 0f4e995887ba0f5f7277e5e2a034bde056f1572b Mon Sep 17 00:00:00 2001 From: HowardWParr <107371728+HowardWParr@users.noreply.github.com> Date: Sun, 12 Jun 2022 17:19:35 -0500 Subject: [PATCH 205/298] Update bitSet.adoc Corrected Return results and added Example Code to more closely resemble the information provided in the reciprocal bitClear() function. --- Language/Functions/Bits and Bytes/bitSet.adoc | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bitSet.adoc b/Language/Functions/Bits and Bytes/bitSet.adoc index d5c49a018..4723baf4e 100644 --- a/Language/Functions/Bits and Bytes/bitSet.adoc +++ b/Language/Functions/Bits and Bytes/bitSet.adoc @@ -34,7 +34,26 @@ Sets (writes a 1 to) a bit of a numeric variable. [float] === Returns -Nothing +x: the value of the numeric variable after the bit at position n is cleared. + + +[float] +=== Example Code +Prints the output of bitSet(x,n) on two given integers. The binary representation of 4 is 0100, so when n=1, the second bit from the right is set to 1. After this we are left with 0110 in binary, so 6 is returned. + +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + int x = 4; + int n = 1; + Serial.print(bitSet(x, n)); // print the output of bitSet(x,n) +} + +void loop() { +} -- // OVERVIEW SECTION ENDS @@ -46,6 +65,7 @@ Nothing [float] === See also +bitClear() -- // SEE ALSO SECTION ENDS From 074f4d2f081c9d6f7251b08b990b09709c3c580b Mon Sep 17 00:00:00 2001 From: HowardWParr <107371728+HowardWParr@users.noreply.github.com> Date: Sun, 12 Jun 2022 23:17:34 -0500 Subject: [PATCH 206/298] Update bitSet.adoc Corrected a typo. --- Language/Functions/Bits and Bytes/bitSet.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bitSet.adoc b/Language/Functions/Bits and Bytes/bitSet.adoc index 4723baf4e..828daebf6 100644 --- a/Language/Functions/Bits and Bytes/bitSet.adoc +++ b/Language/Functions/Bits and Bytes/bitSet.adoc @@ -34,7 +34,7 @@ Sets (writes a 1 to) a bit of a numeric variable. [float] === Returns -x: the value of the numeric variable after the bit at position n is cleared. +x: the value of the numeric variable after the bit at position n is set. [float] From eeca98e95936f76ede658dc4c834c4e5b71563ab Mon Sep 17 00:00:00 2001 From: boundmaidlea <106570003+boundmaidlea@users.noreply.github.com> Date: Sun, 19 Jun 2022 05:12:31 +0200 Subject: [PATCH 207/298] Add link to "Else" page Add a link to [structure/control-structure/else](https://www.arduino.cc/reference/en/language/structure/control-structure/else/) to the *See also* section. --- Language/Structure/Control Structure/if.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/Language/Structure/Control Structure/if.adoc b/Language/Structure/Control Structure/if.adoc index f5c300396..45ad2da20 100644 --- a/Language/Structure/Control Structure/if.adoc +++ b/Language/Structure/Control Structure/if.adoc @@ -101,6 +101,7 @@ This is because C++ evaluates the statement `if (x=10)` as follows: 10 is assign === See also [role="language"] +* #LANGUAGE# link:../else[else] -- // SEE ALSO SECTION ENDS From 8838a08286f9715ddb256bda1417284d25a69c78 Mon Sep 17 00:00:00 2001 From: krytie75 <7768438+krytie75@users.noreply.github.com> Date: Mon, 20 Jun 2022 22:20:30 +0100 Subject: [PATCH 208/298] Add missing function (endTransmission()) endTransmission function page exists but link is missing from the function list on the Wire.h page. --- Language/Functions/Communication/Wire.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Wire.adoc b/Language/Functions/Communication/Wire.adoc index 943ba09f3..8607a3e40 100644 --- a/Language/Functions/Communication/Wire.adoc +++ b/Language/Functions/Communication/Wire.adoc @@ -62,6 +62,7 @@ link:../wire/begin[begin()] + link:../wire/end[end()] + link:../wire/requestfrom[requestFrom()] + link:../wire/begintransmission[beginTransmission()] + +link:../wire/endtransmission[endTransmission()] + link:../wire/write[write()] + link:../wire/available[available()] + link:../wire/read[read()] + @@ -75,4 +76,4 @@ link:../wire/getwiretimeoutflag[getWireTimeoutFlag()] ''' -- -// FUNCTION SECTION ENDS \ No newline at end of file +// FUNCTION SECTION ENDS From fee4321483f29719ba3cfd06c47782b2d34dddae Mon Sep 17 00:00:00 2001 From: John-Karatka Date: Mon, 27 Jun 2022 10:07:24 -0400 Subject: [PATCH 209/298] Update SPI.adoc (#889) Added endTransaction() link to function section. --- Language/Functions/Communication/SPI.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index 7d8f82036..005f765dc 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -39,6 +39,7 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le link:../spi/spisettings[SPISettings] + link:../spi/begin[begin()] + link:../spi/begintransaction[beginTransaction()] + +link:../spi/endtransaction[endTransaction()] + link:../spi/end[end()] + link:../spi/setbitorder[setBitOrder()] + link:../spi/setclockdivider[setClockDivider()] + From cc5ff30bcfb29560b1515bdd24818ddf35f2a024 Mon Sep 17 00:00:00 2001 From: Dreamy-Z3r0 <34434717+Dreamy-Z3r0@users.noreply.github.com> Date: Tue, 28 Jun 2022 13:07:41 +0700 Subject: [PATCH 210/298] Modification of Returns section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "The n’th character of the String" means the returned char is at index n+1 of the String, which is an incorrect description of the output. --- Language/Variables/Data Types/String/Functions/charAt.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/String/Functions/charAt.adoc b/Language/Variables/Data Types/String/Functions/charAt.adoc index a546ddd01..cb571e95a 100644 --- a/Language/Variables/Data Types/String/Functions/charAt.adoc +++ b/Language/Variables/Data Types/String/Functions/charAt.adoc @@ -35,7 +35,7 @@ Access a particular character of the String. [float] === Returns -The n'th character of the String. +The character at index n of the String. -- // OVERVIEW SECTION ENDS From fdaffa8ab53e68cdee4f3db33e63f7bf0d0e3f57 Mon Sep 17 00:00:00 2001 From: abdullah <96771929+abdullah-1307@users.noreply.github.com> Date: Mon, 4 Jul 2022 23:57:29 +0500 Subject: [PATCH 211/298] Fix monospace markup in parameters list of String != reference (#869) A missing closing backtick caused the content to be incorrectly rendered. --- .../Variables/Data Types/String/Operators/differentFrom.adoc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Language/Variables/Data Types/String/Operators/differentFrom.adoc b/Language/Variables/Data Types/String/Operators/differentFrom.adoc index c26fe47d4..7cb1ce0d7 100644 --- a/Language/Variables/Data Types/String/Operators/differentFrom.adoc +++ b/Language/Variables/Data Types/String/Operators/differentFrom.adoc @@ -7,8 +7,6 @@ subCategories: [ "StringObject Operator" ] - - = != Different From @@ -30,7 +28,7 @@ Compares two Strings for difference. The comparison is case-sensitive, meaning t [float] === Parameters -`myString1: a String variable. + +`myString1`: a String variable. + `myString2`: a String variable. From ab59ddf6312d362aa9cf2260008f0ce5ee3c8f37 Mon Sep 17 00:00:00 2001 From: ka84 <63402634+ka84@users.noreply.github.com> Date: Wed, 6 Jul 2022 23:09:17 +0300 Subject: [PATCH 212/298] Update PROGMEM.adoc fixed broken URLs --- Language/Variables/Utilities/PROGMEM.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index b483ad5fe..804ec267e 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -17,7 +17,7 @@ subCategories: [ "Utilities" ] [float] === Description -Store data in flash (program) memory instead of SRAM. There's a description of the various http://www.arduino.cc/playground/Learning/Memory[types of memory] available on an Arduino board. +Store data in flash (program) memory instead of SRAM. There's a description of the various https://www.arduino.cc/en/Tutorial/Foundations/Memory[types of memory] available on an Arduino board. The `PROGMEM` keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "put this information into flash memory", instead of into SRAM, where it would normally go. @@ -205,7 +205,7 @@ Serial.print(F("Write something on the Serial Monitor that is stored in FLASH")) === See also [role="example"] -* #EXAMPLE# https://www.arduino.cc/playground/Learning/Memory[Types of memory available on an Arduino board^] +* #EXAMPLE# https://www.arduino.cc/en/Tutorial/Foundations/Memory[Types of memory available on an Arduino board^] [role="definition"] * #DEFINITION# link:../../data-types/array[array] From 01907336ea2c82f883692b8ad13ab1c8230365eb Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Fri, 22 Jul 2022 13:34:19 +0200 Subject: [PATCH 213/298] Highlight int nature of variable --- Language/Functions/Math/map.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Math/map.adoc b/Language/Functions/Math/map.adoc index bc69e9ba8..20cfb9bbb 100644 --- a/Language/Functions/Math/map.adoc +++ b/Language/Functions/Math/map.adoc @@ -51,7 +51,7 @@ The `map()` function uses integer math so will not generate fractions, when the [float] === Returns -The mapped value. +The mapped value as a int data type. -- // OVERVIEW SECTION ENDS From 8f587b772bd11b42d2fe5960ba0e888663f094a8 Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Fri, 22 Jul 2022 13:35:07 +0200 Subject: [PATCH 214/298] Update map.adoc --- Language/Functions/Math/map.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Math/map.adoc b/Language/Functions/Math/map.adoc index 20cfb9bbb..3731605e2 100644 --- a/Language/Functions/Math/map.adoc +++ b/Language/Functions/Math/map.adoc @@ -51,7 +51,7 @@ The `map()` function uses integer math so will not generate fractions, when the [float] === Returns -The mapped value as a int data type. +The mapped value as an int data type. -- // OVERVIEW SECTION ENDS From 0d473750a9d2d37d75e92fa06d57dfe895d92179 Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Fri, 22 Jul 2022 14:14:16 +0200 Subject: [PATCH 215/298] Revise data type declaration format --- Language/Functions/Math/map.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Math/map.adoc b/Language/Functions/Math/map.adoc index 3731605e2..7badc9be8 100644 --- a/Language/Functions/Math/map.adoc +++ b/Language/Functions/Math/map.adoc @@ -51,7 +51,7 @@ The `map()` function uses integer math so will not generate fractions, when the [float] === Returns -The mapped value as an int data type. +The mapped value. Data type: `int`. -- // OVERVIEW SECTION ENDS From 52e7c3ba6d6dc02e7f48fd6ca579aab6a410663e Mon Sep 17 00:00:00 2001 From: Suisse00 Date: Sun, 24 Jul 2022 13:26:54 -0400 Subject: [PATCH 216/298] Adding null return for ReadStringUntil or equivalent for readBytesUntil --- Language/Functions/Communication/Serial/readStringUntil.adoc | 4 +++- .../Functions/Communication/Stream/streamReadBytesUntil.adoc | 4 ++-- .../Functions/Communication/Stream/streamReadStringUntil.adoc | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Language/Functions/Communication/Serial/readStringUntil.adoc b/Language/Functions/Communication/Serial/readStringUntil.adoc index 53990e334..6ec473350 100644 --- a/Language/Functions/Communication/Serial/readStringUntil.adoc +++ b/Language/Functions/Communication/Serial/readStringUntil.adoc @@ -33,7 +33,8 @@ title: Serial.readStringUntil() [float] === Returns -The entire `String` read from the serial buffer, up to the terminator character +The entire `String` read from the serial buffer, up to the terminator character. +If the terminator character can't be found, or if there is no data before the terminator character, it will return `null`. -- // OVERVIEW SECTION ENDS @@ -46,6 +47,7 @@ The entire `String` read from the serial buffer, up to the terminator character [float] === Notes and Warnings The terminator character is discarded from the serial buffer. +If the terminator character can't be found, all read characters will be discarded. [%hardbreaks] -- diff --git a/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc b/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc index 1baf1ff02..e417058be 100644 --- a/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadBytesUntil.adoc @@ -16,7 +16,7 @@ title: Stream.readBytesUntil() === Description `readBytesUntil()` reads characters from a stream into a buffer. The function terminates if the terminator character is detected, the determined length has been read, or it times out (see link:../streamsettimeout[setTimeout()]). The function returns the characters up to the last character before the supplied terminator. The terminator itself is not returned in the buffer. -`readBytesUntil()` returns the number of bytes placed in the buffer. A 0 means no valid data was found. +`readBytesUntil()` returns the number of bytes placed in the buffer. A 0 means the terminator character can't be found or there is no data before it. This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more information. [%hardbreaks] @@ -37,7 +37,7 @@ This function is part of the Stream class, and can be called by any class that i [float] === Returns -The number of bytes placed in the buffer. +The number of bytes (excluding the terminator character) placed in the buffer if the terminator character has been found. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc index 79b818a9d..53e4378ea 100644 --- a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc @@ -33,7 +33,8 @@ This function is part of the Stream class, and can be called by any class that i [float] === Returns -The entire String read from a stream, up to the terminator character +The entire String read from a stream, up to the terminator character. +If the terminator character can't be found, or if there is no data before the terminator character, it will return `null`. -- // OVERVIEW SECTION ENDS @@ -46,6 +47,7 @@ The entire String read from a stream, up to the terminator character [float] === Notes and Warnings The terminator character is discarded from the stream. +If the terminator character can't be found, all read characters will be discarded. [%hardbreaks] -- From 59598935e72040a4379a44e97ba98ed25964a31a Mon Sep 17 00:00:00 2001 From: Suisse00 Date: Sun, 24 Jul 2022 14:49:05 -0400 Subject: [PATCH 217/298] null -> NULL --- Language/Functions/Communication/Serial/readStringUntil.adoc | 2 +- .../Functions/Communication/Stream/streamReadStringUntil.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Serial/readStringUntil.adoc b/Language/Functions/Communication/Serial/readStringUntil.adoc index 6ec473350..5a699bfc2 100644 --- a/Language/Functions/Communication/Serial/readStringUntil.adoc +++ b/Language/Functions/Communication/Serial/readStringUntil.adoc @@ -34,7 +34,7 @@ title: Serial.readStringUntil() [float] === Returns The entire `String` read from the serial buffer, up to the terminator character. -If the terminator character can't be found, or if there is no data before the terminator character, it will return `null`. +If the terminator character can't be found, or if there is no data before the terminator character, it will return `NULL`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc index 53e4378ea..fea1400ab 100644 --- a/Language/Functions/Communication/Stream/streamReadStringUntil.adoc +++ b/Language/Functions/Communication/Stream/streamReadStringUntil.adoc @@ -34,7 +34,7 @@ This function is part of the Stream class, and can be called by any class that i [float] === Returns The entire String read from a stream, up to the terminator character. -If the terminator character can't be found, or if there is no data before the terminator character, it will return `null`. +If the terminator character can't be found, or if there is no data before the terminator character, it will return `NULL`. -- // OVERVIEW SECTION ENDS From a74547357f2a88e75bd079da0c4b8fda374e575f Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Mon, 8 Aug 2022 18:12:38 +0200 Subject: [PATCH 218/298] Update Language/Functions/Math/map.adoc Co-authored-by: per1234 --- Language/Functions/Math/map.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Math/map.adoc b/Language/Functions/Math/map.adoc index 7badc9be8..1c1697ae2 100644 --- a/Language/Functions/Math/map.adoc +++ b/Language/Functions/Math/map.adoc @@ -51,7 +51,7 @@ The `map()` function uses integer math so will not generate fractions, when the [float] === Returns -The mapped value. Data type: `int`. +The mapped value. Data type: `long`. -- // OVERVIEW SECTION ENDS From 1b90bd3675a6c82e87e23606939e42f4446e1590 Mon Sep 17 00:00:00 2001 From: Thomarini <62741938+Thomarini@users.noreply.github.com> Date: Tue, 9 Aug 2022 21:51:39 +0200 Subject: [PATCH 219/298] small typo error --- Language/Functions/Communication/Wire/onReceive.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Wire/onReceive.adoc b/Language/Functions/Communication/Wire/onReceive.adoc index 7b102215d..2ca8d60dd 100644 --- a/Language/Functions/Communication/Wire/onReceive.adoc +++ b/Language/Functions/Communication/Wire/onReceive.adoc @@ -1,5 +1,5 @@ --- -title: onReceieve() +title: onReceive() --- = onReceive From f0431beef401d606ceb5856089b95d557ba86cfb Mon Sep 17 00:00:00 2001 From: Mohammed Hemed <7507590+mohammedhemed77@users.noreply.github.com> Date: Sat, 13 Aug 2022 14:13:22 +0200 Subject: [PATCH 220/298] [Documentation] Missing data type (#817) * [Documentation] Missing data type In the documentation of Floating Point is this example: ``` n = 0.005; // 0.005 is a floating point constant ``` This code simply won't compile and get this error : 'n' does not name a type so this Line should be : ``` const float n = 0.005; // 0.005 is a floating point constant ``` Although this error may seem trivial for some professional , but I think it seems misleading to newcomers. * Update Language/Variables/Constants/floatingPointConstants.adoc Co-authored-by: per1234 Co-authored-by: per1234 --- Language/Variables/Constants/floatingPointConstants.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Constants/floatingPointConstants.adoc b/Language/Variables/Constants/floatingPointConstants.adoc index 43e248203..2d3defe04 100644 --- a/Language/Variables/Constants/floatingPointConstants.adoc +++ b/Language/Variables/Constants/floatingPointConstants.adoc @@ -34,7 +34,7 @@ Similar to integer constants, floating point constants are used to make code mor [source,arduino] ---- -n = 0.005; // 0.005 is a floating point constant +float n = 0.005; // 0.005 is a floating point constant ---- [%hardbreaks] From f7296fb888474b028bebab2f82bd16e80f152331 Mon Sep 17 00:00:00 2001 From: grayconstruct <77263741+grayconstruct@users.noreply.github.com> Date: Tue, 16 Aug 2022 15:33:15 -0500 Subject: [PATCH 221/298] Add readString example and notes/warnings re: line endingssections (#808) A very common mistake is not expecting readString value to have invisible \r \n characters. --- .../Communication/Serial/readString.adoc | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Language/Functions/Communication/Serial/readString.adoc b/Language/Functions/Communication/Serial/readString.adoc index 3e6822e2a..c0fa8856c 100644 --- a/Language/Functions/Communication/Serial/readString.adoc +++ b/Language/Functions/Communication/Serial/readString.adoc @@ -34,10 +34,49 @@ title: Serial.readString() === Returns A `String` read from the serial buffer + -- // OVERVIEW SECTION ENDS +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +Demonstrate Serial.readString() + +[source,arduino] +---- +void setup() { + Serial.begin(9600); +} + +void loop() { + Serial.println("Enter data:"); + while (Serial.available() == 0) {} //wait for data available + String teststr = Serial.readString(); //read until timeout + teststr.trim(); // remove any \r \n whitespace at the end of the String + if (teststr == "red") { + Serial.println("A primary color"); + } else { + Serial.println("Something else"); + } +} +---- +[%hardbreaks] + + +[float] +=== Notes and Warnings +The function does not terminate early if the data contains end of line characters. The returned `String` may contain carriage return and/or line feed characters if they were received. +[%hardbreaks] + +-- +// HOW TO USE SECTION ENDS + + // SEE ALSO SECTION [#see_also] -- From f6a8d7dd5eb8e60bb3d5ed3ae59fde61abdcda8c Mon Sep 17 00:00:00 2001 From: Boyd Kane <33420535+beyarkay@users.noreply.github.com> Date: Sat, 3 Sep 2022 21:06:11 +0200 Subject: [PATCH 222/298] Describe `noInterrupts` disabling USB handshakes (#891) --- Language/Functions/Interrupts/noInterrupts.adoc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Interrupts/noInterrupts.adoc b/Language/Functions/Interrupts/noInterrupts.adoc index c7e413dba..b925094d7 100644 --- a/Language/Functions/Interrupts/noInterrupts.adoc +++ b/Language/Functions/Interrupts/noInterrupts.adoc @@ -17,7 +17,7 @@ subCategories: [ "Interrupts" ] [float] === Description -Disables interrupts (you can re-enable them with `interrupts()`). Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code. +Disables interrupts (you can re-enable them with link:../interrupts[`interrupts()`]). Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code. [%hardbreaks] @@ -61,6 +61,13 @@ void loop() { // other code here } ---- +[%hardbreaks] + + +[float] +=== Notes and Warnings +Note that disabling interrupts on the Arduino boards with native USB capabilities (e.g., link:https://docs.arduino.cc/hardware/leonardo[Leonardo^]) will make the board +not appear in the Port menu, since this disables its USB capability. -- // HOW TO USE SECTION ENDS From e06c4042a5c52ce59f15dcf072a00e53085c5350 Mon Sep 17 00:00:00 2001 From: Ali Jahangiri <75624145+aliphys@users.noreply.github.com> Date: Tue, 6 Sep 2022 21:31:04 +0200 Subject: [PATCH 223/298] Add relevent links to other math functions (#845) --- Language/Functions/Math/abs.adoc | 9 +++++++++ Language/Functions/Math/constrain.adoc | 9 +++++++++ Language/Functions/Math/map.adoc | 9 +++++++++ Language/Functions/Math/max.adoc | 10 ++++++++++ Language/Functions/Math/min.adoc | 9 +++++++++ Language/Functions/Math/pow.adoc | 12 +++++++++--- Language/Functions/Math/sq.adoc | 9 +++++++++ Language/Functions/Math/sqrt.adoc | 9 +++++++++ 8 files changed, 73 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Math/abs.adoc b/Language/Functions/Math/abs.adoc index d494e4c1f..5e575abb2 100644 --- a/Language/Functions/Math/abs.adoc +++ b/Language/Functions/Math/abs.adoc @@ -99,5 +99,14 @@ a++; // keep other math outside the function [float] === See also +[role="language"] +* #LANGUAGE# link:../constrain[constrain()] +* #LANGUAGE# link:../map[map()] +* #LANGUAGE# link:../max[max()] +* #LANGUAGE# link:../min[min()] +* #LANGUAGE# link:../pow[pow()] +* #LANGUAGE# link:../sq[sq()] +* #LANGUAGE# link:../sqrt[sqrt()] + -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Math/constrain.adoc b/Language/Functions/Math/constrain.adoc index 5ba9436ee..7abb8f2f4 100644 --- a/Language/Functions/Math/constrain.adoc +++ b/Language/Functions/Math/constrain.adoc @@ -88,5 +88,14 @@ int constrainedInput = constrain(input, minimumValue, maximumValue); [float] === See also +[role="language"] +* #LANGUAGE# link:../abs[abs()] +* #LANGUAGE# link:../map[map()] +* #LANGUAGE# link:../max[max()] +* #LANGUAGE# link:../min[min()] +* #LANGUAGE# link:../pow[pow()] +* #LANGUAGE# link:../sq[sq()] +* #LANGUAGE# link:../sqrt[sqrt()] + -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Math/map.adoc b/Language/Functions/Math/map.adoc index 1c1697ae2..ee97cf762 100644 --- a/Language/Functions/Math/map.adoc +++ b/Language/Functions/Math/map.adoc @@ -109,5 +109,14 @@ As previously mentioned, the map() function uses integer math. So fractions migh [float] === See also +[role="language"] +* #LANGUAGE# link:../abs[abs()] +* #LANGUAGE# link:../constrain[constrain()] +* #LANGUAGE# link:../max[max()] +* #LANGUAGE# link:../min[min()] +* #LANGUAGE# link:../pow[pow()] +* #LANGUAGE# link:../sq[sq()] +* #LANGUAGE# link:../sqrt[sqrt()] + -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Math/max.adoc b/Language/Functions/Math/max.adoc index b3ec6d8d1..1ea570a59 100644 --- a/Language/Functions/Math/max.adoc +++ b/Language/Functions/Math/max.adoc @@ -83,5 +83,15 @@ a--; // keep other math outside the function [float] === See also +[role="language"] +* #LANGUAGE# link:../abs[abs()] +* #LANGUAGE# link:../constrain[constrain()] +* #LANGUAGE# link:../map[map()] +* #LANGUAGE# link:../min[min()] +* #LANGUAGE# link:../pow[pow()] +* #LANGUAGE# link:../sq[sq()] +* #LANGUAGE# link:../sqrt[sqrt()] + + -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Math/min.adoc b/Language/Functions/Math/min.adoc index 77054141b..fc8c663c8 100644 --- a/Language/Functions/Math/min.adoc +++ b/Language/Functions/Math/min.adoc @@ -82,5 +82,14 @@ a++; // use this instead - keep other math outside the function [float] === See also +[role="language"] +* #LANGUAGE# link:../abs[abs()] +* #LANGUAGE# link:../constrain[constrain()] +* #LANGUAGE# link:../map[map()] +* #LANGUAGE# link:../max[max()] +* #LANGUAGE# link:../pow[pow()] +* #LANGUAGE# link:../sq[sq()] +* #LANGUAGE# link:../sqrt[sqrt()] + -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Math/pow.adoc b/Language/Functions/Math/pow.adoc index 4beded9a1..feda5a6d9 100644 --- a/Language/Functions/Math/pow.adoc +++ b/Language/Functions/Math/pow.adoc @@ -66,9 +66,15 @@ See the (http://arduino.cc/playground/Main/Fscale[fscale]) sketch for a more com [float] === See also -[role="definition"] -* #DEFINITION# link:../../../variables/data-types/float[float] -* #DEFENITION# link:../../../variables/data-types/double[double] +[role="language"] +* #LANGUAGE# link:../abs[abs()] +* #LANGUAGE# link:../constrain[constrain()] +* #LANGUAGE# link:../map[map()] +* #LANGUAGE# link:../max[max()] +* #LANGUAGE# link:../min[min()] +* #LANGUAGE# link:../sq[sq()] +* #LANGUAGE# link:../sqrt[sqrt()] + -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Math/sq.adoc b/Language/Functions/Math/sq.adoc index 484d523e3..ac403498d 100644 --- a/Language/Functions/Math/sq.adoc +++ b/Language/Functions/Math/sq.adoc @@ -72,5 +72,14 @@ int inputSquared = sq(input); [float] === See also +[role="language"] +* #LANGUAGE# link:../abs[abs()] +* #LANGUAGE# link:../constrain[constrain()] +* #LANGUAGE# link:../map[map()] +* #LANGUAGE# link:../max[max()] +* #LANGUAGE# link:../min[min()] +* #LANGUAGE# link:../pow[pow()] +* #LANGUAGE# link:../sqrt[sqrt()] + -- // SEE ALSO SECTION ENDS diff --git a/Language/Functions/Math/sqrt.adoc b/Language/Functions/Math/sqrt.adoc index 25a918575..00f601091 100644 --- a/Language/Functions/Math/sqrt.adoc +++ b/Language/Functions/Math/sqrt.adoc @@ -46,5 +46,14 @@ The number's square root. Data type: `double`. [float] === See also +[role="language"] +* #LANGUAGE# link:../abs[abs()] +* #LANGUAGE# link:../constrain[constrain()] +* #LANGUAGE# link:../map[map()] +* #LANGUAGE# link:../max[max()] +* #LANGUAGE# link:../min[min()] +* #LANGUAGE# link:../pow[pow()] +* #LANGUAGE# link:../sq[sq()] + -- // SEE ALSO SECTION ENDS From 3d81819a42f5efbaf6be7c28c13211e4120b4d24 Mon Sep 17 00:00:00 2001 From: pcamp Date: Fri, 11 Nov 2022 08:27:46 -0600 Subject: [PATCH 224/298] Fixed links to example code. --- Language/Variables/Data Types/array.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/array.adoc b/Language/Variables/Data Types/array.adoc index 9e16293a0..ccbbf2fd4 100644 --- a/Language/Variables/Data Types/array.adoc +++ b/Language/Variables/Data Types/array.adoc @@ -83,7 +83,7 @@ for (byte i = 0; i < 5; i = i + 1) { [float] === Example Code -For a complete program that demonstrates the use of arrays, see the (http://www.arduino.cc/en/Tutorial/KnightRider[Knight Rider example]) from the (http://www.arduino.cc/en/Main/LearnArduino[Tutorials]). +For a complete program that demonstrates the use of arrays, see the (https://docs.arduino.cc/built-in-examples/control-structures/Arrays[How to Use Arrays example]) from the (https://docs.arduino.cc/built-in-examples[Built-in Examples]). -- // HOW TO USE SECTION ENDS From 33bed7f62597e335c87d65d6776e13d8a75f7e84 Mon Sep 17 00:00:00 2001 From: Carlos Pereira Atencio <4189262+carlosperate@users.noreply.github.com> Date: Sun, 25 Dec 2022 19:07:18 +0000 Subject: [PATCH 225/298] Remove return value from Wire.clearWireTimeoutFlag() documentation. As it's not meant to return anything. --- Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc b/Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc index b5a44711f..66bb41466 100644 --- a/Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc +++ b/Language/Functions/Communication/Wire/clearWireTimeoutFlag.adoc @@ -26,7 +26,7 @@ None. [float] === Returns -* bool: The current value of the flag +None. [float] === Portability Notes From 999aeeede02cc5a4a77a1f82c6defa516d448cba Mon Sep 17 00:00:00 2001 From: BloodyNewbie <43654884+BloodyNewbie@users.noreply.github.com> Date: Wed, 18 Jan 2023 21:20:52 +0100 Subject: [PATCH 226/298] Update bit.adoc with allowed range of n bit(n) with n > 31 do not return reasonable values. This should be mentioned --- Language/Functions/Bits and Bytes/bit.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bit.adoc b/Language/Functions/Bits and Bytes/bit.adoc index 7b4636411..6127e2802 100644 --- a/Language/Functions/Bits and Bytes/bit.adoc +++ b/Language/Functions/Bits and Bytes/bit.adoc @@ -28,7 +28,7 @@ Computes the value of the specified bit (bit 0 is 1, bit 1 is 2, bit 2 is 4, etc [float] === Parameters -`n`: the bit whose value to compute +`n`: the bit whose value to compute. 0 <= n < 32 (as it is intended to reflect the bits up to 31 of a uint32) [float] From 0cbe21fda685f7cd04ab6c2f3c8afba48a39e496 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Date: Mon, 10 Apr 2023 00:24:00 -0600 Subject: [PATCH 227/298] Print class documentation created --- Language/Functions/Communication/Print.adoc | 61 +++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Language/Functions/Communication/Print.adoc diff --git a/Language/Functions/Communication/Print.adoc b/Language/Functions/Communication/Print.adoc new file mode 100644 index 000000000..31b61ba5d --- /dev/null +++ b/Language/Functions/Communication/Print.adoc @@ -0,0 +1,61 @@ +--- +title: Print +categories: [ "Functions" ] +subCategories: [ "Communication" ] +--- + + + + += Print + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The Print class is an abstract base class that provides a common interface for printing data to different output devices. It defines several methods that allow printing data in different formats. + +Print class is related to several libraries in Arduino that use the printing funcionality to interact with devices such as Serial Monitor, LCD Screen, printers, etc. + +Some of the libraries that use the Print class are: + +* link:../serial[Serial] +* link:https://reference.arduino.cc/reference/en/libraries/liquidcrystal/[LiquidCrystal] +* link:https://www.arduino.cc/en/Reference/Ethernet[Ethernet] +* link:https://reference.arduino.cc/reference/en/libraries/wifi/wificlient/[Wifi] + + +-- +// OVERVIEW SECTION ENDS + + +// FUNCTIONS SECTION STARTS +[#functions] +-- + +''' + +[float] +=== Functions +link:https://www.arduino.cc/reference/en/language/functions/communication/wire/write/[write()] + +link:https://www.arduino.cc/reference/en/language/functions/communication/serial/print/[print()] + +link:https://www.arduino.cc/reference/en/language/functions/communication/serial/println/[println()] + +''' + +-- +// FUNCTIONS SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +-- +// SEE ALSO SECTION ENDS \ No newline at end of file From fb367451d62efe413e5ddf8d6c693298894d82c6 Mon Sep 17 00:00:00 2001 From: seaxwi <71350948+seaxwi@users.noreply.github.com> Date: Fri, 16 Jun 2023 16:36:55 +0200 Subject: [PATCH 228/298] Update PWM table with UNO R4 and GIGA R1 --- Language/Functions/Analog IO/analogWrite.adoc | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 95402cba0..35f8fffef 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -17,24 +17,28 @@ subCategories: [ "Analog I/O" ] [float] === Description -Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady rectangular wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. +Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady rectangular wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. + [options="header"] -|======================================================================================================== -| Board | PWM Pins | PWM Frequency -| Uno, Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) -| Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) -| Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) -| Uno WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz -| MKR boards * | 0 - 8, 10, A3, A4 | 732 Hz -| MKR1000 WiFi * | 0 - 8, 10, 11, A3, A4 | 732 Hz -| Zero * | 3 - 13, A0, A1 | 732 Hz -| Nano 33 IoT * | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz -| Nano 33 BLE/BLE Sense | 1 - 13, A0 - A7 | 500 Hz -| Due ** | 2-13 | 1000 Hz -| 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz -|======================================================================================================== -{empty}* In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + -{empty}** In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. +|========================================================================================================================= +| Board | PWM Pins * | PWM Frequency +| UNO (R3 and earlier), Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) +| UNO R4 (Minima, WiFi) | 3, 5, 6, 9, 10, 11 | 490 Hz +| Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) +| GIGA R1 | 2 - 13 | +| Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) +| UNO WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz +| MKR boards ** | 0 - 8, 10, A3, A4 | 732 Hz +| MKR1000 WiFi ** | 0 - 8, 10, 11, A3, A4 | 732 Hz +| Zero ** | 3 - 13, A0, A1 | 732 Hz +| Nano 33 IoT ** | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz +| Nano 33 BLE/BLE Sense | 1 - 13, A0 - A7 | 500 Hz +| Due \*** | 2-13 | 1000 Hz +| 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz +|========================================================================================================================= +{empty}* These pins are officially supported PWM pins. While some boards have additional pins capable of PWM, using them is recommended only for advanced users that can account for timer availability and potential conflicts with other uses of those pins. + +{empty}** In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + +{empty}pass:specialcharacters[***] In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. [%hardbreaks] From bd835df2602ecfecb606222061cd728ad17504f1 Mon Sep 17 00:00:00 2001 From: seaxwi <71350948+seaxwi@users.noreply.github.com> Date: Thu, 29 Jun 2023 15:41:20 +0200 Subject: [PATCH 229/298] Update Language/Functions/Analog IO/analogWrite.adoc Co-authored-by: per1234 --- Language/Functions/Analog IO/analogWrite.adoc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 35f8fffef..273f7a907 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -21,24 +21,25 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C [options="header"] |========================================================================================================================= -| Board | PWM Pins * | PWM Frequency +|========================================================================================================================= +| Board | PWM Pins +*+ | PWM Frequency | UNO (R3 and earlier), Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) | UNO R4 (Minima, WiFi) | 3, 5, 6, 9, 10, 11 | 490 Hz | Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) | GIGA R1 | 2 - 13 | | Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) | UNO WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz -| MKR boards ** | 0 - 8, 10, A3, A4 | 732 Hz -| MKR1000 WiFi ** | 0 - 8, 10, 11, A3, A4 | 732 Hz -| Zero ** | 3 - 13, A0, A1 | 732 Hz -| Nano 33 IoT ** | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz +| MKR boards +**+ | 0 - 8, 10, A3, A4 | 732 Hz +| MKR1000 WiFi +**+ | 0 - 8, 10, 11, A3, A4 | 732 Hz +| Zero +**+ | 3 - 13, A0, A1 | 732 Hz +| Nano 33 IoT +**+ | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz | Nano 33 BLE/BLE Sense | 1 - 13, A0 - A7 | 500 Hz -| Due \*** | 2-13 | 1000 Hz +| Due +***+ | 2-13 | 1000 Hz | 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz |========================================================================================================================= -{empty}* These pins are officially supported PWM pins. While some boards have additional pins capable of PWM, using them is recommended only for advanced users that can account for timer availability and potential conflicts with other uses of those pins. + -{empty}** In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + -{empty}pass:specialcharacters[***] In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. ++*+ These pins are officially supported PWM pins. While some boards have additional pins capable of PWM, using them is recommended only for advanced users that can account for timer availability and potential conflicts with other uses of those pins. + ++**+ In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + ++***+ In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. [%hardbreaks] From ed0987b4adcdd4b9bc16b54d319c0706c37011fd Mon Sep 17 00:00:00 2001 From: seaxwi <71350948+seaxwi@users.noreply.github.com> Date: Wed, 5 Jul 2023 19:00:30 +0200 Subject: [PATCH 230/298] Add PWM frequency for GIGA R1 --- Language/Functions/Analog IO/analogWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 273f7a907..e49efe1ca 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -26,7 +26,7 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C | UNO (R3 and earlier), Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) | UNO R4 (Minima, WiFi) | 3, 5, 6, 9, 10, 11 | 490 Hz | Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) -| GIGA R1 | 2 - 13 | +| GIGA R1 | 2 - 13 | 500 Hz | Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) | UNO WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz | MKR boards +**+ | 0 - 8, 10, A3, A4 | 732 Hz From b43dfa96214b403bb12074503f867a3765e5a6fa Mon Sep 17 00:00:00 2001 From: Hannes Siebeneicher Date: Thu, 7 Sep 2023 16:44:53 +0200 Subject: [PATCH 231/298] Fix do..while example --- Language/Structure/Control Structure/doWhile.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/doWhile.adoc b/Language/Structure/Control Structure/doWhile.adoc index c79421917..8651f957e 100644 --- a/Language/Structure/Control Structure/doWhile.adoc +++ b/Language/Structure/Control Structure/doWhile.adoc @@ -49,11 +49,15 @@ do { [source,arduino] ---- +// initialize x and i with a value of 0 int x = 0; +int i = 0; + do { delay(50); // wait for sensors to stabilize x = readSensors(); // check the sensors -} while (x < 100); + i++; // increase i by 1 +} while (i < 100); // repeat 100 times ---- From 9a8c2324a0fcd22088ec8004ccd63d1f9512e450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:24:46 +0200 Subject: [PATCH 232/298] Add new boards to attachInterrupt api --- Language/Functions/External Interrupts/attachInterrupt.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index fe5489807..d78cb147b 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -21,6 +21,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |=================================================== |Board |Digital Pins Usable For Interrupts |Uno, Nano, Mini, other 328-based |2, 3 +|UNO R4 Minima, UNO R4 WiFi |2, 3 |Uno WiFi Rev.2, Nano Every |all digital pins |Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 (*pins 20 & 21* are not available to use for interrupts while they are used for I2C communication) |Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7 @@ -28,6 +29,8 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2 |Nano 33 IoT |2, 3, 9, 10, 11, 13, A1, A5, A7 |Nano 33 BLE, Nano 33 BLE Sense |all pins +|Nano RP2040 Connect |all pins except A6/A7 +|Nano ESP32 |all pins |Due |all digital pins |101 |all digital pins (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*) |=================================================== From eb7bb37d015693c92bd07c7fdf89a0bf851ec99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:34:48 +0200 Subject: [PATCH 233/298] Update attachInterrupt.adoc --- Language/Functions/External Interrupts/attachInterrupt.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index d78cb147b..461ab5706 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -31,6 +31,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |Nano 33 BLE, Nano 33 BLE Sense |all pins |Nano RP2040 Connect |all pins except A6/A7 |Nano ESP32 |all pins +|GIGA R1 WiFi |all pins |Due |all digital pins |101 |all digital pins (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*) |=================================================== From cc5a99f3d713d190fc2cb039133f0244828d285f Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 31 Oct 2023 16:52:01 +0100 Subject: [PATCH 234/298] Explain that tone() is non-blocking. #836 --- Language/Functions/Advanced IO/tone.adoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Advanced IO/tone.adoc b/Language/Functions/Advanced IO/tone.adoc index 04b4debad..3468cd109 100644 --- a/Language/Functions/Advanced IO/tone.adoc +++ b/Language/Functions/Advanced IO/tone.adoc @@ -56,7 +56,10 @@ Nothing [float] === Notes and Warnings -If you want to play different pitches on multiple pins, you need to call `noTone()` on one pin before calling `tone()` on the next pin. + +* If you want to play different pitches on multiple pins, you need to call `noTone()` on one pin before calling `tone()` on the next pin. +* This function is non-blocking, which means that even if you provide the `duration` parameter the sketch execution will continue immediately even if the tone hasn't finished playing. + [%hardbreaks] -- From 6bed39554dd50a3db9d5beae02195195f7989c60 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 31 Oct 2023 17:00:23 +0100 Subject: [PATCH 235/298] Clarify array initialization. #813 --- Language/Variables/Data Types/array.adoc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Language/Variables/Data Types/array.adoc b/Language/Variables/Data Types/array.adoc index ccbbf2fd4..1825020c8 100644 --- a/Language/Variables/Data Types/array.adoc +++ b/Language/Variables/Data Types/array.adoc @@ -19,16 +19,21 @@ An array is a collection of variables that are accessed with an index number. Ar All of the methods below are valid ways to create (declare) an array. [source,arduino] ---- + // Declare an array of a given length without initializing the values: int myInts[6]; - int myPins[] = {2, 4, 8, 3, 6}; + + // Declare an array without explicitely choosing a size (the compiler + // counts the elements and creates an array of the appropriate size): + int myPins[] = {2, 4, 8, 3, 6, 4}; + + // Declare an array of a given length and initialize its values: int mySensVals[5] = {2, 4, -8, 3, 2}; + + // When declaring an array of type char, you'll need to make it longer + // by one element to hold the required the null termination character: char message[6] = "hello"; ---- -You can declare an array without initializing it as in myInts. -{empty} + -In myPins we declare an array without explicitly choosing a size. The compiler counts the elements and creates an array of the appropriate size. -{empty} + -Finally you can both initialize and size your array, as in mySensVals. Note that when declaring an array of type char, one more element than your initialization is required, to hold the required null character. + [%hardbreaks] [float] From 31b6de3edbae258eab96f42da5f61e67d201d2b4 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 31 Oct 2023 17:19:20 +0100 Subject: [PATCH 236/298] Explain that SPI.begin() must be called before SPI.beginTransaction() --- Language/Functions/Communication/SPI/beginTransaction.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/SPI/beginTransaction.adoc b/Language/Functions/Communication/SPI/beginTransaction.adoc index 3b5147aff..ae299ca02 100644 --- a/Language/Functions/Communication/SPI/beginTransaction.adoc +++ b/Language/Functions/Communication/SPI/beginTransaction.adoc @@ -11,7 +11,7 @@ title: SPI.beginTransaction() [float] === Description -Initializes the SPI bus using the defined link:../spisettings[SPISettings]. +Initializes the SPI bus. Note that calling link:../begin[SPI.begin()] is required before calling this one. [float] @@ -21,7 +21,7 @@ Initializes the SPI bus using the defined link:../spisettings[SPISettings]. [float] === Parameters -mySettings: the chosen settings according to link:../spisettings[SPISettings]. +mySettings: the chosen settings (see link:../spisettings[SPISettings]). [float] From 35878f27f19982b18ddfd0dc22070271f7502e5e Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Wed, 8 Nov 2023 11:34:42 +0100 Subject: [PATCH 237/298] Multiple fixes to bitshiftRight.adoc A few corrections: * The allowed types for the left operand are not only `byte`, `int` and `long`: any integer type is allowed. In fact, an example further down uses `unsigned int`. * The right operand should be positive and less than the width of the left operand, otherwise the behavior is undefined. The condition "<= 32" is incorrect, even on 32-bit architectures. * Sign extension is not done "for esoteric historical reasons": it is required for the shift to perform a division by powers of two. Also, specify that the bits that fall off are discarded, reword some sentences, format variable names as code, and add the decimal results in comments. --- .../Bitwise Operators/bitshiftRight.adoc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Language/Structure/Bitwise Operators/bitshiftRight.adoc b/Language/Structure/Bitwise Operators/bitshiftRight.adoc index 53715a33a..444665f96 100644 --- a/Language/Structure/Bitwise Operators/bitshiftRight.adoc +++ b/Language/Structure/Bitwise Operators/bitshiftRight.adoc @@ -29,8 +29,8 @@ The right shift operator `>>` causes the bits of the left operand to be shifted [float] === Parameters -`variable`: Allowed data types: `byte`, `int`, `long`. + -`number_of_bits`: a number that is < = 32. Allowed data types: `int`. +`variable`: Allowed data types: any integer type (`byte`, `short`, `int`, `long`, `unsigned short`...). + +`number_of_bits`: a positive number smaller than the bit-width of `variable`. Allowed data types: `int`. -- // OVERVIEW SECTION ENDS @@ -47,29 +47,29 @@ The right shift operator `>>` causes the bits of the left operand to be shifted [source,arduino] ---- int a = 40; // binary: 0000000000101000 -int b = a >> 3; // binary: 0000000000000101, or 5 in decimal +int b = a >> 3; // binary: 0000000000000101, decimal: 5 ---- [%hardbreaks] [float] === Notes and Warnings -When you shift x right by y bits (x >> y), and the highest bit in x is a 1, the behavior depends on the exact data type of x. If x is of type int, the highest bit is the sign bit, determining whether x is negative or not, as we have discussed above. In that case, the sign bit is copied into lower bits, for esoteric historical reasons: +When you shift `x` right by `y` bits (`x >> y`), the `y` rightmost bits of `x` “fall off” and are discarded. If `x` has an unsigned type (e.g. `unsigned int`), the `y` leftmost bits of the result are filled with zeroes. If `x` has a signed type (e.g. `int`), its leftmost bit is the sign bit, which determines whether it is positive or negative. In this case, the `y` leftmost bits of the result are filled with copies of the sign bit. This behavior, called “sign extension”, ensures the result has the same sign as `x`. [source,arduino] ---- -int x = -16; // binary: 1111111111110000 +int x = -16; // binary: 1111111111110000 int y = 3; -int result = x >> y; // binary: 1111111111111110 +int result = x >> y; // binary: 1111111111111110, decimal: -2 ---- -This behavior, called sign extension, is often not the behavior you want. Instead, you may wish zeros to be shifted in from the left. It turns out that the right shift rules are different for unsigned int expressions, so you can use a typecast to suppress ones being copied from the left: +This may not be the behavior you want. If you instead want zeros to be shifted in from the left, you can use a typecast to suppress sign extension: [source,arduino] ---- -int x = -16; // binary: 1111111111110000 +int x = -16; // binary: 1111111111110000 int y = 3; -int result = (unsigned int)x >> y; // binary: 0001111111111110 +int result = (unsigned int)x >> y; // binary: 0001111111111110, decimal: 8190 ---- -Sign extension causes that you can use the right-shift operator `>>` as a way to divide by powers of 2, even negative numbers. For example: +Sign extension causes the right-shift operator `>>` to perform a division by powers of 2, even with negative numbers. For example: [source,arduino] ---- From 38037ccd47d8fae475683ecb8602abd82a5d6871 Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Thu, 9 Nov 2023 12:20:53 +0100 Subject: [PATCH 238/298] PROGMEM.adoc: remove false implications Remove two false implications from PROGMEM.adoc: 1. That PROGMEM costs flash space (constants go to flash no matter what, PROGMEM only prevents them from being copied to ram at start up). 2. That reading PROGMEM data incurs the cost of an extra flash-to-SRAM copy (no extra copy: an SRAM-to-CPU copy is replaced by a flash-to-CPU copy). Also, add an empty line after `#include ` for better formatting. Fixes #739. --- Language/Variables/Utilities/PROGMEM.adoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index 2c8a5de8a..2006bc5ff 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -17,16 +17,17 @@ subCategories: [ "Utilities" ] [float] === Description -Store data in flash (program) memory instead of SRAM. There's a description of the various https://www.arduino.cc/en/Tutorial/Foundations/Memory[types of memory] available on an Arduino board. +Keep constant data in flash (program) memory only, instead of copying it to SRAM when the program starts. There's a description of the various https://www.arduino.cc/en/Tutorial/Foundations/Memory[types of memory] available on an Arduino board. -The `PROGMEM` keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "put this information into flash memory", instead of into SRAM, where it would normally go. +The `PROGMEM` keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "keep this information in flash memory only", instead of copying it to SRAM at start up, like it would normally do. PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE. However, if you are using an IDE version below 1.0 (2011), you'll first need to include the library at the top of your sketch, like this: `#include ` + While `PROGMEM` could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array, (or another C++ data structure beyond our present discussion). -Using `PROGMEM` is also a two-step procedure. After getting the data into Flash memory, it requires special methods (functions), also defined in the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library, to read the data from program memory back into SRAM, so we can do something useful with it. +Using `PROGMEM` is a two-step procedure. Once a variable has been defined with `PROGMEM`, it cannot be read like a regular SRAM-based variable: you have to read it using specific functions, also defined in link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h]. [%hardbreaks] From c1fa7587f49c5c1f8a42bf524510922487b3ab93 Mon Sep 17 00:00:00 2001 From: J-J-B-J Date: Sun, 12 Nov 2023 12:03:30 +1100 Subject: [PATCH 239/298] Update print.adoc Fix typo: "length" was spelled "lenght" --- Language/Functions/Communication/Serial/print.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index eb2d5732f..a14c9cec1 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -100,7 +100,7 @@ void loop() { for (int x = 0; x < 64; x++) { // only part of the ASCII chart, change to suit // print it out in many formats: Serial.print(x); // print as an ASCII-encoded decimal - same as "DEC" - Serial.print("\t\t"); // prints two tabs to accomodate the label lenght + Serial.print("\t\t"); // prints two tabs to accomodate the label length Serial.print(x, DEC); // print as an ASCII-encoded decimal Serial.print("\t"); // prints a tab From 00a094c11b669a821a021cbc42db6ade8010cc7c Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Thu, 23 Feb 2023 21:33:51 +0100 Subject: [PATCH 240/298] keyboardBegin.adoc: add pt_PT and hu_HU keyboard layouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version 1.0.5 of the Keyboard library added the Portuguese and the Hungarian keyboard layouts. Update the documentation of Keyboard.begin() accordingly. Co-authored-by: Karl Söderby <35461661+karlsoderby@users.noreply.github.com> --- Language/Functions/USB/Keyboard/keyboardBegin.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Language/Functions/USB/Keyboard/keyboardBegin.adoc b/Language/Functions/USB/Keyboard/keyboardBegin.adoc index bdeaab7e7..52e352203 100644 --- a/Language/Functions/USB/Keyboard/keyboardBegin.adoc +++ b/Language/Functions/USB/Keyboard/keyboardBegin.adoc @@ -38,7 +38,9 @@ Currently, the library supports the following national keyboard layouts: * `KeyboardLayout_en_US`: USA * `KeyboardLayout_es_ES`: Spain * `KeyboardLayout_fr_FR`: France +* `KeyboardLayout_hu_HU`: Hungary * `KeyboardLayout_it_IT`: Italy +* `KeyboardLayout_pt_PT`: Portugal * `KeyboardLayout_sv_SE`: Sweden From abc3fa7378ac4d208d612532b7272d522716254a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= Date: Thu, 16 Nov 2023 12:04:36 +0100 Subject: [PATCH 241/298] Update analogWrite.adoc --- Language/Functions/Analog IO/analogWrite.adoc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 5e9e4f25b..76eb3c261 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -21,26 +21,26 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C [options="header"] -|========================================================================================================================= |========================================================================================================================= | Board | PWM Pins +*+ | PWM Frequency | UNO (R3 and earlier), Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) -| UNO R4 (Minima, WiFi) | 3, 5, 6, 9, 10, 11 | 490 Hz +| UNO R4 (Minima, WiFi) +*+ | 3, 5, 6, 9, 10, 11 | 490 Hz | Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) -| GIGA R1 | 2 - 13 | 500 Hz +| GIGA R1** | 2 - 13 | 500 Hz | Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) | UNO WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz -| MKR boards +**+ | 0 - 8, 10, A3, A4 | 732 Hz +| MKR boards +*+ | 0 - 8, 10, A3, A4 | 732 Hz | MKR1000 WiFi +**+ | 0 - 8, 10, 11, A3, A4 | 732 Hz | Zero +**+ | 3 - 13, A0, A1 | 732 Hz | Nano 33 IoT +**+ | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz | Nano 33 BLE/BLE Sense +****+ | 1 - 13, A0 - A7 | 500 Hz | Due +***+ | 2-13 | 1000 Hz | 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz -|========================================================================================================================= +|======================================================================================================================= + +*+ These pins are officially supported PWM pins. While some boards have additional pins capable of PWM, using them is recommended only for advanced users that can account for timer availability and potential conflicts with other uses of those pins. + -+**+ In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, and Zero boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + -+***+ In addition to PWM capabilities on the pins noted above, the Due has true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. ++**+ In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, Zero and UNO R4 boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + ++***+ In addition to PWM capabilities on the pins noted above, the Due and GIGA R1 boards have true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. +****+ Only 4 different pins can be used at the same time. Enabling PWM on more than 4 pins will abort the running sketch and require resetting the board to upload a new sketch again. + [%hardbreaks] From e05ba5b96f5b9e9cce137d335380ff5288615762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= Date: Thu, 16 Nov 2023 12:06:50 +0100 Subject: [PATCH 242/298] Update analogWrite.adoc --- Language/Functions/Analog IO/analogWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index 76eb3c261..f6fbcd560 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -36,7 +36,7 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C | Nano 33 BLE/BLE Sense +****+ | 1 - 13, A0 - A7 | 500 Hz | Due +***+ | 2-13 | 1000 Hz | 101 | 3, 5, 6, 9 | pins 3 and 9: 490 Hz, pins 5 and 6: 980 Hz -|======================================================================================================================= +|========================================================================================================================= +*+ These pins are officially supported PWM pins. While some boards have additional pins capable of PWM, using them is recommended only for advanced users that can account for timer availability and potential conflicts with other uses of those pins. + +**+ In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, Zero and UNO R4 boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + From 00f2a168b917de22ba1d61fd147d2bb387ab23df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= Date: Thu, 16 Nov 2023 12:09:31 +0100 Subject: [PATCH 243/298] Update analogWrite.adoc --- Language/Functions/Analog IO/analogWrite.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index f6fbcd560..d6337046a 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -26,10 +26,10 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C | UNO (R3 and earlier), Nano, Mini | 3, 5, 6, 9, 10, 11 | 490 Hz (pins 5 and 6: 980 Hz) | UNO R4 (Minima, WiFi) +*+ | 3, 5, 6, 9, 10, 11 | 490 Hz | Mega | 2 - 13, 44 - 46 | 490 Hz (pins 4 and 13: 980 Hz) -| GIGA R1** | 2 - 13 | 500 Hz +| GIGA R1 +**+ | 2 - 13 | 500 Hz | Leonardo, Micro, Yún | 3, 5, 6, 9, 10, 11, 13 | 490 Hz (pins 3 and 11: 980 Hz) | UNO WiFi Rev2, Nano Every | 3, 5, 6, 9, 10 | 976 Hz -| MKR boards +*+ | 0 - 8, 10, A3, A4 | 732 Hz +| MKR boards +*+ | 0 - 8, 10, A3, A4 | 732 Hz | MKR1000 WiFi +**+ | 0 - 8, 10, 11, A3, A4 | 732 Hz | Zero +**+ | 3 - 13, A0, A1 | 732 Hz | Nano 33 IoT +**+ | 2, 3, 5, 6, 9 - 12, A2, A3, A5 | 732 Hz From b130c36981ce3cbaecde4e8e564a32d84bc9eb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= Date: Thu, 16 Nov 2023 14:02:08 +0100 Subject: [PATCH 244/298] Update analogRead.adoc --- Language/Functions/Analog IO/analogRead.adoc | 24 ++++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Language/Functions/Analog IO/analogRead.adoc b/Language/Functions/Analog IO/analogRead.adoc index 929b1cc8a..fab0ccb76 100644 --- a/Language/Functions/Analog IO/analogRead.adoc +++ b/Language/Functions/Analog IO/analogRead.adoc @@ -20,19 +20,23 @@ On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 microseconds [options="header"] |=================================================== -|Board |Operating voltage |Usable pins |Max resolution -|Uno |5 Volts |A0 to A5 |10 bits -|Mini, Nano |5 Volts |A0 to A7 |10 bits -|Mega, Mega2560, MegaADK |5 Volts |A0 to A14 |10 bits -|Micro |5 Volts |A0 to A11* |10 bits -|Leonardo |5 Volts |A0 to A11* |10 bits -|Zero |3.3 Volts |A0 to A5 |12 bits** -|Due |3.3 Volts |A0 to A11 |12 bits** -|MKR Family boards |3.3 Volts |A0 to A6 |12 bits** +|Board |Operating voltage |Usable pins |Max resolution +|UNO R3 |5 Volts |A0 to A5 |10 bits +|UNO R4 (Minima, WiFi) |5 Volts |A0 to A5 |14 bits** +|Mini |5 Volts |A0 to A7 |10 bits +|Nano, Nano Every |5 Volts |A0 to A7 |10 bits +|Nano 33 (IoT, BLE, RP2040, ESP32)|3.3 Volts |A0 to A7 |12 bits** +|Mega, Mega2560, MegaADK |5 Volts |A0 to A14 |10 bits +|Micro |5 Volts |A0 to A11* |10 bits +|Leonardo |5 Volts |A0 to A11* |10 bits +|Zero |3.3 Volts |A0 to A5 |12 bits** +|Due |3.3 Volts |A0 to A11 |12 bits** +|GIGA R1 |3.3 Volts |A0 to A11 |16 bits** +|MKR Family boards |3.3 Volts |A0 to A6 |12 bits** |=================================================== *A0 through A5 are labelled on the board, A6 through A11 are respectively available on pins 4, 6, 8, 9, 10, and 12 + -**The default `analogRead()` resolution for these boards is 10 bits, for compatibility. You need to use link:../../zero-due-mkr-family/analogreadresolution[analogReadResolution()] to change it to 12 bits. +**The default `analogRead()` resolution for these boards is 10 bits, for compatibility. You need to use link:../../zero-due-mkr-family/analogreadresolution[analogReadResolution()] to change it to a higher resolution. [%hardbreaks] From 03bedb21121b173ab21c738d14ce8d3d47dd25f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= Date: Thu, 16 Nov 2023 14:07:22 +0100 Subject: [PATCH 245/298] Update analogRead.adoc --- Language/Functions/Analog IO/analogRead.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogRead.adoc b/Language/Functions/Analog IO/analogRead.adoc index fab0ccb76..8eac217a5 100644 --- a/Language/Functions/Analog IO/analogRead.adoc +++ b/Language/Functions/Analog IO/analogRead.adoc @@ -47,7 +47,7 @@ On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 microseconds [float] === Parameters -`pin`: the name of the analog input pin to read from (A0 to A5 on most boards, A0 to A6 on MKR boards, A0 to A7 on the Mini and Nano, A0 to A15 on the Mega). +`pin`: the name of the analog input pin to read from. [float] From 66968943c9062fde6264e87626156a52cc5fb11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:16:35 +0100 Subject: [PATCH 246/298] bitRead & bitWrite Improvements Adds more information to bitWrite, and a code example for how to use bitRead. --- .../Functions/Bits and Bytes/bitRead.adoc | 50 ++++++++++++++++++- .../Functions/Bits and Bytes/bitWrite.adoc | 2 +- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Bits and Bytes/bitRead.adoc b/Language/Functions/Bits and Bytes/bitRead.adoc index b6c324c15..4c4cb9346 100644 --- a/Language/Functions/Bits and Bytes/bitRead.adoc +++ b/Language/Functions/Bits and Bytes/bitRead.adoc @@ -17,7 +17,7 @@ subCategories: [ "Bits and Bytes" ] [float] === Description -Reads a bit of a number. +Reads a bit of a variable, e.g. `bool`, `int`. Note that `float` & `double` are not supported. You can read the bit of variables up to an `unsigned long long` (64 bits / 8 bytes). [%hardbreaks] @@ -36,6 +36,54 @@ Reads a bit of a number. === Returns The value of the bit (0 or 1). +=== Example Code + +This example code demonstrates how to read two variables, one increasing counter, one decreasing counter, and print out both the binary and decimal values of the variables. + +The `readBit()` function loops through each bit of the variable (starting from the rightmost bit), and prints it out. + +[source,arduino] +---- +long negative_var = -0; // +unsigned long long positive_var = 0; + +//predefined sizes when looping through bits +//e.g. long_size is 32 bit (which is 0-31). Therefore, we subtract "1". +const int bool_size = (1 - 1); +const int int_size = (8 - 1); +const int long_size = (32 - 1); + +void setup() { + Serial.begin(9600); +} + +void loop() { + //run readBit function, passing the pos/neg variables + readBit("Positive ", positive_var); + readBit("Negative ", negative_var); + Serial.println(); + + //increase and decrease the variables + negative_var--; + positive_var++; + + delay(1000); +} + +/*this function takes a variable, prints it out bit by bit (starting from the right) +then prints the decimal number for comparison.*/ +void readBit(String direction, long counter) { + Serial.print(direction + "Binary Number: "); + //loop through each bit + for (int b = long_size; b >= 0; b--) { + byte bit = bitRead(counter, b); + Serial.print(bit); + } + Serial.print(" Decimal Number: "); + Serial.println(counter); +} +---- + -- // OVERVIEW SECTION ENDS diff --git a/Language/Functions/Bits and Bytes/bitWrite.adoc b/Language/Functions/Bits and Bytes/bitWrite.adoc index b12982ed5..687fc3dcc 100644 --- a/Language/Functions/Bits and Bytes/bitWrite.adoc +++ b/Language/Functions/Bits and Bytes/bitWrite.adoc @@ -17,7 +17,7 @@ subCategories: [ "Bits and Bytes" ] [float] === Description -Writes a bit of a numeric variable. +Writes to a bit of a variable, e.g. `bool`, `int`, `long`. Note that `float` & `double` are not supported. You can read the bit of variables up to an `unsigned long` (32 bits / 8 bytes). [%hardbreaks] From b9ee540a0912715a18684da4601f07affc4df999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:19:52 +0100 Subject: [PATCH 247/298] Update bitWrite.adoc --- Language/Functions/Bits and Bytes/bitWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bitWrite.adoc b/Language/Functions/Bits and Bytes/bitWrite.adoc index 687fc3dcc..82b4d6a55 100644 --- a/Language/Functions/Bits and Bytes/bitWrite.adoc +++ b/Language/Functions/Bits and Bytes/bitWrite.adoc @@ -17,7 +17,7 @@ subCategories: [ "Bits and Bytes" ] [float] === Description -Writes to a bit of a variable, e.g. `bool`, `int`, `long`. Note that `float` & `double` are not supported. You can read the bit of variables up to an `unsigned long` (32 bits / 8 bytes). +Writes to a bit of a variable, e.g. `bool`, `int`, `long`. Note that `float` & `double` are not supported. You can write to a bit of variables up to an `unsigned long` (32 bits / 8 bytes). [%hardbreaks] From ed570d24fc46b02e5039752384668d2a8884b9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= Date: Fri, 17 Nov 2023 11:28:59 +0100 Subject: [PATCH 248/298] Add Renesas analogReference --- Language/Functions/Analog IO/analogReference.adoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Language/Functions/Analog IO/analogReference.adoc b/Language/Functions/Analog IO/analogReference.adoc index 8b463de9d..0e44b5881 100644 --- a/Language/Functions/Analog IO/analogReference.adoc +++ b/Language/Functions/Analog IO/analogReference.adoc @@ -27,6 +27,15 @@ Arduino AVR Boards (Uno, Mega, Leonardo, etc.) * INTERNAL2V56: a built-in 2.56V reference (Arduino Mega only) * EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference. +Arduino Renesas Boards (UNO R4, Portenta C33) + +* AR_DEFAULT: the default analog reference of 5 volts. +* AR_INTERNAL: A built-in reference, equal to 1.5 Volts on the RA4M1 of the UNO R4 +* AR_INTERNAL_1_5V: A built-in reference, equal to 1.5 V on the R7FA6M5 of the Portenta C33 +* AR_INTERNAL_2_0V: A built-in reference, equal to 2.0 V on the R7FA6M5 of the Portenta C33 +* AR_INTERNAL_2_5V: A built-in reference, equal to 2.5 V on the R7FA6M5 of the Portenta C33 +* AR_EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference. + Arduino SAMD Boards (Zero, etc.) * AR_DEFAULT: the default analog reference of 3.3V From d75e087e74f5c216387a6d645604a5fa01dc40c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:54:09 +0100 Subject: [PATCH 249/298] Update attachInterrupt.adoc --- .../External Interrupts/attachInterrupt.adoc | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 76286550e..516039edd 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -19,21 +19,21 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you [options="header"] |=================================================== -|Board |Digital Pins Usable For Interrupts -|Uno, Nano, Mini, other 328-based |2, 3 -|UNO R4 Minima, UNO R4 WiFi |2, 3 -|Uno WiFi Rev.2, Nano Every |all digital pins -|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 (*pins 20 & 21* are not available to use for interrupts while they are used for I2C communication; they also have external pull-ups that cannot be disabled) -|Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7 -|Zero |all digital pins, except 4 -|MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2 -|Nano 33 IoT |2, 3, 9, 10, 11, 13, A1, A5, A7 -|Nano 33 BLE, Nano 33 BLE Sense |all pins -|Nano RP2040 Connect |all pins except A6/A7 -|Nano ESP32 |all pins -|GIGA R1 WiFi |all pins -|Due |all digital pins -|101 |all digital pins (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*) +|Board |Digital Pins Usable For Interrupts| Note +|Uno R3, Nano, Mini, other 328-based |2, 3| +|UNO R4 Minima, UNO R4 WiFi |2, 3| +|Uno WiFi Rev.2, Nano Every |All digital pins| +|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 |(*pins 20 & 21* are not available to use for interrupts while they are used for I2C communication; they also have external pull-ups that cannot be disabled) +|Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7| +|Zero |0-3, 5-13, A0-A5| Pin 4 cannot be used as an interrupt. +|MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2| +|Nano 33 IoT |2, 3, 9, 10, 11, 13, A1, A5, A7| +|Nano 33 BLE, Nano 33 BLE Sense |all pins| +|Nano RP2040 Connect |0-13, A0-A5| +|Nano ESP32 |all pins| +|GIGA R1 WiFi |all pins| +|Due |all digital pins| +|101 |all digital pins | (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*)) |=================================================== [%hardbreaks] From 231d7ccbc16e1906ce245dd9ac27f7c40bd60620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 20 Nov 2023 10:22:08 +0100 Subject: [PATCH 250/298] Update attachInterrupt.adoc --- Language/Functions/External Interrupts/attachInterrupt.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index 516039edd..f334b11a2 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -20,7 +20,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you [options="header"] |=================================================== |Board |Digital Pins Usable For Interrupts| Note -|Uno R3, Nano, Mini, other 328-based |2, 3| +|Uno Rev3, Nano, Mini, other 328-based |2, 3| |UNO R4 Minima, UNO R4 WiFi |2, 3| |Uno WiFi Rev.2, Nano Every |All digital pins| |Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 |(*pins 20 & 21* are not available to use for interrupts while they are used for I2C communication; they also have external pull-ups that cannot be disabled) @@ -28,7 +28,7 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you |Zero |0-3, 5-13, A0-A5| Pin 4 cannot be used as an interrupt. |MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2| |Nano 33 IoT |2, 3, 9, 10, 11, 13, A1, A5, A7| -|Nano 33 BLE, Nano 33 BLE Sense |all pins| +|Nano 33 BLE, Nano 33 BLE Sense (rev 1 & 2) |all pins| |Nano RP2040 Connect |0-13, A0-A5| |Nano ESP32 |all pins| |GIGA R1 WiFi |all pins| From 99922dbda68ee6cad7d8ce2b5de677c1d7ea3afc Mon Sep 17 00:00:00 2001 From: Hannes Siebeneicher Date: Mon, 20 Nov 2023 10:28:38 +0100 Subject: [PATCH 251/298] Add compatible hardware --- Language/Functions/USB/Keyboard.adoc | 25 +++++++++++++++++++++++++ Language/Functions/USB/Mouse.adoc | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/Language/Functions/USB/Keyboard.adoc b/Language/Functions/USB/Keyboard.adoc index 20a1ac7df..e306febbf 100644 --- a/Language/Functions/USB/Keyboard.adoc +++ b/Language/Functions/USB/Keyboard.adoc @@ -24,6 +24,31 @@ The library supports the use of modifier keys. Modifier keys change the behavior -- // OVERVIEW SECTION ENDS +[float] +=== Compatible Hardware +HID is supported on the following boards: +[options="header"] +|========================================================= +| Board | Pins +| link:https://docs.arduino.cc/hardware/leonardo[Leonardo] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/micro[Micro] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/due[Due] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/zero[Zero] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-fox-1200[MKR FOX 1200] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-gsm-1400[MKR GSM 1400] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-nb-1500[MKR NB 1500] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-vidor-4000[MKR Vidor 4000] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-wan-1300[MKR WAN 1300] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-wan-1310[MKR WAN 1310] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-wifi-1010[MKR WiFi 1010] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-zero[MKR Zero] | Digital / Analog Pins +|========================================================= + [float] === Notes and Warnings These core libraries allow the 32u4 and SAMD based boards (Leonardo, Esplora, Zero, Due and MKR Family) to appear as a native Mouse and/or Keyboard to a connected computer. diff --git a/Language/Functions/USB/Mouse.adoc b/Language/Functions/USB/Mouse.adoc index adab1e421..cf4fc42fb 100644 --- a/Language/Functions/USB/Mouse.adoc +++ b/Language/Functions/USB/Mouse.adoc @@ -23,6 +23,30 @@ The mouse functions enable 32u4 or SAMD micro based boards to control cursor mov -- // OVERVIEW SECTION ENDS +[float] +=== Compatible Hardware +HID is supported on the following boards: +[options="header"] +|========================================================= +| Board | Pins +| link:https://docs.arduino.cc/hardware/leonardo[Leonardo] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/micro[Micro] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/due[Due] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/zero[Zero] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-fox-1200[MKR FOX 1200] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-gsm-1400[MKR GSM 1400] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-nb-1500[MKR NB 1500] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-vidor-4000[MKR Vidor 4000] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-wan-1300[MKR WAN 1300] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-wan-1310[MKR WAN 1310] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-wifi-1010[MKR WiFi 1010] | Digital / Analog Pins +| link:https://docs.arduino.cc/hardware/mkr-zero[MKR Zero] | Digital / Analog Pins +|========================================================= [float] === Notes and Warnings From 7a3331a5bbe48ec5650c7041312437cdfc506a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 20 Nov 2023 10:41:22 +0100 Subject: [PATCH 252/298] Minor changes --- .../External Interrupts/attachInterrupt.adoc | 28 +++++++++---------- .../External Interrupts/detachInterrupt.adoc | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index f334b11a2..eb6e04f0f 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -19,21 +19,21 @@ The first parameter to `attachInterrupt()` is an interrupt number. Normally you [options="header"] |=================================================== -|Board |Digital Pins Usable For Interrupts| Note -|Uno Rev3, Nano, Mini, other 328-based |2, 3| -|UNO R4 Minima, UNO R4 WiFi |2, 3| -|Uno WiFi Rev.2, Nano Every |All digital pins| -|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 |(*pins 20 & 21* are not available to use for interrupts while they are used for I2C communication; they also have external pull-ups that cannot be disabled) -|Micro, Leonardo, other 32u4-based |0, 1, 2, 3, 7| -|Zero |0-3, 5-13, A0-A5| Pin 4 cannot be used as an interrupt. -|MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2| -|Nano 33 IoT |2, 3, 9, 10, 11, 13, A1, A5, A7| +|Board |Digital Pins Usable For Interrupts| Notes +|Uno Rev3, Nano, Mini, other 328-based |2, 3| +|UNO R4 Minima, UNO R4 WiFi |2, 3| +|Uno WiFi Rev2, Nano Every |All digital pins| +|Mega, Mega2560, MegaADK |2, 3, 18, 19, 20, 21 |(*pins 20 & 21* are not available to use for interrupts while they are used for I2C communication; they also have external pull-ups that cannot be disabled) +|Micro, Leonardo |0, 1, 2, 3, 7| +|Zero |0-3, 5-13, A0-A5| Pin 4 cannot be used as an interrupt. +|MKR Family boards |0, 1, 4, 5, 6, 7, 8, 9, A1, A2| +|Nano 33 IoT |2, 3, 9, 10, 11, 13, A1, A5, A7| |Nano 33 BLE, Nano 33 BLE Sense (rev 1 & 2) |all pins| -|Nano RP2040 Connect |0-13, A0-A5| -|Nano ESP32 |all pins| -|GIGA R1 WiFi |all pins| -|Due |all digital pins| -|101 |all digital pins | (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*)) +|Nano RP2040 Connect |0-13, A0-A5| +|Nano ESP32 |all pins| +|GIGA R1 WiFi |all pins| +|Due |all digital pins| +|101 |all digital pins | (Only pins 2, 5, 7, 8, 10, 11, 12, 13 work with *CHANGE*)) |=================================================== [%hardbreaks] diff --git a/Language/Functions/External Interrupts/detachInterrupt.adoc b/Language/Functions/External Interrupts/detachInterrupt.adoc index f9e7cc395..84fa30978 100644 --- a/Language/Functions/External Interrupts/detachInterrupt.adoc +++ b/Language/Functions/External Interrupts/detachInterrupt.adoc @@ -23,9 +23,9 @@ Turns off the given interrupt. [float] === Syntax -`detachInterrupt(digitalPinToInterrupt(pin))` (recommended) + -`detachInterrupt(interrupt)` (not recommended) + -`detachInterrupt(pin)` (Not recommended. Additionally, this syntax only works on Arduino SAMD Boards, Uno WiFi Rev2, Due, and 101.) +- `detachInterrupt(digitalPinToInterrupt(pin))` (recommended) + +- `detachInterrupt(interrupt)` (not recommended) + +- `detachInterrupt(pin)` (Not recommended. Additionally, this only works on a specific set of boards.) [float] From 3e7788827416776a62a62bfc6acf12fdcda6b5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 20 Nov 2023 10:45:50 +0100 Subject: [PATCH 253/298] Update attachInterrupt.adoc --- Language/Functions/External Interrupts/attachInterrupt.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/External Interrupts/attachInterrupt.adoc b/Language/Functions/External Interrupts/attachInterrupt.adoc index eb6e04f0f..05fa3b70c 100644 --- a/Language/Functions/External Interrupts/attachInterrupt.adoc +++ b/Language/Functions/External Interrupts/attachInterrupt.adoc @@ -137,8 +137,8 @@ Note that in the table below, the interrupt numbers refer to the number to be pa |Mega2560 | 2 | 3 | 21 | 20 | 19 | 18 |32u4 based (e.g Leonardo, Micro) | 3 | 2 | 0 | 1 | 7 | |=================================================== -For Uno WiFiRev.2, Due, Zero, MKR Family and 101 boards the *interrupt number = pin number*. +For Uno WiFi Rev2, Due, Zero, MKR Family and 101 boards the *interrupt number = pin number*. -- // HOW TO USE SECTION ENDS From 92f47b0b8a336865ea0951f526934d0d1536f841 Mon Sep 17 00:00:00 2001 From: Hannes Siebeneicher Date: Mon, 20 Nov 2023 10:58:54 +0100 Subject: [PATCH 254/298] update tables --- Language/Functions/USB/Keyboard.adoc | 33 +++++++++++----------------- Language/Functions/USB/Mouse.adoc | 33 +++++++++++----------------- 2 files changed, 26 insertions(+), 40 deletions(-) diff --git a/Language/Functions/USB/Keyboard.adoc b/Language/Functions/USB/Keyboard.adoc index e306febbf..f1d9c565a 100644 --- a/Language/Functions/USB/Keyboard.adoc +++ b/Language/Functions/USB/Keyboard.adoc @@ -28,26 +28,19 @@ The library supports the use of modifier keys. Modifier keys change the behavior === Compatible Hardware HID is supported on the following boards: [options="header"] -|========================================================= -| Board | Pins -| link:https://docs.arduino.cc/hardware/leonardo[Leonardo] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/micro[Micro] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/due[Due] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/zero[Zero] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-fox-1200[MKR FOX 1200] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-gsm-1400[MKR GSM 1400] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-nb-1500[MKR NB 1500] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-vidor-4000[MKR Vidor 4000] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-wan-1300[MKR WAN 1300] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-wan-1310[MKR WAN 1310] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-wifi-1010[MKR WiFi 1010] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-zero[MKR Zero] | Digital / Analog Pins -|========================================================= +|================================================================================================= +| Board | Supported Pins +| link:https://docs.arduino.cc/hardware/leonardo[Leonardo] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/micro[Micro] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/due[Due] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/zero[Zero] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | All digital & analog pins +| link:https://docs.arduino.cc/#mkr-family[MKR Family] | All digital & analog pins +|================================================================================================= [float] === Notes and Warnings diff --git a/Language/Functions/USB/Mouse.adoc b/Language/Functions/USB/Mouse.adoc index cf4fc42fb..c4c8e3865 100644 --- a/Language/Functions/USB/Mouse.adoc +++ b/Language/Functions/USB/Mouse.adoc @@ -27,26 +27,19 @@ The mouse functions enable 32u4 or SAMD micro based boards to control cursor mov === Compatible Hardware HID is supported on the following boards: [options="header"] -|========================================================= -| Board | Pins -| link:https://docs.arduino.cc/hardware/leonardo[Leonardo] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/micro[Micro] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/due[Due] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/zero[Zero] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-fox-1200[MKR FOX 1200] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-gsm-1400[MKR GSM 1400] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-nb-1500[MKR NB 1500] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-vidor-4000[MKR Vidor 4000] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-wan-1300[MKR WAN 1300] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-wan-1310[MKR WAN 1310] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-wifi-1010[MKR WiFi 1010] | Digital / Analog Pins -| link:https://docs.arduino.cc/hardware/mkr-zero[MKR Zero] | Digital / Analog Pins -|========================================================= +|================================================================================================= +| Board | Supported Pins +| link:https://docs.arduino.cc/hardware/leonardo[Leonardo] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/micro[Micro] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/due[Due] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/zero[Zero] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | All digital & analog pins +| link:https://docs.arduino.cc/#mkr-family[MKR Family] | All digital & analog pins +|================================================================================================= [float] === Notes and Warnings From 891e174b6d1548a958c85aec5f14c2ff34eac35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:51:50 +0100 Subject: [PATCH 255/298] Update Switch Case Remove limitation that only char/int can be used (any integer is allowed) --- Language/Structure/Control Structure/switchCase.adoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index faa4a60a7..a51a4319b 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -44,9 +44,10 @@ switch (var) { [float] === Parameters -`var`: a variable whose value to compare with various cases. Allowed data types: `int`, `char`. + -`label1`, `label2`: constants. Allowed data types: `int`, `char`. +`var`: an *integer* variable whose value to compare with various cases. Any integer data type is allowed*, such as `byte`, `char`, `int`, `long`. +`label1`, `label2`: constants. Any integer data type here is also allowed. +*You can also use the `bool` data type when you just two switch cases. [float] === Returns From 8a2d16171a333dd92fc3a8e56bfc81b8205aefa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:53:48 +0100 Subject: [PATCH 256/298] Update switchCase.adoc --- Language/Structure/Control Structure/switchCase.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index a51a4319b..e608c23d2 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -49,6 +49,8 @@ switch (var) { *You can also use the `bool` data type when you just two switch cases. +Note that you can also negative values as input. + [float] === Returns Nothing From d044e05bf72ce3f9148b93a9789fc14f7efaa040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:33:37 +0100 Subject: [PATCH 257/298] DigitalPinToInterrupt docs added The digitalPinToInterrupt is available in all architectures and was missing from the lang ref. --- .../digitalPinToInterrupt.adoc | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Language/Functions/External Interrupts/digitalPinToInterrupt.adoc diff --git a/Language/Functions/External Interrupts/digitalPinToInterrupt.adoc b/Language/Functions/External Interrupts/digitalPinToInterrupt.adoc new file mode 100644 index 000000000..a5077725f --- /dev/null +++ b/Language/Functions/External Interrupts/digitalPinToInterrupt.adoc @@ -0,0 +1,92 @@ +--- +title: digitalPinToInterrupt() +categories: [ "Functions" ] +subCategories: [ "External Interrupts" ] +--- + + + + + += digitalPinToInterrupt() + + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +=== Description +The `digitalPinToInterrupt()` function takes a pin as an argument, and returns the same pin *if* it can be used as an interrupt. For example, `digitalPinToInterrupt(4)` on an Arduino UNO will not work, as interrupts are only supported on pins 2,3. + +See link:../../external-interrupts/attachinterrupt[attachInterrupt()] for a full list of supported interrupt pins on all boards. + +[%hardbreaks] + + +[float] +=== Syntax +`digitalPinToInterrupt(pin)` + + +[float] +=== Parameters +- `pin` - the pin we want to use for an interrupt. + + +[float] +=== Returns +- The pin to interrupt (e.g. `2`)+ +- If pin is not available for interrupt, returns `-1`. + +-- +// OVERVIEW SECTION ENDS + + + + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== Example Code +// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ +This example checks if a pin can be used as an interrupt. + +[source,arduino] +---- +int pin = 2; + +void setup() { + Serial.begin(9600); + int checkPin = digitalPinToInterrupt(pin); + + if (checkPin == -1) { + Serial.println("Not a valid interrupt pin!"); + } else { + Serial.println("Valid interrupt pin."); + } +} + +void loop() { +} +---- + +-- +// HOW TO USE SECTION ENDS + + +// SEE ALSO SECTION +[#see_also] +-- + +[float] +=== See also + +[role="language"] +* #LANGUAGE# link:../../external-interrupts/attachinterrupt[attachInterrupts()] +* #LANGUAGE# link:../../external-interrupts/detachinterrupt[detachInterrupts()] + +-- +// SEE ALSO SECTION ENDS From 65a628db16244ff8981e20cb5110ec9d3fefd16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:44:26 +0100 Subject: [PATCH 258/298] Update reserve.adoc --- Language/Variables/Data Types/String/Functions/reserve.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Data Types/String/Functions/reserve.adoc b/Language/Variables/Data Types/String/Functions/reserve.adoc index 10d76d6ec..de64fdd0d 100644 --- a/Language/Variables/Data Types/String/Functions/reserve.adoc +++ b/Language/Variables/Data Types/String/Functions/reserve.adoc @@ -35,7 +35,7 @@ The String reserve() function allows you to allocate a buffer in memory for mani [float] === Returns -Nothing +`1` on success, `0` on failure. -- // OVERVIEW SECTION ENDS From 5f9641561e1c2c844765ed3dcf55d19dcc9d688a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:20:56 +0100 Subject: [PATCH 259/298] Update PROGMEM.adoc --- Language/Variables/Utilities/PROGMEM.adoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index 2006bc5ff..e7c4dbc1c 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -17,17 +17,22 @@ subCategories: [ "Utilities" ] [float] === Description + Keep constant data in flash (program) memory only, instead of copying it to SRAM when the program starts. There's a description of the various https://www.arduino.cc/en/Tutorial/Foundations/Memory[types of memory] available on an Arduino board. The `PROGMEM` keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "keep this information in flash memory only", instead of copying it to SRAM at start up, like it would normally do. -PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE. However, if you are using an IDE version below 1.0 (2011), you'll first need to include the library at the top of your sketch, like this: - -`#include ` +PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE. While `PROGMEM` could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array, (or another C++ data structure beyond our present discussion). Using `PROGMEM` is a two-step procedure. Once a variable has been defined with `PROGMEM`, it cannot be read like a regular SRAM-based variable: you have to read it using specific functions, also defined in link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h]. + +==== Important Note! + +`PROGMEM` is useful _only_ when working with AVR boards (Uno Rev3, Leonardo etc.). Newer boards (Due, MKR WiFi 1010, GIGA R1 WiFi etc.), automatically uses the program space when a variable is declared as a `const`. However, for retro compatibility, `PROGMEM` can still be used with newer boards. This implementation currently lives link:https://github.com/arduino/ArduinoCore-API/blob/master/api/deprecated-avr-comp/avr/pgmspace.h[here]. + + [%hardbreaks] From f06bbe07dd2ea79bcc155db005f3332476bedd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:32:20 +0100 Subject: [PATCH 260/298] Remove old version mentions Mentions referring to versions below 1.0 was removed. These are likely 15+ years old, as we are now in version 2.3.x of the IDE --- Language/Functions/Communication/Serial/flush.adoc | 2 +- Language/Functions/Communication/Serial/ifSerial.adoc | 1 - Language/Functions/Communication/Serial/write.adoc | 2 +- Language/Functions/Communication/Wire.adoc | 4 ++-- Language/Functions/Communication/Wire/endTransmission.adoc | 2 +- Language/Functions/Communication/Wire/requestFrom.adoc | 2 +- Language/Functions/Digital IO/pinMode.adoc | 2 +- Language/Functions/Time/delayMicroseconds.adoc | 2 -- .../Variables/Data Types/String/Functions/toLowerCase.adoc | 2 +- .../Variables/Data Types/String/Functions/toUpperCase.adoc | 2 +- Language/Variables/Data Types/String/Functions/trim.adoc | 2 +- Language/Variables/Data Types/string.adoc | 2 +- 12 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Language/Functions/Communication/Serial/flush.adoc b/Language/Functions/Communication/Serial/flush.adoc index b4cdcac72..03a0b6819 100644 --- a/Language/Functions/Communication/Serial/flush.adoc +++ b/Language/Functions/Communication/Serial/flush.adoc @@ -14,7 +14,7 @@ title: Serial.flush() [float] === Description -Waits for the transmission of outgoing serial data to complete. (Prior to Arduino 1.0, this instead removed any buffered incoming serial data.) +Waits for the transmission of outgoing serial data to complete. `flush()` inherits from the link:../../stream/streamflush[Stream] utility class. [%hardbreaks] diff --git a/Language/Functions/Communication/Serial/ifSerial.adoc b/Language/Functions/Communication/Serial/ifSerial.adoc index 42b3b48d7..a41c1ec88 100644 --- a/Language/Functions/Communication/Serial/ifSerial.adoc +++ b/Language/Functions/Communication/Serial/ifSerial.adoc @@ -18,7 +18,6 @@ Indicates if the specified Serial port is ready. On the boards with native USB, `if (Serial)` (or `if(SerialUSB)` on the Due) indicates whether or not the USB CDC serial connection is open. For all other boards, and the non-USB CDC ports, this will always return true. -This was introduced in Arduino IDE 1.0.1. [%hardbreaks] diff --git a/Language/Functions/Communication/Serial/write.adoc b/Language/Functions/Communication/Serial/write.adoc index aa2117dfb..00f0bdc66 100644 --- a/Language/Functions/Communication/Serial/write.adoc +++ b/Language/Functions/Communication/Serial/write.adoc @@ -65,7 +65,7 @@ void loop() { [float] === Notes and Warnings -As of Arduino IDE 1.0, serial transmission is asynchronous. If there is enough empty space in the transmit buffer, `Serial.write()` will return before any characters are transmitted over serial. If the transmit buffer is full then `Serial.write()` will block until there is enough space in the buffer. To avoid blocking calls to `Serial.write()`, you can first check the amount of free space in the transmit buffer using link:../availableforwrite[availableForWrite()]. +Serial transmission is asynchronous. If there is enough empty space in the transmit buffer, `Serial.write()` will return before any characters are transmitted over serial. If the transmit buffer is full then `Serial.write()` will block until there is enough space in the buffer. To avoid blocking calls to `Serial.write()`, you can first check the amount of free space in the transmit buffer using link:../availableforwrite[availableForWrite()]. -- // HOW TO USE SECTION ENDS diff --git a/Language/Functions/Communication/Wire.adoc b/Language/Functions/Communication/Wire.adoc index 8607a3e40..26c3e6df2 100644 --- a/Language/Functions/Communication/Wire.adoc +++ b/Language/Functions/Communication/Wire.adoc @@ -16,7 +16,7 @@ subCategories: [ "Communication" ] === Description -This library allows you to communicate with I2C/TWI devices. On the Arduino boards with the R3 layout (1.0 pinout), the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. The Arduino Due has two I2C/TWI interfaces SDA1 and SCL1 are near to the AREF pin and the additional one is on pins 20 and 21. +This library allows you to communicate with I2C/TWI devices. On the Arduino boards with the R3 layout, the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. The Arduino Due has two I2C/TWI interfaces SDA1 and SCL1 are near to the AREF pin and the additional one is on pins 20 and 21. As a reference the table below shows where TWI pins are located on various Arduino boards. @@ -36,7 +36,7 @@ As a reference the table below shows where TWI pins are located on various Ardui |=== -As of Arduino 1.0, the library inherits from the Stream functions, making it consistent with other read/write libraries. Because of this, `send()` and `receive()` have been replaced with `read()` and `write()`. +This library inherits from the Stream functions, making it consistent with other read/write libraries. Because of this, `send()` and `receive()` have been replaced with `read()` and `write()`. Recent versions of the Wire library can use timeouts to prevent a lockup in the face of certain problems on the bus, but this is not enabled by default (yet) in current versions. It is recommended to always enable these timeouts when using the Wire library. See the Wire.setWireTimeout function for more details. diff --git a/Language/Functions/Communication/Wire/endTransmission.adoc b/Language/Functions/Communication/Wire/endTransmission.adoc index 2040ca993..5687ed70a 100644 --- a/Language/Functions/Communication/Wire/endTransmission.adoc +++ b/Language/Functions/Communication/Wire/endTransmission.adoc @@ -10,7 +10,7 @@ title: endTransmission() [float] === Description -This function ends a transmission to a peripheral device that was begun by `beginTransmission()` and transmits the bytes that were queued by `write()`. As of Arduino 1.0.1, `endTransmission()` accepts a boolean argument changing its behavior for compatibility with certain I2C devices. If true, `endTransmission()` sends a stop message after transmission, releasing the I2C bus. If false, `endTransmission()` sends a restart message after transmission. The bus will not be released, which prevents another controller device from transmitting between messages. This allows one controller device to send multiple transmissions while in control. The default value is true. +This function ends a transmission to a peripheral device that was begun by `beginTransmission()` and transmits the bytes that were queued by `write()`. The `endTransmission()` method accepts a boolean argument changing its behavior for compatibility with certain I2C devices. If true, `endTransmission()` sends a stop message after transmission, releasing the I2C bus. If false, `endTransmission()` sends a restart message after transmission. The bus will not be released, which prevents another controller device from transmitting between messages. This allows one controller device to send multiple transmissions while in control. The default value is true. [float] === Syntax diff --git a/Language/Functions/Communication/Wire/requestFrom.adoc b/Language/Functions/Communication/Wire/requestFrom.adoc index ca9f2a441..342dc54da 100644 --- a/Language/Functions/Communication/Wire/requestFrom.adoc +++ b/Language/Functions/Communication/Wire/requestFrom.adoc @@ -11,7 +11,7 @@ title: requestFrom() [float] === Description -This function is used by the controller device to request bytes from a peripheral device. The bytes may then be retrieved with the `available()` and `read()` functions. As of Arduino 1.0.1, `requestFrom()` accepts a boolean argument changing its behavior for compatibility with certain I2C devices. If true, `requestFrom()` sends a stop message after the request, releasing the I2C bus. If false, `requestFrom()` sends a restart message after the request. The bus will not be released, which prevents another master device from requesting between messages. This allows one master device to send multiple requests while in control. The default value is true. +This function is used by the controller device to request bytes from a peripheral device. The bytes may then be retrieved with the `available()` and `read()` functions. The `requestFrom()` method accepts a boolean argument changing its behavior for compatibility with certain I2C devices. If true, `requestFrom()` sends a stop message after the request, releasing the I2C bus. If false, `requestFrom()` sends a restart message after the request. The bus will not be released, which prevents another master device from requesting between messages. This allows one master device to send multiple requests while in control. The default value is true. [float] === Syntax diff --git a/Language/Functions/Digital IO/pinMode.adoc b/Language/Functions/Digital IO/pinMode.adoc index 882e8c221..46daae777 100644 --- a/Language/Functions/Digital IO/pinMode.adoc +++ b/Language/Functions/Digital IO/pinMode.adoc @@ -19,7 +19,7 @@ subCategories: [ "Digital I/O" ] === Description Configures the specified pin to behave either as an input or an output. See the http://arduino.cc/en/Tutorial/DigitalPins[Digital Pins] page for details on the functionality of the pins. [%hardbreaks] -As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode `INPUT_PULLUP`. Additionally, the `INPUT` mode explicitly disables the internal pullups. +It is possible to enable the internal pullup resistors with the mode `INPUT_PULLUP`. Additionally, the `INPUT` mode explicitly disables the internal pullups. [%hardbreaks] diff --git a/Language/Functions/Time/delayMicroseconds.adoc b/Language/Functions/Time/delayMicroseconds.adoc index 2c5b02677..7b57914da 100644 --- a/Language/Functions/Time/delayMicroseconds.adoc +++ b/Language/Functions/Time/delayMicroseconds.adoc @@ -73,8 +73,6 @@ void loop() { === Notes and Warnings This function works very accurately in the range 3 microseconds and up to 16383. We cannot assure that delayMicroseconds will perform precisely for smaller delay-times. Larger delay times may actually delay for an extremely brief time. -As of Arduino 0018, delayMicroseconds() no longer disables interrupts. - -- // HOW TO USE SECTION ENDS diff --git a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc index 9fe9a2fb5..2d1ba3b57 100644 --- a/Language/Variables/Data Types/String/Functions/toLowerCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toLowerCase.adoc @@ -17,7 +17,7 @@ subCategories: [ "StringObject Function" ] [float] === Description -Get a lower-case version of a String. As of 1.0, toLowerCase() modifies the String in place rather than returning a new one. +Get a lower-case version of a String. The `toLowerCase()` function modifies the String in place rather than returning a new one. [%hardbreaks] diff --git a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc index 81ef0dd79..231dcc27c 100644 --- a/Language/Variables/Data Types/String/Functions/toUpperCase.adoc +++ b/Language/Variables/Data Types/String/Functions/toUpperCase.adoc @@ -17,7 +17,7 @@ subCategories: [ "StringObject Function" ] [float] === Description -Get an upper-case version of a String. As of 1.0, toUpperCase() modifies the String in place rather than returning a new one. +Get an upper-case version of a String. The `toUpperCase()` modifies the String in place rather than returning a new one. [%hardbreaks] diff --git a/Language/Variables/Data Types/String/Functions/trim.adoc b/Language/Variables/Data Types/String/Functions/trim.adoc index f5a3fb27d..3714c4f87 100644 --- a/Language/Variables/Data Types/String/Functions/trim.adoc +++ b/Language/Variables/Data Types/String/Functions/trim.adoc @@ -17,7 +17,7 @@ subCategories: [ "StringObject Function" ] [float] === Description -Get a version of the String with any leading and trailing whitespace removed. As of 1.0, trim() modifies the String in place rather than returning a new one. +Get a version of the String with any leading and trailing whitespace removed. The `trim()` function modifies the String in place rather than returning a new one. [%hardbreaks] diff --git a/Language/Variables/Data Types/string.adoc b/Language/Variables/Data Types/string.adoc index c19ab743e..29d4f97ad 100644 --- a/Language/Variables/Data Types/string.adoc +++ b/Language/Variables/Data Types/string.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -Text strings can be represented in two ways. you can use the String data type, which is part of the core as of version 0019, or you can make a string out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the link:../stringobject[String object] page. +Text strings can be represented in two ways. you can use the String data type, or you can make a string out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the link:../stringobject[String object] page. [%hardbreaks] [float] From 1198f472e07ed8384e5d6e274e94a09435e7319e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 22 Nov 2023 16:18:54 +0100 Subject: [PATCH 261/298] Update Language/Variables/Utilities/PROGMEM.adoc Co-authored-by: Edgar Bonet --- Language/Variables/Utilities/PROGMEM.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index e7c4dbc1c..667135086 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -30,7 +30,7 @@ Using `PROGMEM` is a two-step procedure. Once a variable has been defined with ` ==== Important Note! -`PROGMEM` is useful _only_ when working with AVR boards (Uno Rev3, Leonardo etc.). Newer boards (Due, MKR WiFi 1010, GIGA R1 WiFi etc.), automatically uses the program space when a variable is declared as a `const`. However, for retro compatibility, `PROGMEM` can still be used with newer boards. This implementation currently lives link:https://github.com/arduino/ArduinoCore-API/blob/master/api/deprecated-avr-comp/avr/pgmspace.h[here]. +`PROGMEM` is useful _only_ when working with AVR boards (Uno Rev3, Leonardo etc.). Newer boards (Due, MKR WiFi 1010, GIGA R1 WiFi etc.) automatically use the program space when a variable is declared as a `const`. However, for retro compatibility, `PROGMEM` can still be used with newer boards. This implementation currently lives link:https://github.com/arduino/ArduinoCore-API/blob/master/api/deprecated-avr-comp/avr/pgmspace.h[here]. [%hardbreaks] From 7672cd6623d8bb209bef50b8a97ff14f7414377c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 22 Nov 2023 17:06:12 +0100 Subject: [PATCH 262/298] Update PROGMEM.adoc --- Language/Variables/Utilities/PROGMEM.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Utilities/PROGMEM.adoc b/Language/Variables/Utilities/PROGMEM.adoc index 667135086..0728741c6 100644 --- a/Language/Variables/Utilities/PROGMEM.adoc +++ b/Language/Variables/Utilities/PROGMEM.adoc @@ -22,7 +22,7 @@ Keep constant data in flash (program) memory only, instead of copying it to SRAM The `PROGMEM` keyword is a variable modifier, it should be used only with the datatypes defined in pgmspace.h. It tells the compiler "keep this information in flash memory only", instead of copying it to SRAM at start up, like it would normally do. -PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in modern versions of the IDE. +PROGMEM is part of the link:http://www.nongnu.org/avr-libc/user-manual/group\__avr__pgmspace.html[pgmspace.h] library. It is included automatically in the Arduino IDE. While `PROGMEM` could be used on a single variable, it is really only worth the fuss if you have a larger block of data that needs to be stored, which is usually easiest in an array, (or another C++ data structure beyond our present discussion). From e8c05b8aed71bb9cb89472af87f7b18a62102cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BenjaminDanneg=C3=A5rd?= Date: Mon, 27 Nov 2023 11:26:11 +0100 Subject: [PATCH 263/298] Added table --- Language/Functions/Communication/SPI.adoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index 005f765dc..d7ec8c9cd 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -27,6 +27,22 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le -- // OVERVIEW SECTION ENDS +// HOW TO USE SECTION STARTS +[#howtouse] +-- +|================================================================================================================================================ +| Boards | SPI Pins | SPI Headers | +| Leonardo, UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd, UNO R4 Minima, UNO R4 WiFi, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | +| Micro | 14(CIPO), 15(SCK), 16(COPI) | | +| Nano boards | 11(COPI), 12(CIPO), 13(SCK) | | +| MKR boards | 8(COPI), 9(SCK), 10(CIPO) | | +| Due | | 74(CIPO), 75(MOSI), 76(SCK) | +| GIGA R1 WiFi | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | 89(CIPO), 90(COPI), 91(SCK) | +| Mega 2560 Rev3 | | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | +|================================================================================================================================================ + +-- +// HOW TO USE SECTION ENDS // FUNCTIONS SECTION STARTS [#functions] From f1de0ea6350a587f339ceb28bd7a7bf20af6cad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:26:57 +0100 Subject: [PATCH 264/298] revision of benjis draft --- Language/Variables/Constants/highLow.adoc | 61 ++++++++++++++++ .../Constants/inputOutputPullup.adoc | 73 +++++++++++++++++++ Language/Variables/Constants/ledbuiltin.adoc | 31 ++++++++ Language/Variables/Constants/trueFalse.adoc | 47 ++++++++++++ 4 files changed, 212 insertions(+) create mode 100644 Language/Variables/Constants/highLow.adoc create mode 100644 Language/Variables/Constants/inputOutputPullup.adoc create mode 100644 Language/Variables/Constants/ledbuiltin.adoc create mode 100644 Language/Variables/Constants/trueFalse.adoc diff --git a/Language/Variables/Constants/highLow.adoc b/Language/Variables/Constants/highLow.adoc new file mode 100644 index 000000000..f7d84a9ae --- /dev/null +++ b/Language/Variables/Constants/highLow.adoc @@ -0,0 +1,61 @@ +--- +title: HIGH | LOW +categories: [ "Variables" ] +subCategories: [ "Constants" ] +--- + += HIGH | LOW + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +== Defining Pin Levels: HIGH and LOW +When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: `HIGH` and `LOW`. These are the same as `true` and `false`, as well as `0` and `1`. + +[float] +=== HIGH +The meaning of `HIGH` (in reference to a pin) is somewhat different depending on whether a pin is set to an `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with `link:../../../functions/digital-io/pinmode[pinMode()]`, and read with `link:../../../functions/digital-io/digitalread[digitalRead()]`, the Arduino (ATmega) will report `HIGH` if: + + - a voltage greater than 3.0V is present at the pin (5V boards) + - a voltage greater than 2.0V is present at the pin (3.3V boards) +[%hardbreaks] + +A pin may also be configured as an INPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and subsequently made HIGH with `link:../../../functions/digital-io/digitalwrite[digitalWrite()]`. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can be done alternatively by passing `INPUT_PULLUP` as argument to the link:../../../functions/digital-io/pinmode[`pinMode()`] function, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. +[%hardbreaks] + +When a pin is configured to OUTPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and set to `HIGH` with link:../../../functions/digital-io/digitalwrite[`digitalWrite()`], the pin is at: + + - 5 volts (5V boards) + - 3.3 volts (3.3V boards) + +In this state it can source current, e.g. light an LED that is connected through a series resistor to ground. +[%hardbreaks] + +[float] +=== LOW + +The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (ATmega) will report LOW if: + +a voltage less than 1.5V is present at the pin (5V boards) + +a voltage less than 1.0V (Approx) is present at the pin (3.3V boards) + +When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWrite(), the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts). + +-- +// OVERVIEW SECTION ENDS + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Constants/inputOutputPullup.adoc b/Language/Variables/Constants/inputOutputPullup.adoc new file mode 100644 index 000000000..5cf653401 --- /dev/null +++ b/Language/Variables/Constants/inputOutputPullup.adoc @@ -0,0 +1,73 @@ +--- +title: INPUT | INPUT_PULLUP | OUTPUT +categories: [ "Variables" ] +subCategories: [ "Constants" ] +--- + += INPUT | INPUT_PULLUP | OUTPUT + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +== Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT +Digital pins can be used as `INPUT`, `INPUT_PULLUP`, or `OUTPUT`. Changing a pin with link:../../../functions/digital-io/pinmode[`pinMode()`] changes the electrical behavior of the pin. + +-- +// OVERVIEW SECTION ENDS + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + +[float] +=== INPUT +Arduino (ATmega) pins configured as `INPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`] are said to be in a _high-impedance_ state. Pins configured as `INPUT` make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor. +[%hardbreaks] + +If you have your pin configured as an `INPUT`, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not draw too much current when the switch is closed. See the http://arduino.cc/en/Tutorial/DigitalReadSerial[Digital Read Serial^] tutorial for more information. +[%hardbreaks] + +If a pull-down resistor is used, the input pin will be `LOW` when the switch is open and `HIGH` when the switch is closed. +[%hardbreaks] + +If a pull-up resistor is used, the input pin will be `HIGH` when the switch is open and `LOW` when the switch is closed. +[%hardbreaks] + +[float] +=== INPUT_PULLUP +The ATmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the `INPUT_PULLUP` argument in link:../../../functions/digital-io/pinmode[`pinMode()`]. +[%hardbreaks] + +See the http://arduino.cc/en/Tutorial/InputPullupSerial[Input Pullup Serial^] tutorial for an example of this in use. +[%hardbreaks] + +Pins configured as inputs with either `INPUT` or `INPUT_PULLUP` can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V). +[%hardbreaks] + +[float] +=== OUTPUT +Pins configured as `OUTPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`] are said to be in a _low-impedance_ state. This means that they can provide a substantial amount of current to other circuits. ATmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry. +[%hardbreaks] + +Pins configured as outputs can be damaged or destroyed if they are connected to either the ground or positive power rails. +[%hardbreaks] + + +-- +// HOW TO USE SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Constants/ledbuiltin.adoc b/Language/Variables/Constants/ledbuiltin.adoc new file mode 100644 index 000000000..7ff780510 --- /dev/null +++ b/Language/Variables/Constants/ledbuiltin.adoc @@ -0,0 +1,31 @@ +--- +title: LED_BUILTIN +categories: [ "Variables" ] +subCategories: [ "Constants" ] +--- + += LED_BUILTIN + +// OVERVIEW SECTION STARTS +[#overview] +-- + +[float] +== Defining built-ins: LED_BUILTIN +Most Arduino boards have a pin connected to an on-board LED in series with a resistor. The constant `LED_BUILTIN` is the number of the pin to which the on-board LED is connected. Most boards have this LED connected to digital pin 13. + +-- +// OVERVIEW SECTION ENDS + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS \ No newline at end of file diff --git a/Language/Variables/Constants/trueFalse.adoc b/Language/Variables/Constants/trueFalse.adoc new file mode 100644 index 000000000..fe260f872 --- /dev/null +++ b/Language/Variables/Constants/trueFalse.adoc @@ -0,0 +1,47 @@ +--- +title: 'true | false' +categories: [ "Variables" ] +subCategories: [ "Constants" ] +--- + += true | false + +// OVERVIEW SECTION STARTS +[#overview] +-- + +There are two constants used to represent truth and falsity in the Arduino language: `true`, and `false`. + +[float] +=== true +`true` is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. +[%hardbreaks] + +Note that the `true` and `false` constants are typed in lowercase unlike `HIGH`, `LOW`, `INPUT`, and `OUTPUT`. +[%hardbreaks] + + +[float] +=== false +`false` is the easier of the two to define. false is defined as 0 (zero). +[%hardbreaks] + +Note that the `true` and `false` constants are typed in lowercase unlike `HIGH`, `LOW`, `INPUT`, and `OUTPUT`. +[%hardbreaks] + +-- +// OVERVIEW SECTION ENDS + + + +// SEE ALSO SECTION BEGINS +[#see_also] +-- + +[float] +=== See also + +[role="language"] + +-- +// SEE ALSO SECTION ENDS \ No newline at end of file From 06fce54965e22fbf16278ba12b4b92815eb2ce01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:28:14 +0100 Subject: [PATCH 265/298] Delete constants.adoc --- Language/Variables/Constants/constants.adoc | 131 -------------------- 1 file changed, 131 deletions(-) delete mode 100644 Language/Variables/Constants/constants.adoc diff --git a/Language/Variables/Constants/constants.adoc b/Language/Variables/Constants/constants.adoc deleted file mode 100644 index 05f137654..000000000 --- a/Language/Variables/Constants/constants.adoc +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: constants -categories: [ "Variables" ] -subCategories: [ "Constants" ] ---- - -= Constants - - -// OVERVIEW SECTION STARTS -[#overview] --- - -[float] -== Description -Constants are predefined expressions in the Arduino language. They are used to make the programs easier to read. We classify constants in groups: - -[float] -== Defining Logical Levels: true and false (Boolean Constants) -There are two constants used to represent truth and falsity in the Arduino language: `true`, and `false`. - -[float] -=== false -`false` is the easier of the two to define. false is defined as 0 (zero). -[%hardbreaks] - -[float] -=== true -`true` is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. -[%hardbreaks] - -Note that the `true` and `false` constants are typed in lowercase unlike `HIGH`, `LOW`, `INPUT`, and `OUTPUT`. -[%hardbreaks] - -[float] -== Defining Pin Levels: HIGH and LOW -When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: `HIGH` and `LOW`. - -[float] -=== HIGH -The meaning of `HIGH` (in reference to a pin) is somewhat different depending on whether a pin is set to an `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with `link:../../../functions/digital-io/pinmode[pinMode()]`, and read with `link:../../../functions/digital-io/digitalread[digitalRead()]`, the Arduino (ATmega) will report `HIGH` if: - - - a voltage greater than 3.0V is present at the pin (5V boards) - - a voltage greater than 2.0V is present at the pin (3.3V boards) -[%hardbreaks] - -A pin may also be configured as an INPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and subsequently made HIGH with `link:../../../functions/digital-io/digitalwrite[digitalWrite()]`. This will enable the internal 20K pullup resistors, which will _pull up_ the input pin to a `HIGH` reading unless it is pulled `LOW` by external circuitry. This can be done alternatively by passing `INPUT_PULLUP` as argument to the link:../../../functions/digital-io/pinmode[`pinMode()`] function, as explained in more detail in the section "Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT" further below. -[%hardbreaks] - -When a pin is configured to OUTPUT with link:../../../functions/digital-io/pinmode[`pinMode()`], and set to `HIGH` with link:../../../functions/digital-io/digitalwrite[`digitalWrite()`], the pin is at: - - - 5 volts (5V boards) - - 3.3 volts (3.3V boards) - -In this state it can source current, e.g. light an LED that is connected through a series resistor to ground. -[%hardbreaks] - -[float] -=== LOW -The meaning of `LOW` also has a different meaning depending on whether a pin is set to `INPUT` or `OUTPUT`. When a pin is configured as an `INPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`], and read with link:../../../functions/digital-io/digitalread[`digitalRead()`], the Arduino (ATmega) will report LOW if: - - - a voltage less than 1.5V is present at the pin (5V boards) - - a voltage less than 1.0V (Approx) is present at the pin (3.3V boards) - -When a pin is configured to `OUTPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`], and set to `LOW` with link:../../../functions/digital-io/digitalwrite[`digitalWrite()`], the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts). -[%hardbreaks] - -[float] -== Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT -Digital pins can be used as `INPUT`, `INPUT_PULLUP`, or `OUTPUT`. Changing a pin with link:../../../functions/digital-io/pinmode[`pinMode()`] changes the electrical behavior of the pin. - -[float] -=== Pins Configured as INPUT -Arduino (ATmega) pins configured as `INPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`] are said to be in a _high-impedance_ state. Pins configured as `INPUT` make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor. -[%hardbreaks] - -If you have your pin configured as an `INPUT`, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not draw too much current when the switch is closed. See the http://arduino.cc/en/Tutorial/DigitalReadSerial[Digital Read Serial^] tutorial for more information. -[%hardbreaks] - -If a pull-down resistor is used, the input pin will be `LOW` when the switch is open and `HIGH` when the switch is closed. -[%hardbreaks] - -If a pull-up resistor is used, the input pin will be `HIGH` when the switch is open and `LOW` when the switch is closed. -[%hardbreaks] - -[float] -=== Pins Configured as INPUT_PULLUP -The ATmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the `INPUT_PULLUP` argument in link:../../../functions/digital-io/pinmode[`pinMode()`]. -[%hardbreaks] - -See the http://arduino.cc/en/Tutorial/InputPullupSerial[Input Pullup Serial^] tutorial for an example of this in use. -[%hardbreaks] - -Pins configured as inputs with either `INPUT` or `INPUT_PULLUP` can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V). -[%hardbreaks] - -[float] -=== Pins Configured as OUTPUT -Pins configured as `OUTPUT` with link:../../../functions/digital-io/pinmode[`pinMode()`] are said to be in a _low-impedance_ state. This means that they can provide a substantial amount of current to other circuits. ATmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry. -[%hardbreaks] - -Pins configured as outputs can be damaged or destroyed if they are connected to either the ground or positive power rails. -[%hardbreaks] - -[float] -== Defining built-ins: LED_BUILTIN -Most Arduino boards have a pin connected to an on-board LED in series with a resistor. The constant `LED_BUILTIN` is the number of the pin to which the on-board LED is connected. Most boards have this LED connected to digital pin 13. - --- -// OVERVIEW SECTION ENDS - - - -// HOW TO USE SECTION STARTS -[#howtouse] --- - --- -// HOW TO USE SECTION ENDS - -// SEE ALSO SECTION BEGINS -[#see_also] --- - -[float] -=== See also - -[role="language"] - --- -// SEE ALSO SECTION ENDS From c3733c89ba7c0bb60f78fc19b4f202d0ca2517fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:32:44 +0100 Subject: [PATCH 266/298] Constant Link fixes --- Language/Functions/Advanced IO/pulseIn.adoc | 2 +- Language/Functions/Advanced IO/pulseInLong.adoc | 2 +- Language/Structure/Control Structure/doWhile.adoc | 2 +- Language/Structure/Control Structure/for.adoc | 4 ++-- Language/Structure/Further Syntax/define.adoc | 1 - Language/Variables/Data Types/bool.adoc | 4 +--- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Language/Functions/Advanced IO/pulseIn.adoc b/Language/Functions/Advanced IO/pulseIn.adoc index 1a34dc93e..5252f6814 100644 --- a/Language/Functions/Advanced IO/pulseIn.adoc +++ b/Language/Functions/Advanced IO/pulseIn.adoc @@ -34,7 +34,7 @@ NOTE: if the optional timeout is used code will execute faster. [float] === Parameters `pin`: the number of the Arduino pin on which you want to read the pulse. Allowed data types: `int`. + -`value`: type of pulse to read: either link:../../../variables/constants/constants[HIGH] or link:../../../variables/constants/constants[LOW]. Allowed data types: `int`. + +`value`: type of pulse to read: either link:../../../variables/constants/highlow/[HIGH] or link:../../../variables/constants/highlow/[LOW]. Allowed data types: `int`. + `timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. diff --git a/Language/Functions/Advanced IO/pulseInLong.adoc b/Language/Functions/Advanced IO/pulseInLong.adoc index 2517f6533..1fdc88a1c 100644 --- a/Language/Functions/Advanced IO/pulseInLong.adoc +++ b/Language/Functions/Advanced IO/pulseInLong.adoc @@ -34,7 +34,7 @@ The timing of this function has been determined empirically and will probably sh [float] === Parameters `pin`: the number of the Arduino pin on which you want to read the pulse. Allowed data types: `int`. + -`value`: type of pulse to read: either link:../../../variables/constants/constants[HIGH] or link:../../../variables/constants/constants[LOW]. Allowed data types: `int`. + +`value`: type of pulse to read: either link:../../../variables/constants/highlow/[HIGH] or link:../../../variables/constants/highlow/[LOW]. Allowed data types: `int`. + `timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second. Allowed data types: `unsigned long`. diff --git a/Language/Structure/Control Structure/doWhile.adoc b/Language/Structure/Control Structure/doWhile.adoc index 8651f957e..033d32b9c 100644 --- a/Language/Structure/Control Structure/doWhile.adoc +++ b/Language/Structure/Control Structure/doWhile.adoc @@ -32,7 +32,7 @@ do { [float] === Parameters -`condition`: a boolean expression that evaluates to `link:../../../variables/constants/constants[true]` or `link:../../../variables/constants/constants[false]`. +`condition`: a boolean expression that evaluates to `link:../../../variables/constants/truefalse[true]` or `link:../../../variables/constants/truefalse[false]`. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index 7e02a21f7..533ce1079 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -34,8 +34,8 @@ for (initialization; condition; increment) { [float] === Parameters `initialization`: happens first and exactly once. + -`condition`: each time through the loop, `condition` is tested; if it's `link:../../../variables/constants/constants[true]`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `link:../../../variables/constants/constants[false]`, the loop ends. + -`increment`: executed each time through the loop when `condition` is link:../../../variables/constants/constants[`true`]. +`condition`: each time through the loop, `condition` is tested; if it's `link:../../../variables/constants/truefalse[true]`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `link:../../../variables/constants/truefalse[false]`, the loop ends. + +`increment`: executed each time through the loop when `condition` is link:../../../variables/constants/truefalse[`true`]. -- // OVERVIEW SECTION ENDS diff --git a/Language/Structure/Further Syntax/define.adoc b/Language/Structure/Further Syntax/define.adoc index 99c197705..c04df008f 100644 --- a/Language/Structure/Further Syntax/define.adoc +++ b/Language/Structure/Further Syntax/define.adoc @@ -89,7 +89,6 @@ Similarly, including an equal sign after the #define statement will also generat [role="language"] * #LANGUAGE# link:../../../variables/variable-scope-qualifiers/const[const] -* #LANGUAGE# link:../../../variables/constants/constants[Constants] -- // SEE ALSO SECTION ENDS diff --git a/Language/Variables/Data Types/bool.adoc b/Language/Variables/Data Types/bool.adoc index 6145dab3a..b6e0cb199 100644 --- a/Language/Variables/Data Types/bool.adoc +++ b/Language/Variables/Data Types/bool.adoc @@ -12,7 +12,7 @@ subCategories: [ "Data Types" ] [float] === Description -A `bool` holds one of two values, `link:../../constants/constants[true]` or `link:../../constants/constants[false]`. (Each `bool` variable occupies one byte of memory.) +A `bool` holds one of two values, `link:../../constants/truefalse[true]` or `link:../../constants/truefalse[false]`. (Each `bool` variable occupies one byte of memory.) [%hardbreaks] @@ -77,8 +77,6 @@ void loop() { [float] === See also -[role="language"] -* #LANGUAGE# link:../../../variables/constants/constants[constants] -- // SEE ALSO SECTION ENDS From 573e220457fbcb397c817d26bfa16f4652cacef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:55:40 +0100 Subject: [PATCH 267/298] Apply suggestions from code review --- Language/Functions/Communication/SPI.adoc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index d7ec8c9cd..34fdb9766 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -32,13 +32,15 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le -- |================================================================================================================================================ | Boards | SPI Pins | SPI Headers | -| Leonardo, UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd, UNO R4 Minima, UNO R4 WiFi, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | +| UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | +| UNO R4 Minima, UNO R4 WiFi| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | +| Leonardo, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | | Micro | 14(CIPO), 15(SCK), 16(COPI) | | | Nano boards | 11(COPI), 12(CIPO), 13(SCK) | | | MKR boards | 8(COPI), 9(SCK), 10(CIPO) | | -| Due | | 74(CIPO), 75(MOSI), 76(SCK) | +| Due | 74(CIPO), 75(MOSI), 76(SCK) | | | GIGA R1 WiFi | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | 89(CIPO), 90(COPI), 91(SCK) | -| Mega 2560 Rev3 | | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | +| Mega 2560 Rev3 | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | | |================================================================================================================================================ -- From dfc40bc9beba8b7f74597b7e33f27fcf67960730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:55:47 +0100 Subject: [PATCH 268/298] Update Language/Functions/Communication/SPI.adoc --- Language/Functions/Communication/SPI.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index 34fdb9766..f5c9521cc 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -31,7 +31,7 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le [#howtouse] -- |================================================================================================================================================ -| Boards | SPI Pins | SPI Headers | +| Boards | Default SPI Pins | Additonal SPI Pins | | UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | | UNO R4 Minima, UNO R4 WiFi| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | | Leonardo, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | From 70f7b9c5835ff8288d3cce1d298214fd9b055e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:57:27 +0100 Subject: [PATCH 269/298] Update Language/Functions/Communication/SPI.adoc --- Language/Functions/Communication/SPI.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index f5c9521cc..364cbfb37 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -39,7 +39,7 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le | Nano boards | 11(COPI), 12(CIPO), 13(SCK) | | | MKR boards | 8(COPI), 9(SCK), 10(CIPO) | | | Due | 74(CIPO), 75(MOSI), 76(SCK) | | -| GIGA R1 WiFi | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | 89(CIPO), 90(COPI), 91(SCK) | +| GIGA R1 WiFi | 89(CIPO), 90(COPI), 91(SCK) | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | | Mega 2560 Rev3 | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | | |================================================================================================================================================ From 7fff021eb2c94244d84ee21df50f1a7923d5dd2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 28 Nov 2023 16:01:05 +0100 Subject: [PATCH 270/298] Apply suggestions from code review --- Language/Functions/Communication/SPI.adoc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index 364cbfb37..d99d60d29 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -31,16 +31,16 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le [#howtouse] -- |================================================================================================================================================ -| Boards | Default SPI Pins | Additonal SPI Pins | -| UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | -| UNO R4 Minima, UNO R4 WiFi| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | -| Leonardo, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | +| Boards | Default SPI Pins | Additonal SPI Pins | Notes | +| UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | +| UNO R4 Minima, UNO R4 WiFi| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | +| Leonardo, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | | Micro | 14(CIPO), 15(SCK), 16(COPI) | | | Nano boards | 11(COPI), 12(CIPO), 13(SCK) | | | MKR boards | 8(COPI), 9(SCK), 10(CIPO) | | -| Due | 74(CIPO), 75(MOSI), 76(SCK) | | -| GIGA R1 WiFi | 89(CIPO), 90(COPI), 91(SCK) | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | -| Mega 2560 Rev3 | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | | +| Due | 74(CIPO), 75(MOSI), 76(SCK) | SPI pins available on dedicated SPI header | | +| GIGA R1 WiFi | 89(CIPO), 90(COPI), 91(SCK) | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | Note that pin 89,90,91 are located on the SPI header | +| Mega 2560 Rev3 | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | | SPI pins available on ICSP header | |================================================================================================================================================ -- From 960185a0db61055836e8a10619be2adb45497b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BenjaminDanneg=C3=A5rd?= Date: Thu, 30 Nov 2023 01:34:44 +0100 Subject: [PATCH 271/298] Updated list --- Language/Functions/Communication/Serial.adoc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Language/Functions/Communication/Serial.adoc b/Language/Functions/Communication/Serial.adoc index 21fb67ce1..1f2b05b35 100644 --- a/Language/Functions/Communication/Serial.adoc +++ b/Language/Functions/Communication/Serial.adoc @@ -18,16 +18,23 @@ subCategories: [ "Communication" ] === Description Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART), and some have several. [options="header"] + |================================================================================================================================================ | Board | USB CDC name | Serial pins | Serial1 pins | Serial2 pins | Serial3 pins -| Uno, Nano, Mini | | 0(RX), 1(TX) | | | -| Mega | | 0(RX), 1(TX) | 19(RX), 18(TX) | 17(RX), 16(TX) | 15(RX), 14(TX) -| Leonardo, Micro, Yún | Serial | | 0(RX), 1(TX) | | +| UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd, Mini| | | 0(RX), 1(TX) | | +| UNO R4 Minima, UNO R4 WiFi| | 18(RX), 17(TX) | | | +| Leonardo, Micro, Yún Rev2| Serial | | 0(RX), 1(TX) | | | Uno WiFi Rev.2 | | Connected to USB | 0(RX), 1(TX) | Connected to NINA | -| MKR boards | Serial | | 13(RX), 14(TX) | | -| Zero | SerialUSB (Native USB Port only) | Connected to Programming Port | 0(RX), 1(TX) | | +| Nano ESP32 | | 14(RX), 15(TX) | | | +| Nano 33 BLE, Nano 33 BLE Sense, Nano 33 BLE Sense Rev2, Nano 33 IoT, Nano Every | | 17(RX), 16(TX) | | | +| Nano RP2040 Connect, Nano | | 2(RX), 1(TX) | | | +| MKR boards | Serial | | 22(RX), 23(TX) | | +| MKR Zero | SerialUSB (Native USB Port only) | Connected to Programming Port | 0(RX), 1(TX) | | | Due | SerialUSB (Native USB Port only) | 0(RX), 1(TX) | 19(RX), 18(TX) | 17(RX), 16(TX) | 15(RX), 14(TX) | 101 | Serial | | 0(RX), 1(TX) | | +| GIGA R1 WiFi | | | 24(RX), 23(TX) | 22(RX), 21(TX) | 20(RX), 19(TX) +| Mega 2560 Rev3 | | 18(RX), 17(TX) | 24(RX), 23(TX) | 22(RX), 21(TX) | 20(RX), 19(TX) +| Mega | | 0(RX), 1(TX) | 19(RX), 18(TX) | 17(RX), 16(TX) | 15(RX), 14(TX) |================================================================================================================================================ On Uno, Nano, Mini, and Mega, pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board. From cb76050aa4b5ef046b7d141a741ce9b9abb20b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BenjaminDanneg=C3=A5rd?= Date: Thu, 30 Nov 2023 06:08:49 +0100 Subject: [PATCH 272/298] Added table for boards --- Language/Functions/Communication/Wire.adoc | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Language/Functions/Communication/Wire.adoc b/Language/Functions/Communication/Wire.adoc index 26c3e6df2..b9aa4c089 100644 --- a/Language/Functions/Communication/Wire.adoc +++ b/Language/Functions/Communication/Wire.adoc @@ -20,20 +20,18 @@ This library allows you to communicate with I2C/TWI devices. On the Arduino boar As a reference the table below shows where TWI pins are located on various Arduino boards. -[cols="1,1"] -|=== -|Board -|I2C/TWI pins - -|UNO, Ethernet -|A4 (SDA), A5 (SCL) - -|Mega2560 -|20 (SDA), 21 (SCL) - -|Leonardo -|20 (SDA), 21 (SCL), SDA1, SCL1 -|=== +|================================================================================================================================================ +| Board | I2C/TWI pins | +| UNO R3 | 13(SDA), 14(SCL) | +| UNO R3 SMD, UNO Mini Ltd | 18(SDA), 19(SCL) | +| UNO WiFi Rev2 | 20(SDA), 21(SCL) | +| UNO R4 Minima, UNO R4 WiFi | 2(SDA), 1(SCL) | +| Micro, Yún Rev2 | D2(SDA), D3(SCL) | +| Leonardo, GIGA R1 WiFi | 20(SDA), 21(SCL), SDA1, SCL1 | +| Nano boards | A4(SDA), A5(SCL) | +| MKR boards | D11(SDA), D12(SCL) | +| Due, MKR Zero, Mega, Mega 2560 Rev3 | D20(SDA), D21(SCL) | +|================================================================================================================================================ This library inherits from the Stream functions, making it consistent with other read/write libraries. Because of this, `send()` and `receive()` have been replaced with `read()` and `write()`. From 017eec0ac96b3ef9bd462c0122a4ab17681b1857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:04:52 +0100 Subject: [PATCH 273/298] Update Language/Functions/Bits and Bytes/bit.adoc --- Language/Functions/Bits and Bytes/bit.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bit.adoc b/Language/Functions/Bits and Bytes/bit.adoc index 6127e2802..3aaeda82b 100644 --- a/Language/Functions/Bits and Bytes/bit.adoc +++ b/Language/Functions/Bits and Bytes/bit.adoc @@ -28,7 +28,7 @@ Computes the value of the specified bit (bit 0 is 1, bit 1 is 2, bit 2 is 4, etc [float] === Parameters -`n`: the bit whose value to compute. 0 <= n < 32 (as it is intended to reflect the bits up to 31 of a uint32) +`n`: the bit whose value to compute. Note that `n` needs to be between 0-31 (32 bit). [float] From c3bfc047455251ae220c22f3bef7064a30d143e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:32:34 +0100 Subject: [PATCH 274/298] Update Language/Structure/Control Structure/for.adoc Co-authored-by: per1234 --- Language/Structure/Control Structure/for.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/for.adoc b/Language/Structure/Control Structure/for.adoc index 6724e1e58..d677f58ba 100644 --- a/Language/Structure/Control Structure/for.adoc +++ b/Language/Structure/Control Structure/for.adoc @@ -52,7 +52,7 @@ for (initialization; condition; increment) { [source,arduino] ---- // Brighten an LED using a PWM pin -int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10 +int PWMpin = 10; // LED in series with 470 ohm resistor from pin 10 to ground void setup() { // no setup needed From b6036005f1e78456bde723ec2cbef4cc209fb839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:03:00 +0100 Subject: [PATCH 275/298] Update Language/Functions/Communication/Wire.adoc --- Language/Functions/Communication/Wire.adoc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Language/Functions/Communication/Wire.adoc b/Language/Functions/Communication/Wire.adoc index b9aa4c089..f556e3310 100644 --- a/Language/Functions/Communication/Wire.adoc +++ b/Language/Functions/Communication/Wire.adoc @@ -21,16 +21,16 @@ This library allows you to communicate with I2C/TWI devices. On the Arduino boar As a reference the table below shows where TWI pins are located on various Arduino boards. |================================================================================================================================================ -| Board | I2C/TWI pins | -| UNO R3 | 13(SDA), 14(SCL) | -| UNO R3 SMD, UNO Mini Ltd | 18(SDA), 19(SCL) | -| UNO WiFi Rev2 | 20(SDA), 21(SCL) | -| UNO R4 Minima, UNO R4 WiFi | 2(SDA), 1(SCL) | -| Micro, Yún Rev2 | D2(SDA), D3(SCL) | -| Leonardo, GIGA R1 WiFi | 20(SDA), 21(SCL), SDA1, SCL1 | -| Nano boards | A4(SDA), A5(SCL) | -| MKR boards | D11(SDA), D12(SCL) | -| Due, MKR Zero, Mega, Mega 2560 Rev3 | D20(SDA), D21(SCL) | +| Board | I2C Default | I2C1 | I2C2 | Notes +| UNO R3, UNO R3 SMD, UNO Mini Ltd | A4(SDA), A5(SCL) | | | I2C also available on the SDA / SCL pins (digital header). +| UNO R4 Minima, UNO R4 WiFi | A4(SDA), A5(SCL) | Qwiic: D27(SDA), D26(SCL) | | I2C also available on the SDA / SCL pins (digital header). +| UNO WiFi Rev2, Zero | 20(SDA), 21(SCL) | | | +| Leonardo, Micro, Yùn Rev2 | D2(SDA), D3(SCL) | | | +| Nano boards | A4(SDA), A5(SCL) | | | +| MKR boards | D11(SDA), D12(SCL) | | | +| GIGA R1 WiFi | 20(SDA), 21(SCL) | D102(SDA1), D101 (SCL1) | D9(SDA2), D8 (SCL2) | Use `Wire1.begin()` for I2C1, and `Wire2.begin()` for I2C2. +| Due | 20(SDA), 21(SCL) | D70(SDA1), D71(SCL1) | | Use `Wire1.begin()` for I2C1 +| Mega 2560 Rev3 | D20(SDA), D21(SCL) | | | |================================================================================================================================================ From b4411d226a300eb930d72e94ea0d4396b8315451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 5 Dec 2023 13:20:43 +0100 Subject: [PATCH 276/298] Update Wire.adoc --- Language/Functions/Communication/Wire.adoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Wire.adoc b/Language/Functions/Communication/Wire.adoc index f556e3310..4aed17dc7 100644 --- a/Language/Functions/Communication/Wire.adoc +++ b/Language/Functions/Communication/Wire.adoc @@ -16,9 +16,10 @@ subCategories: [ "Communication" ] === Description -This library allows you to communicate with I2C/TWI devices. On the Arduino boards with the R3 layout, the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. The Arduino Due has two I2C/TWI interfaces SDA1 and SCL1 are near to the AREF pin and the additional one is on pins 20 and 21. +This library allows you to communicate with I2C devices, a feature that is present on all Arduino boards. I2C is a very common protocol, primarly used for reading/sending data to/from external I2C components. To learn more, visit link:https://docs.arduino.cc/learn/communication/wire[this article for Arduino & I2C]. + +Due to the hardware design and various architectural differences, the I2C pins are located in different places. The pin map just below highlights the default pins, as well as additional ports available on certain boards. -As a reference the table below shows where TWI pins are located on various Arduino boards. |================================================================================================================================================ | Board | I2C Default | I2C1 | I2C2 | Notes From e660fd9d5c7e4cf5a7dbb60f338a3740a9bbac66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:13:07 +0100 Subject: [PATCH 277/298] Update serialEvent.adoc --- Language/Functions/Communication/Serial/serialEvent.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index c1b4e8c11..584de8ec3 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -15,6 +15,8 @@ title: serialEvent() [float] === Description Called at the end of link:../../../../structure/sketch/loop[`loop()`] when data is available. Use `Serial.read()` to capture this data. + +*Please note:* most modern boards do not support this method. See "Notes and Warnings" further below this article. [%hardbreaks] @@ -63,11 +65,9 @@ Nothing [float] === Notes and Warnings -`serialEvent()` doesn't work on the Leonardo, Micro, or Yún. - -`serialEvent()` and `serialEvent1()` don't work on the Arduino SAMD Boards +Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 is the *UNO R3* and *Mega 2560 R3*, which are based on the ATmega328P chip. -`serialEvent()`, `serialEvent1()`, `serialEvent2()`, and `serialEvent3()` don't work on the Arduino Due. +Instead, you can use the link:../available[`available()`] method. Examples in this page demonstrates how to read serial data only when it is available, which is exactly what `Serial.event()` does. [%hardbreaks] -- From 1374589d76c48a956d7e604d539a36b27e96f2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:16:01 +0100 Subject: [PATCH 278/298] Update serialEvent.adoc --- Language/Functions/Communication/Serial/serialEvent.adoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index 584de8ec3..f6a7ebfa4 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -29,7 +29,9 @@ void serialEvent() { //statements } ---- -For boards with additional serial ports (see the list of available serial ports for each board on the link:../../serial[Serial main page]): + +The Mega 2560 R3 has additional serial ports which can be accessed by adding the corresponding number at the end of the function. + [source,arduino] ---- void serialEvent1() { @@ -65,7 +67,7 @@ Nothing [float] === Notes and Warnings -Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 is the *UNO R3* and *Mega 2560 R3*, which are based on the ATmega328P chip. +Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 is the *UNO R3* and *Mega 2560 R3*, which are based on the ATmega328P and ATmega2560 chips. Instead, you can use the link:../available[`available()`] method. Examples in this page demonstrates how to read serial data only when it is available, which is exactly what `Serial.event()` does. [%hardbreaks] From 6b28b9de8af38e487428e2d95d56cfd5b8aefa7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:32:56 +0100 Subject: [PATCH 279/298] Update serialEvent.adoc --- Language/Functions/Communication/Serial/serialEvent.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index f6a7ebfa4..547d06701 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -30,7 +30,7 @@ void serialEvent() { } ---- -The Mega 2560 R3 has additional serial ports which can be accessed by adding the corresponding number at the end of the function. +The Mega 2560 R3 and Due boards have additional serial ports which can be accessed by adding the corresponding number at the end of the function. [source,arduino] ---- @@ -67,9 +67,9 @@ Nothing [float] === Notes and Warnings -Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 is the *UNO R3* and *Mega 2560 R3*, which are based on the ATmega328P and ATmega2560 chips. +Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 is the *UNO R3*, *Mega 2560 R3* and *Due*. -Instead, you can use the link:../available[`available()`] method. Examples in this page demonstrates how to read serial data only when it is available, which is exactly what `Serial.event()` does. +Instead, you can use the link:../available[`available()`] method. Examples in this page demonstrates how to read serial data only when it is available, similarly to how `Serial.event()` is implemented. [%hardbreaks] -- From 193aba87f62aa5badfba8da5bba96366d9b64fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 6 Dec 2023 12:28:40 +0100 Subject: [PATCH 280/298] Serial Table update --- Language/Functions/Communication/Serial.adoc | 33 +++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/Language/Functions/Communication/Serial.adoc b/Language/Functions/Communication/Serial.adoc index 1f2b05b35..2342f7251 100644 --- a/Language/Functions/Communication/Serial.adoc +++ b/Language/Functions/Communication/Serial.adoc @@ -4,9 +4,6 @@ categories: [ "Functions" ] subCategories: [ "Communication" ] --- - - - = Serial() @@ -20,24 +17,22 @@ Used for communication between the Arduino board and a computer or other devices [options="header"] |================================================================================================================================================ -| Board | USB CDC name | Serial pins | Serial1 pins | Serial2 pins | Serial3 pins -| UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd, Mini| | | 0(RX), 1(TX) | | -| UNO R4 Minima, UNO R4 WiFi| | 18(RX), 17(TX) | | | -| Leonardo, Micro, Yún Rev2| Serial | | 0(RX), 1(TX) | | -| Uno WiFi Rev.2 | | Connected to USB | 0(RX), 1(TX) | Connected to NINA | -| Nano ESP32 | | 14(RX), 15(TX) | | | -| Nano 33 BLE, Nano 33 BLE Sense, Nano 33 BLE Sense Rev2, Nano 33 IoT, Nano Every | | 17(RX), 16(TX) | | | -| Nano RP2040 Connect, Nano | | 2(RX), 1(TX) | | | -| MKR boards | Serial | | 22(RX), 23(TX) | | -| MKR Zero | SerialUSB (Native USB Port only) | Connected to Programming Port | 0(RX), 1(TX) | | -| Due | SerialUSB (Native USB Port only) | 0(RX), 1(TX) | 19(RX), 18(TX) | 17(RX), 16(TX) | 15(RX), 14(TX) -| 101 | Serial | | 0(RX), 1(TX) | | -| GIGA R1 WiFi | | | 24(RX), 23(TX) | 22(RX), 21(TX) | 20(RX), 19(TX) -| Mega 2560 Rev3 | | 18(RX), 17(TX) | 24(RX), 23(TX) | 22(RX), 21(TX) | 20(RX), 19(TX) -| Mega | | 0(RX), 1(TX) | 19(RX), 18(TX) | 17(RX), 16(TX) | 15(RX), 14(TX) +| Board | Serial pins | Serial1 pins | Serial2 pins | Serial3 pins +| UNO R3, UNO R3 SMD Mini | 0(RX), 1(TX) | | | +| UNO R4 Minima, UNO R4 WiFi| 18(RX), 17(TX) | | | +| Leonardo, Micro, Yún Rev2 | 0(RX), 1(TX) | | | +| Uno WiFi Rev.2 | 0(RX), 1(TX) | | | +| 101 | 0(RX), 1(TX) | | | +| MKR boards | 13(RX), 14(TX) | | | +| Nano boards | 0(RX), 1(TX) | | | +| Zero | 0(RX), 1(TX) | | | +| Due | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) +| GIGA R1 WiFi | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) +| Mega 2560 Rev3 | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) |================================================================================================================================================ -On Uno, Nano, Mini, and Mega, pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board. + +On older boards (Uno, Nano, Mini, and Mega), pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board. [%hardbreaks] You can use the Arduino environment's built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to `begin()`. [%hardbreaks] From 7f80982a392ba130b6bfd6886c411a84ec64ffe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Wed, 6 Dec 2023 14:01:39 +0100 Subject: [PATCH 281/298] Update bitRead.adoc --- Language/Functions/Bits and Bytes/bitRead.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/Language/Functions/Bits and Bytes/bitRead.adoc b/Language/Functions/Bits and Bytes/bitRead.adoc index 4c4cb9346..53c190c6a 100644 --- a/Language/Functions/Bits and Bytes/bitRead.adoc +++ b/Language/Functions/Bits and Bytes/bitRead.adoc @@ -36,6 +36,7 @@ Reads a bit of a variable, e.g. `bool`, `int`. Note that `float` & `double` are === Returns The value of the bit (0 or 1). +[float] === Example Code This example code demonstrates how to read two variables, one increasing counter, one decreasing counter, and print out both the binary and decimal values of the variables. From 278a46aaf4a7d43322d25fc65f32bc2349390d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:09:58 +0100 Subject: [PATCH 282/298] Add Nano --- Language/Functions/Communication/Serial/serialEvent.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial/serialEvent.adoc b/Language/Functions/Communication/Serial/serialEvent.adoc index 547d06701..80475fe00 100644 --- a/Language/Functions/Communication/Serial/serialEvent.adoc +++ b/Language/Functions/Communication/Serial/serialEvent.adoc @@ -67,7 +67,7 @@ Nothing [float] === Notes and Warnings -Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 is the *UNO R3*, *Mega 2560 R3* and *Due*. +Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 are the *UNO R3*, *Nano*, *Mega 2560 R3* and *Due*. Instead, you can use the link:../available[`available()`] method. Examples in this page demonstrates how to read serial data only when it is available, similarly to how `Serial.event()` is implemented. [%hardbreaks] From 2ac5be01aa599a3f2e1a7721c8f94c77b7494777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:42:51 +0100 Subject: [PATCH 283/298] Apply suggestions from code review Co-authored-by: per1234 --- Language/Functions/Bits and Bytes/bitSet.adoc | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Language/Functions/Bits and Bytes/bitSet.adoc b/Language/Functions/Bits and Bytes/bitSet.adoc index 828daebf6..94c52a797 100644 --- a/Language/Functions/Bits and Bytes/bitSet.adoc +++ b/Language/Functions/Bits and Bytes/bitSet.adoc @@ -34,13 +34,23 @@ Sets (writes a 1 to) a bit of a numeric variable. [float] === Returns -x: the value of the numeric variable after the bit at position n is set. +`x`: the value of the numeric variable after the bit at position `n` is set. + +-- +// OVERVIEW SECTION ENDS + +// HOW TO USE SECTION STARTS +[#howtouse] +-- + [float] === Example Code -Prints the output of bitSet(x,n) on two given integers. The binary representation of 4 is 0100, so when n=1, the second bit from the right is set to 1. After this we are left with 0110 in binary, so 6 is returned. +Prints the output of `bitSet(x,n)` on two given integers. The binary representation of 4 is 0100, so when `n=1`, the second bit from the right is set to 1. After this we are left with 0110 in binary, so 6 is returned. +[source,arduino] +---- void setup() { Serial.begin(9600); while (!Serial) { @@ -54,9 +64,11 @@ void setup() { void loop() { } +---- +[%hardbreaks] -- -// OVERVIEW SECTION ENDS +// HOW TO USE SECTION ENDS // SEE ALSO SECTION @@ -65,7 +77,9 @@ void loop() { [float] === See also -bitClear() + +[role="language"] +* #LANGUAGE# link:../bitclear[bitClear()] -- // SEE ALSO SECTION ENDS From 57308eca22c2be45f8b131fc1d1066980a03dbda Mon Sep 17 00:00:00 2001 From: David Brown Date: Fri, 22 Dec 2023 22:15:59 -0500 Subject: [PATCH 284/298] Volatile variable name is now `changed`, not `state` A previous version of this page had different example code. This updates the introduction to the example to use the current example's volatile variable name. --- Language/Variables/Variable Scope & Qualifiers/volatile.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc index 79927f386..8845e1100 100644 --- a/Language/Variables/Variable Scope & Qualifiers/volatile.adoc +++ b/Language/Variables/Variable Scope & Qualifiers/volatile.adoc @@ -55,7 +55,7 @@ There are several ways to do this: === Example Code // Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄ -The `volatile` modifier ensures that changes to the `state` variable are immediately visible in `loop()`. Without the `volatile` modifier, the `state` variable may be loaded into a register when entering the function and would not be updated anymore until the function ends. +The `volatile` modifier ensures that changes to the `changed` variable are immediately visible in `loop()`. Without the `volatile` modifier, the `changed` variable may be loaded into a register when entering the function and would not be updated anymore until the function ends. [source,arduino] ---- From 04db291ed7b2c2e1e540834de270e7a05995ced1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Tue, 2 Jan 2024 12:05:50 +0100 Subject: [PATCH 285/298] Fix incorrect links in table for HID API --- Language/Functions/USB/Keyboard.adoc | 3 +-- Language/Functions/USB/Mouse.adoc | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Language/Functions/USB/Keyboard.adoc b/Language/Functions/USB/Keyboard.adoc index f1d9c565a..6773f0e69 100644 --- a/Language/Functions/USB/Keyboard.adoc +++ b/Language/Functions/USB/Keyboard.adoc @@ -36,9 +36,8 @@ HID is supported on the following boards: | link:https://docs.arduino.cc/hardware/zero[Zero] | All digital & analog pins | link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | All digital & analog pins | link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | All digital & analog pins -| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/giga-r1-wifi[Giga R1] | All digital & analog pins | link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | All digital & analog pins -| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | All digital & analog pins | link:https://docs.arduino.cc/#mkr-family[MKR Family] | All digital & analog pins |================================================================================================= diff --git a/Language/Functions/USB/Mouse.adoc b/Language/Functions/USB/Mouse.adoc index c4c8e3865..b4a8400b8 100644 --- a/Language/Functions/USB/Mouse.adoc +++ b/Language/Functions/USB/Mouse.adoc @@ -35,9 +35,8 @@ HID is supported on the following boards: | link:https://docs.arduino.cc/hardware/zero[Zero] | All digital & analog pins | link:https://docs.arduino.cc/hardware/uno-r4-minima[UNO R4 Minima] | All digital & analog pins | link:https://docs.arduino.cc/hardware/uno-r4-wifi[UNO R4 WiFi] | All digital & analog pins -| link:https://docs.arduino.cc/hardware/giga-r1[Giga R1] | All digital & analog pins +| link:https://docs.arduino.cc/hardware/giga-r1-wifi[Giga R1] | All digital & analog pins | link:https://docs.arduino.cc/hardware/nano-esp32[Nano ESP32] | All digital & analog pins -| link:https://docs.arduino.cc/hardware/mkr-1000-wifi[Nano ESP32] | All digital & analog pins | link:https://docs.arduino.cc/#mkr-family[MKR Family] | All digital & analog pins |================================================================================================= From 91cd08030bb03f105f7c244dba34f9740d53974a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:30:17 +0100 Subject: [PATCH 286/298] Remove Zero, Due & MKR Family Section Remove the Zero, Due & MKR Family section --- .../analogReadResolution.adoc | 2 +- .../analogWriteResolution.adoc | 2 +- Language/Functions/Zero, Due, MKR Family/.gitkeep | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Language/Functions/{Zero, Due, MKR Family => Analog IO}/analogReadResolution.adoc (98%) rename Language/Functions/{Zero, Due, MKR Family => Analog IO}/analogWriteResolution.adoc (99%) delete mode 100644 Language/Functions/Zero, Due, MKR Family/.gitkeep diff --git a/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc b/Language/Functions/Analog IO/analogReadResolution.adoc similarity index 98% rename from Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc rename to Language/Functions/Analog IO/analogReadResolution.adoc index 4531306b3..8a935374e 100644 --- a/Language/Functions/Zero, Due, MKR Family/analogReadResolution.adoc +++ b/Language/Functions/Analog IO/analogReadResolution.adoc @@ -1,7 +1,7 @@ --- title: analogReadResolution() categories: [ "Functions" ] -subCategories: [ "Zero, Due & MKR Family" ] +subCategories: [ "Analog I/O" ] --- diff --git a/Language/Functions/Zero, Due, MKR Family/analogWriteResolution.adoc b/Language/Functions/Analog IO/analogWriteResolution.adoc similarity index 99% rename from Language/Functions/Zero, Due, MKR Family/analogWriteResolution.adoc rename to Language/Functions/Analog IO/analogWriteResolution.adoc index 3ef4e482f..649eb171c 100644 --- a/Language/Functions/Zero, Due, MKR Family/analogWriteResolution.adoc +++ b/Language/Functions/Analog IO/analogWriteResolution.adoc @@ -1,7 +1,7 @@ --- title: analogWriteResolution() categories: [ "Functions" ] -subCategories: [ "Zero, Due & MKR Family" ] +subCategories: [ "Analog I/O" ] --- diff --git a/Language/Functions/Zero, Due, MKR Family/.gitkeep b/Language/Functions/Zero, Due, MKR Family/.gitkeep deleted file mode 100644 index e69de29bb..000000000 From 817b23404cd48ddf3cbe110d834a738c0d1ac6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:35:18 +0100 Subject: [PATCH 287/298] Update bitWrite.adoc --- Language/Functions/Bits and Bytes/bitWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Bits and Bytes/bitWrite.adoc b/Language/Functions/Bits and Bytes/bitWrite.adoc index 82b4d6a55..b0e5ef723 100644 --- a/Language/Functions/Bits and Bytes/bitWrite.adoc +++ b/Language/Functions/Bits and Bytes/bitWrite.adoc @@ -17,7 +17,7 @@ subCategories: [ "Bits and Bytes" ] [float] === Description -Writes to a bit of a variable, e.g. `bool`, `int`, `long`. Note that `float` & `double` are not supported. You can write to a bit of variables up to an `unsigned long` (32 bits / 8 bytes). +Writes to a bit of a variable, e.g. `bool`, `int`, `long`. Note that `float` & `double` are not supported. You can write to a bit of variables up to an `unsigned long` (32 bits / 4 bytes). [%hardbreaks] From c3a7f9e4ad6b63809e80dc3cbf7197624eb1e9f3 Mon Sep 17 00:00:00 2001 From: justbennett <28458839+justbennett@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:36:43 -0600 Subject: [PATCH 288/298] Update SPI.adoc Fix table cells out of alignment and remove unnecessary cells. --- Language/Functions/Communication/SPI.adoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index d99d60d29..d05c6f468 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -31,16 +31,16 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le [#howtouse] -- |================================================================================================================================================ -| Boards | Default SPI Pins | Additonal SPI Pins | Notes | -| UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | -| UNO R4 Minima, UNO R4 WiFi| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | -| Leonardo, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | -| Micro | 14(CIPO), 15(SCK), 16(COPI) | | +| Boards | Default SPI Pins | Additonal SPI Pins | Notes +| UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header +| UNO R4 Minima, UNO R4 WiFi| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header +| Leonardo, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header +| Micro | 14(CIPO), 15(SCK), 16(COPI) | | | Nano boards | 11(COPI), 12(CIPO), 13(SCK) | | | MKR boards | 8(COPI), 9(SCK), 10(CIPO) | | -| Due | 74(CIPO), 75(MOSI), 76(SCK) | SPI pins available on dedicated SPI header | | -| GIGA R1 WiFi | 89(CIPO), 90(COPI), 91(SCK) | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | Note that pin 89,90,91 are located on the SPI header | -| Mega 2560 Rev3 | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | | SPI pins available on ICSP header | +| Due | 74(CIPO), 75(MOSI), 76(SCK) | SPI pins available on dedicated SPI header | +| GIGA R1 WiFi | 89(CIPO), 90(COPI), 91(SCK) | 12(CIPO), 11(COPI), 13(SCK), 10(CS) | Note that pin 89,90,91 are located on the SPI header +| Mega 2560 Rev3 | 50(CIPO), 51(COPI), 52(SCK), 53(CS) | | SPI pins available on ICSP header |================================================================================================================================================ -- From 90b1ee21779d9e477b1809f112a47f16307c5045 Mon Sep 17 00:00:00 2001 From: Michael Cheich <52792043+ProgrammingElectronics@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:19:22 -0500 Subject: [PATCH 289/298] Update switchCase.adoc Corrected grammar in sentence by adding the verb "use" to the sentence. --- Language/Structure/Control Structure/switchCase.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index e608c23d2..bfad7fa89 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -49,7 +49,7 @@ switch (var) { *You can also use the `bool` data type when you just two switch cases. -Note that you can also negative values as input. +Note that you can also use negative values as input. [float] === Returns From 56228e96993073afb3f700b0dd0910f673bfc5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:34:14 +0100 Subject: [PATCH 290/298] Initial changes (not complete) --- Language/Functions/Communication/Serial.adoc | 29 ++++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Language/Functions/Communication/Serial.adoc b/Language/Functions/Communication/Serial.adoc index 2342f7251..c99f01c80 100644 --- a/Language/Functions/Communication/Serial.adoc +++ b/Language/Functions/Communication/Serial.adoc @@ -17,20 +17,25 @@ Used for communication between the Arduino board and a computer or other devices [options="header"] |================================================================================================================================================ -| Board | Serial pins | Serial1 pins | Serial2 pins | Serial3 pins -| UNO R3, UNO R3 SMD Mini | 0(RX), 1(TX) | | | -| UNO R4 Minima, UNO R4 WiFi| 18(RX), 17(TX) | | | -| Leonardo, Micro, Yún Rev2 | 0(RX), 1(TX) | | | -| Uno WiFi Rev.2 | 0(RX), 1(TX) | | | -| 101 | 0(RX), 1(TX) | | | -| MKR boards | 13(RX), 14(TX) | | | -| Nano boards | 0(RX), 1(TX) | | | -| Zero | 0(RX), 1(TX) | | | -| Due | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) -| GIGA R1 WiFi | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) -| Mega 2560 Rev3 | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) +| Board | Serial pins | Serial1 pins | Serial2 pins | Serial3 pins | Serial4 pins +| UNO R3, UNO R3 SMD Mini | 0(RX), 1(TX) | | | | +| Nano (classic) | 0(RX), 1(TX) | | | | +| UNO R4 Minima, UNO R4 WiFi| | 0(RX0), 1(TX0) | | | +| Leonardo, Micro, Yún Rev2 | | 0(RX), 1(TX) | | | +| Uno WiFi Rev.2 | | 0(RX), 1(TX) | | | +| MKR boards | | 13(RX), 14(TX) | | | +| Zero | | 0(RX), 1(TX) | | | +| GIGA R1 WiFi | | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) +| Due | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) | +| Mega 2560 Rev3 | 0(RX), 1(TX) | 19(RX1), 18(TX1) | 17(RX2), 16(TX2) | 15(RX3), 14(TX3) | +| Nano 33 IoT | | 0(RX0), 1(TX0) | | | +| Nano RP2040 Connect | | 0(RX0), 1(TX0) | | | +| Nano BLE / BLE Sense | | 0(RX0), 1(TX0) | | | +| Nano ESP32 | | 0(RX0), 1(TX0) | Any free GPIO [1] | | |================================================================================================================================================ +* [1] The Nano ESP32 has a second hardware serial port available, but you need to specify the pins. + On older boards (Uno, Nano, Mini, and Mega), pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board. [%hardbreaks] From d8162eae49f686956c8bf96a860ef0ef91ab1693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:06:56 +0100 Subject: [PATCH 291/298] Update Serial.adoc --- Language/Functions/Communication/Serial.adoc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Language/Functions/Communication/Serial.adoc b/Language/Functions/Communication/Serial.adoc index c99f01c80..0d9bf7efd 100644 --- a/Language/Functions/Communication/Serial.adoc +++ b/Language/Functions/Communication/Serial.adoc @@ -31,9 +31,19 @@ Used for communication between the Arduino board and a computer or other devices | Nano 33 IoT | | 0(RX0), 1(TX0) | | | | Nano RP2040 Connect | | 0(RX0), 1(TX0) | | | | Nano BLE / BLE Sense | | 0(RX0), 1(TX0) | | | -| Nano ESP32 | | 0(RX0), 1(TX0) | Any free GPIO [1] | | |================================================================================================================================================ + +[options="header"] + +The Nano ESP32 board + +|================================================================================================================================================ +| Board | Serial0 pins | Serial1 pins | Serial2 pins | Serial3 pins | Serial4 pins +| Nano ESP32 | | 0(RX0), 1(TX0) | Any free GPIO [1] | | +|================================================================================================================================================ + + * [1] The Nano ESP32 has a second hardware serial port available, but you need to specify the pins. From f5d20ad2f1d9d95a35c87bdbb8e36e0a31650bc2 Mon Sep 17 00:00:00 2001 From: Owain Williams Date: Mon, 12 Feb 2024 23:53:03 +0000 Subject: [PATCH 292/298] Add word 'specify' to entries in parameter descriptions --- Language/Structure/Control Structure/switchCase.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index bfad7fa89..a10f6304e 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -47,7 +47,7 @@ switch (var) { `var`: an *integer* variable whose value to compare with various cases. Any integer data type is allowed*, such as `byte`, `char`, `int`, `long`. `label1`, `label2`: constants. Any integer data type here is also allowed. -*You can also use the `bool` data type when you just two switch cases. +*You can also use the `bool` data type when you specify just two switch cases. Note that you can also use negative values as input. From 826653711d331a1a400dd6b810b867f54b76157a Mon Sep 17 00:00:00 2001 From: Owain Williams Date: Mon, 12 Feb 2024 23:59:36 +0000 Subject: [PATCH 293/298] Add space between single line comment begin and comment text In order to remain consistent with other code examples --- Language/Structure/Control Structure/switchCase.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index a10f6304e..246bcc2c0 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -72,10 +72,10 @@ Nothing ---- switch (var) { case 1: - //do something when var equals 1 + // do something when var equals 1 break; case 2: - //do something when var equals 2 + // do something when var equals 2 break; default: // if nothing else matches, do the default From 79e593c38459964447d9647093798a8581add08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:31:56 +0100 Subject: [PATCH 294/298] Update Serial.adoc --- Language/Functions/Communication/Serial.adoc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Language/Functions/Communication/Serial.adoc b/Language/Functions/Communication/Serial.adoc index 0d9bf7efd..9b47ddbff 100644 --- a/Language/Functions/Communication/Serial.adoc +++ b/Language/Functions/Communication/Serial.adoc @@ -36,17 +36,16 @@ Used for communication between the Arduino board and a computer or other devices [options="header"] -The Nano ESP32 board +The Nano ESP32 board is an exception due to being based on the ESP32 core. Here, `Serial0` refers to `RX0` and `TX0`, while `Serial1` and `Serial2` are additional ports that can be assigned to any free GPIO. |================================================================================================================================================ -| Board | Serial0 pins | Serial1 pins | Serial2 pins | Serial3 pins | Serial4 pins -| Nano ESP32 | | 0(RX0), 1(TX0) | Any free GPIO [1] | | +| Board | Serial0 pins | Serial1 pins | Serial2 pins | Serial3 pins | Serial4 pins +| Nano ESP32 | 0(RX0), 1(TX0) | Any free GPIO | Any free GPIO | | |================================================================================================================================================ +You can read more about configuring the Nano ESP32's additional serial ports in https://docs.arduino.cc/tutorials/nano-esp32/cheat-sheet/#uart[this article]. -* [1] The Nano ESP32 has a second hardware serial port available, but you need to specify the pins. - - +[%hardbreaks] On older boards (Uno, Nano, Mini, and Mega), pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board. [%hardbreaks] You can use the Arduino environment's built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to `begin()`. From e0246cae2a8de5ddcff7e941dc88defdf13ee53d Mon Sep 17 00:00:00 2001 From: drf5n Date: Thu, 15 Feb 2024 12:44:07 -0500 Subject: [PATCH 295/298] Update highLow.adoc Change the 0/1 order to match the HIGH/LOW & true/false order in the beginning of the sentence. --- Language/Variables/Constants/highLow.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Language/Variables/Constants/highLow.adoc b/Language/Variables/Constants/highLow.adoc index f7d84a9ae..1bec2b54e 100644 --- a/Language/Variables/Constants/highLow.adoc +++ b/Language/Variables/Constants/highLow.adoc @@ -12,7 +12,7 @@ subCategories: [ "Constants" ] [float] == Defining Pin Levels: HIGH and LOW -When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: `HIGH` and `LOW`. These are the same as `true` and `false`, as well as `0` and `1`. +When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: `HIGH` and `LOW`. These are the same as `true` and `false`, as well as `1` and `0`. [float] === HIGH @@ -58,4 +58,4 @@ When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWr [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS From f9f157ba3318b881e9944cf2f9da97b980d7d47d Mon Sep 17 00:00:00 2001 From: jbarchuk Date: Sun, 18 Feb 2024 13:02:27 -0500 Subject: [PATCH 296/298] Update analogWrite.adoc Format detail. --- Language/Functions/Analog IO/analogWrite.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Functions/Analog IO/analogWrite.adoc b/Language/Functions/Analog IO/analogWrite.adoc index d6337046a..36894922e 100644 --- a/Language/Functions/Analog IO/analogWrite.adoc +++ b/Language/Functions/Analog IO/analogWrite.adoc @@ -40,7 +40,7 @@ Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. C +*+ These pins are officially supported PWM pins. While some boards have additional pins capable of PWM, using them is recommended only for advanced users that can account for timer availability and potential conflicts with other uses of those pins. + +**+ In addition to PWM capabilities on the pins noted above, the MKR, Nano 33 IoT, Zero and UNO R4 boards have true analog output when using `analogWrite()` on the `DAC0` (`A0`) pin. + -+***+ In addition to PWM capabilities on the pins noted above, the Due and GIGA R1 boards have true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. ++***+ In addition to PWM capabilities on the pins noted above, the Due and GIGA R1 boards have true analog output when using `analogWrite()` on pins `DAC0` and `DAC1`. + +****+ Only 4 different pins can be used at the same time. Enabling PWM on more than 4 pins will abort the running sketch and require resetting the board to upload a new sketch again. + [%hardbreaks] From f2fd28490a3fe3bf55d10ba93080add39fd3c977 Mon Sep 17 00:00:00 2001 From: Mateus Alves <98139059+redyf@users.noreply.github.com> Date: Sat, 8 Jun 2024 20:40:10 -0300 Subject: [PATCH 297/298] Fix typos (#984) * fix: typos in AsciiDoc_sample * fix: typo in Serial Directory * fix: typo in Wire directory * fix: typos in Communication directory * fix: typo in mouseMove.adoc * fix: typo in switchCase.adoc file * fix: typo in array.adoc file * fix: typo in LICENSE file MERCHANTIBILITY -> MERCHANTABILITY --- .../AsciiDoc_Template-Parent_Of_Entities.adoc | 2 +- .../Reference_Terms/AsciiDoc_Template-Single_Entity.adoc | 2 +- LICENSE.md | 2 +- Language/Functions/Communication/Print.adoc | 4 ++-- Language/Functions/Communication/SPI.adoc | 2 +- Language/Functions/Communication/Serial/print.adoc | 2 +- Language/Functions/Communication/Wire.adoc | 2 +- .../Functions/Communication/Wire/getWireTimeoutFlag.adoc | 4 ++-- Language/Functions/Communication/Wire/setWireTimeout.adoc | 8 ++++---- Language/Functions/USB/Mouse/mouseMove.adoc | 2 +- Language/Structure/Control Structure/switchCase.adoc | 2 +- Language/Variables/Data Types/array.adoc | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Parent_Of_Entities.adoc b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Parent_Of_Entities.adoc index c0c06e710..4fdc98960 100644 --- a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Parent_Of_Entities.adoc +++ b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Parent_Of_Entities.adoc @@ -85,7 +85,7 @@ http://arduino.cc[serialEvent()] [role="language"] // Whenever you want to link to another Reference term, or more in general to a relative link, -// use the syntax shown below. Please note that the file format is subsituted by attribute. +// use the syntax shown below. Please note that the file format is substituted by attribute. // Please note that you always need to replace spaces that you might find in folder/file names with %20 // The entire link to Reference pages must be lower case, regardless of the case of the folders and files in this repository. * #LANGUAGE# link:../AsciiDoc_Template-Single_Entity[Single Entity] diff --git a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc index aa4f95051..a9e23d242 100644 --- a/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc +++ b/AsciiDoc_sample/Reference_Terms/AsciiDoc_Template-Single_Entity.adoc @@ -110,7 +110,7 @@ image::http://arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg[caption=" [role="language"] // Whenever you want to link to another Reference term, or more in general to a relative link, -// use the syntax shown below. Please note that the file format is subsituted by attribute. +// use the syntax shown below. Please note that the file format is substituted by attribute. // Please note that you always need to replace spaces that you might find in folder/file names with %20 // The entire link to Reference pages must be lower case, regardless of the case of the folders and files in this repository. // For language tag, items will be automatically generated for any other item of the same subcategory, diff --git a/LICENSE.md b/LICENSE.md index c90487cb0..53764dac4 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -264,7 +264,7 @@ subject to and limited by the following restrictions: UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, -INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, +INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION diff --git a/Language/Functions/Communication/Print.adoc b/Language/Functions/Communication/Print.adoc index 31b61ba5d..b1c5497b3 100644 --- a/Language/Functions/Communication/Print.adoc +++ b/Language/Functions/Communication/Print.adoc @@ -18,7 +18,7 @@ subCategories: [ "Communication" ] === Description The Print class is an abstract base class that provides a common interface for printing data to different output devices. It defines several methods that allow printing data in different formats. -Print class is related to several libraries in Arduino that use the printing funcionality to interact with devices such as Serial Monitor, LCD Screen, printers, etc. +Print class is related to several libraries in Arduino that use the printing functionality to interact with devices such as Serial Monitor, LCD Screen, printers, etc. Some of the libraries that use the Print class are: @@ -58,4 +58,4 @@ link:https://www.arduino.cc/reference/en/language/functions/communication/serial === See also -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS diff --git a/Language/Functions/Communication/SPI.adoc b/Language/Functions/Communication/SPI.adoc index d05c6f468..a448778cf 100644 --- a/Language/Functions/Communication/SPI.adoc +++ b/Language/Functions/Communication/SPI.adoc @@ -31,7 +31,7 @@ To read more about Arduino and SPI, you can visit the https://docs.arduino.cc/le [#howtouse] -- |================================================================================================================================================ -| Boards | Default SPI Pins | Additonal SPI Pins | Notes +| Boards | Default SPI Pins | Additional SPI Pins | Notes | UNO R3, UNO R3 SMD, UNO WiFi Rev2, UNO Mini Ltd| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | UNO R4 Minima, UNO R4 WiFi| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header | Leonardo, Yún Rev2, Zero| 10(CS), 11(COPI), 12(CIPO), 13(SCK) | | SPI pins available on ICSP header diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index a14c9cec1..e228bdf1e 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -100,7 +100,7 @@ void loop() { for (int x = 0; x < 64; x++) { // only part of the ASCII chart, change to suit // print it out in many formats: Serial.print(x); // print as an ASCII-encoded decimal - same as "DEC" - Serial.print("\t\t"); // prints two tabs to accomodate the label length + Serial.print("\t\t"); // prints two tabs to accommodate the label length Serial.print(x, DEC); // print as an ASCII-encoded decimal Serial.print("\t"); // prints a tab diff --git a/Language/Functions/Communication/Wire.adoc b/Language/Functions/Communication/Wire.adoc index 4aed17dc7..50ee777b7 100644 --- a/Language/Functions/Communication/Wire.adoc +++ b/Language/Functions/Communication/Wire.adoc @@ -16,7 +16,7 @@ subCategories: [ "Communication" ] === Description -This library allows you to communicate with I2C devices, a feature that is present on all Arduino boards. I2C is a very common protocol, primarly used for reading/sending data to/from external I2C components. To learn more, visit link:https://docs.arduino.cc/learn/communication/wire[this article for Arduino & I2C]. +This library allows you to communicate with I2C devices, a feature that is present on all Arduino boards. I2C is a very common protocol, primarily used for reading/sending data to/from external I2C components. To learn more, visit link:https://docs.arduino.cc/learn/communication/wire[this article for Arduino & I2C]. Due to the hardware design and various architectural differences, the I2C pins are located in different places. The pin map just below highlights the default pins, as well as additional ports available on certain boards. diff --git a/Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc b/Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc index 25c5301d2..c50449a63 100644 --- a/Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc +++ b/Language/Functions/Communication/Wire/getWireTimeoutFlag.adoc @@ -10,7 +10,7 @@ title: getWireTimeoutFlag() [float] === Description -Checks whether a timeout has occured since the last time the flag was cleared. +Checks whether a timeout has occurred since the last time the flag was cleared. This flag is set is set whenever a timeout occurs and cleared when `Wire.clearWireTimeoutFlag()` is called, or when the timeout is changed using `Wire.setWireTimeout()`. @@ -34,4 +34,4 @@ This function was not available in the original version of the Wire library and -- -//OVERVIEW SECTION ENDS \ No newline at end of file +//OVERVIEW SECTION ENDS diff --git a/Language/Functions/Communication/Wire/setWireTimeout.adoc b/Language/Functions/Communication/Wire/setWireTimeout.adoc index 761e6797c..3cfe18b8e 100644 --- a/Language/Functions/Communication/Wire/setWireTimeout.adoc +++ b/Language/Functions/Communication/Wire/setWireTimeout.adoc @@ -53,7 +53,7 @@ void loop() { Wire.write(123); // send command byte error = Wire.endTransmission(); // run transaction if (error) { - Serial.println("Error occured when writing"); + Serial.println("Error occurred when writing"); if (error == 5) Serial.println("It was a timeout"); } @@ -66,7 +66,7 @@ void loop() { #endif byte len = Wire.requestFrom(8, 1); // request 1 byte from device #8 if (len == 0) { - Serial.println("Error occured when reading"); + Serial.println("Error occurred when reading"); #if defined(WIRE_HAS_TIMEOUT) if (Wire.getWireTimeoutFlag()) Serial.println("It was a timeout"); @@ -88,7 +88,7 @@ If `reset_on_timeout` was set to true and the platform supports this, the Wire h When a timeout is triggered, a flag is set that can be queried with `getWireTimeoutFlag()` and must be cleared manually using `clearWireTimeoutFlag()` (and is also cleared when `setWireTimeout()` is called). -Note that this timeout can also trigger while waiting for clock stretching or waiting for a second master to complete its transaction. So make sure to adapt the timeout to accomodate for those cases if needed. A typical timeout would be 25ms (which is the maximum clock stretching allowed by the SMBus protocol), but (much) shorter values will usually also work. +Note that this timeout can also trigger while waiting for clock stretching or waiting for a second master to complete its transaction. So make sure to adapt the timeout to accommodate for those cases if needed. A typical timeout would be 25ms (which is the maximum clock stretching allowed by the SMBus protocol), but (much) shorter values will usually also work. [float] @@ -102,4 +102,4 @@ If you require the timeout to be disabled, it is recommended you disable it by d -- -//OVERVIEW SECTION ENDS \ No newline at end of file +//OVERVIEW SECTION ENDS diff --git a/Language/Functions/USB/Mouse/mouseMove.adoc b/Language/Functions/USB/Mouse/mouseMove.adoc index 852938b29..f4214f85a 100644 --- a/Language/Functions/USB/Mouse/mouseMove.adoc +++ b/Language/Functions/USB/Mouse/mouseMove.adoc @@ -110,7 +110,7 @@ int readAxis(int axisNumber) { } // the Y axis needs to be inverted in order to - // map the movemment correctly: + // map the movement correctly: if (axisNumber == 1) { distance = -distance; } diff --git a/Language/Structure/Control Structure/switchCase.adoc b/Language/Structure/Control Structure/switchCase.adoc index 246bcc2c0..7b2fad04d 100644 --- a/Language/Structure/Control Structure/switchCase.adoc +++ b/Language/Structure/Control Structure/switchCase.adoc @@ -92,7 +92,7 @@ switch (var) { -// SEE ALSO SECTIN BEGINS +// SEE ALSO SECTION BEGINS [#see_also] -- diff --git a/Language/Variables/Data Types/array.adoc b/Language/Variables/Data Types/array.adoc index 1825020c8..d9b781b61 100644 --- a/Language/Variables/Data Types/array.adoc +++ b/Language/Variables/Data Types/array.adoc @@ -22,7 +22,7 @@ All of the methods below are valid ways to create (declare) an array. // Declare an array of a given length without initializing the values: int myInts[6]; - // Declare an array without explicitely choosing a size (the compiler + // Declare an array without explicitly choosing a size (the compiler // counts the elements and creates an array of the appropriate size): int myPins[] = {2, 4, 8, 3, 6, 4}; From 386ea64ec278e3f6df3002b08a0ee64454549c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20M=C3=A9ndez?= <49886387+mcmchris@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:45:45 -0400 Subject: [PATCH 298/298] Broken Links fix --- Language/Functions/Communication/Print.adoc | 6 +++--- Language/Functions/Communication/Serial/available.adoc | 2 +- .../Functions/Communication/Serial/availableForWrite.adoc | 2 +- Language/Functions/Communication/Serial/begin.adoc | 4 ++-- Language/Functions/Communication/Serial/end.adoc | 2 +- Language/Functions/Communication/Serial/find.adoc | 2 +- Language/Functions/Communication/Serial/findUntil.adoc | 2 +- Language/Functions/Communication/Serial/flush.adoc | 2 +- Language/Functions/Communication/Serial/parseFloat.adoc | 2 +- Language/Functions/Communication/Serial/parseInt.adoc | 2 +- Language/Functions/Communication/Serial/peek.adoc | 2 +- Language/Functions/Communication/Serial/print.adoc | 2 +- Language/Functions/Communication/Serial/println.adoc | 2 +- Language/Functions/Communication/Serial/read.adoc | 2 +- Language/Functions/Communication/Serial/readBytes.adoc | 2 +- Language/Functions/Communication/Serial/readBytesUntil.adoc | 2 +- Language/Functions/Communication/Serial/readString.adoc | 4 ++-- .../Functions/Communication/Serial/readStringUntil.adoc | 4 ++-- Language/Functions/Communication/Serial/setTimeout.adoc | 2 +- Language/Functions/Communication/Serial/write.adoc | 2 +- Language/Functions/Communication/stream.adoc | 4 ++-- 21 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Language/Functions/Communication/Print.adoc b/Language/Functions/Communication/Print.adoc index b1c5497b3..a6b7a142d 100644 --- a/Language/Functions/Communication/Print.adoc +++ b/Language/Functions/Communication/Print.adoc @@ -22,7 +22,7 @@ Print class is related to several libraries in Arduino that use the printing fun Some of the libraries that use the Print class are: -* link:../serial[Serial] +* link:https://www.arduino.cc/en/Reference/serial[Serial] * link:https://reference.arduino.cc/reference/en/libraries/liquidcrystal/[LiquidCrystal] * link:https://www.arduino.cc/en/Reference/Ethernet[Ethernet] * link:https://reference.arduino.cc/reference/en/libraries/wifi/wificlient/[Wifi] @@ -41,8 +41,8 @@ Some of the libraries that use the Print class are: [float] === Functions link:https://www.arduino.cc/reference/en/language/functions/communication/wire/write/[write()] + -link:https://www.arduino.cc/reference/en/language/functions/communication/serial/print/[print()] + -link:https://www.arduino.cc/reference/en/language/functions/communication/serial/println/[println()] +link:https://www.arduino.cc/en/Reference/serial/print/[print()] + +link:https://www.arduino.cc/en/Reference/serial/println/[println()] ''' diff --git a/Language/Functions/Communication/Serial/available.adoc b/Language/Functions/Communication/Serial/available.adoc index 4c6d7a60f..14b8ab166 100644 --- a/Language/Functions/Communication/Serial/available.adoc +++ b/Language/Functions/Communication/Serial/available.adoc @@ -24,7 +24,7 @@ Get the number of bytes (characters) available for reading from the serial port. [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. [float] diff --git a/Language/Functions/Communication/Serial/availableForWrite.adoc b/Language/Functions/Communication/Serial/availableForWrite.adoc index 9989dfb66..fe76f5407 100644 --- a/Language/Functions/Communication/Serial/availableForWrite.adoc +++ b/Language/Functions/Communication/Serial/availableForWrite.adoc @@ -25,7 +25,7 @@ Get the number of bytes (characters) available for writing in the serial buffer [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. [float] diff --git a/Language/Functions/Communication/Serial/begin.adoc b/Language/Functions/Communication/Serial/begin.adoc index ea8c0f04e..ed0bf8270 100644 --- a/Language/Functions/Communication/Serial/begin.adoc +++ b/Language/Functions/Communication/Serial/begin.adoc @@ -28,7 +28,7 @@ An optional second argument configures the data, parity, and stop bits. The defa [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `speed`: in bits per second (baud). Allowed data types: `long`. + `config`: sets data, parity, and stop bits. Valid values are: + `SERIAL_5N1` + @@ -112,7 +112,7 @@ Thanks to Jeff Gray for the mega example [float] === Notes and Warnings -For USB CDC serial ports (e.g. `Serial` on the Leonardo), `Serial.begin()` is irrelevant. You can use any baud rate and configuration for serial communication with these ports. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +For USB CDC serial ports (e.g. `Serial` on the Leonardo), `Serial.begin()` is irrelevant. You can use any baud rate and configuration for serial communication with these ports. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. The only `config` value supported for `Serial1` on the Arduino Nano 33 BLE and Nano 33 BLE Sense boards is `SERIAL_8N1`. [%hardbreaks] diff --git a/Language/Functions/Communication/Serial/end.adoc b/Language/Functions/Communication/Serial/end.adoc index b13b78ff5..a3b101c79 100644 --- a/Language/Functions/Communication/Serial/end.adoc +++ b/Language/Functions/Communication/Serial/end.adoc @@ -25,7 +25,7 @@ Disables serial communication, allowing the RX and TX pins to be used for genera [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. [float] diff --git a/Language/Functions/Communication/Serial/find.adoc b/Language/Functions/Communication/Serial/find.adoc index b36efdc63..9f454de0a 100644 --- a/Language/Functions/Communication/Serial/find.adoc +++ b/Language/Functions/Communication/Serial/find.adoc @@ -28,7 +28,7 @@ title: Serial.find() [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `target`: the string to search for. Allowed data types: `char`. + `length`: length of the target. Allowed data types: `size_t`. diff --git a/Language/Functions/Communication/Serial/findUntil.adoc b/Language/Functions/Communication/Serial/findUntil.adoc index f19bfa6ef..a2e9fc0d6 100644 --- a/Language/Functions/Communication/Serial/findUntil.adoc +++ b/Language/Functions/Communication/Serial/findUntil.adoc @@ -29,7 +29,7 @@ The function returns true if the target string is found, false if it times out. [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `target`: the string to search for. Allowed data types: `char`. + `terminal`: the terminal string in the search. Allowed data types: `char`. diff --git a/Language/Functions/Communication/Serial/flush.adoc b/Language/Functions/Communication/Serial/flush.adoc index 03a0b6819..fb7027f6a 100644 --- a/Language/Functions/Communication/Serial/flush.adoc +++ b/Language/Functions/Communication/Serial/flush.adoc @@ -27,7 +27,7 @@ Waits for the transmission of outgoing serial data to complete. [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. [float] diff --git a/Language/Functions/Communication/Serial/parseFloat.adoc b/Language/Functions/Communication/Serial/parseFloat.adoc index b9b0cde79..6c1f01bcd 100644 --- a/Language/Functions/Communication/Serial/parseFloat.adoc +++ b/Language/Functions/Communication/Serial/parseFloat.adoc @@ -29,7 +29,7 @@ title: Serial.parseFloat() [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `lookahead`: the mode used to look ahead in the stream for a floating point number. Allowed data types: `LookaheadMode`. Allowed `lookahead` values: * `SKIP_ALL`: all characters other than a minus sign, decimal point, or digits are ignored when scanning the stream for a floating point number. This is the default mode. diff --git a/Language/Functions/Communication/Serial/parseInt.adoc b/Language/Functions/Communication/Serial/parseInt.adoc index 962b48cbd..93c6e1563 100644 --- a/Language/Functions/Communication/Serial/parseInt.adoc +++ b/Language/Functions/Communication/Serial/parseInt.adoc @@ -35,7 +35,7 @@ In particular: [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `lookahead`: the mode used to look ahead in the stream for an integer. Allowed data types: `LookaheadMode`. Allowed `lookahead` values: * `SKIP_ALL`: all characters other than digits or a minus sign are ignored when scanning the stream for an integer. This is the default mode. diff --git a/Language/Functions/Communication/Serial/peek.adoc b/Language/Functions/Communication/Serial/peek.adoc index 7209996be..557c729af 100644 --- a/Language/Functions/Communication/Serial/peek.adoc +++ b/Language/Functions/Communication/Serial/peek.adoc @@ -27,7 +27,7 @@ Returns the next byte (character) of incoming serial data without removing it fr [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. [float] diff --git a/Language/Functions/Communication/Serial/print.adoc b/Language/Functions/Communication/Serial/print.adoc index e228bdf1e..8f09302a0 100644 --- a/Language/Functions/Communication/Serial/print.adoc +++ b/Language/Functions/Communication/Serial/print.adoc @@ -48,7 +48,7 @@ To send data without conversion to its representation as characters, use link:.. [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `val`: the value to print. Allowed data types: any data type. diff --git a/Language/Functions/Communication/Serial/println.adoc b/Language/Functions/Communication/Serial/println.adoc index 15ef923c0..49dc2aaa1 100644 --- a/Language/Functions/Communication/Serial/println.adoc +++ b/Language/Functions/Communication/Serial/println.adoc @@ -26,7 +26,7 @@ Prints data to the serial port as human-readable ASCII text followed by a carria [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `val`: the value to print. Allowed data types: any data type. + `format`: specifies the number base (for integral data types) or number of decimal places (for floating point types). diff --git a/Language/Functions/Communication/Serial/read.adoc b/Language/Functions/Communication/Serial/read.adoc index 2a781fc7e..b721f2322 100644 --- a/Language/Functions/Communication/Serial/read.adoc +++ b/Language/Functions/Communication/Serial/read.adoc @@ -27,7 +27,7 @@ Reads incoming serial data. [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. [float] diff --git a/Language/Functions/Communication/Serial/readBytes.adoc b/Language/Functions/Communication/Serial/readBytes.adoc index da566d64b..eee28340b 100644 --- a/Language/Functions/Communication/Serial/readBytes.adoc +++ b/Language/Functions/Communication/Serial/readBytes.adoc @@ -29,7 +29,7 @@ title: Serial.readBytes() [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. diff --git a/Language/Functions/Communication/Serial/readBytesUntil.adoc b/Language/Functions/Communication/Serial/readBytesUntil.adoc index d35ff46c2..50775c471 100644 --- a/Language/Functions/Communication/Serial/readBytesUntil.adoc +++ b/Language/Functions/Communication/Serial/readBytesUntil.adoc @@ -29,7 +29,7 @@ Serial.readBytesUntil() reads characters from the serial buffer into an array. T [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `character`: the character to search for. Allowed data types: `char`. + `buffer`: the buffer to store the bytes in. Allowed data types: array of `char` or `byte`. + `length`: the number of bytes to read. Allowed data types: `int`. diff --git a/Language/Functions/Communication/Serial/readString.adoc b/Language/Functions/Communication/Serial/readString.adoc index c0fa8856c..496787c8e 100644 --- a/Language/Functions/Communication/Serial/readString.adoc +++ b/Language/Functions/Communication/Serial/readString.adoc @@ -27,7 +27,7 @@ title: Serial.readString() [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. [float] @@ -85,7 +85,7 @@ The function does not terminate early if the data contains end of line character === See also [role="language"] -* #LANGUAGE# link:../../serial[Serial] +* #LANGUAGE# link:https://www.arduino.cc/en/Reference/serial[Serial] * #LANGUAGE# link:../begin[begin()] * #LANGUAGE# link:../end[end()] * #LANGUAGE# link:../available[available()] diff --git a/Language/Functions/Communication/Serial/readStringUntil.adoc b/Language/Functions/Communication/Serial/readStringUntil.adoc index 5a699bfc2..54f24540f 100644 --- a/Language/Functions/Communication/Serial/readStringUntil.adoc +++ b/Language/Functions/Communication/Serial/readStringUntil.adoc @@ -27,7 +27,7 @@ title: Serial.readStringUntil() [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `terminator`: the character to search for. Allowed data types: `char`. @@ -62,7 +62,7 @@ If the terminator character can't be found, all read characters will be discarde === See also [role="language"] -* #LANGUAGE# link:../../serial[Serial] +* #LANGUAGE# link:https://www.arduino.cc/en/Reference/serial[Serial] * #LANGUAGE# link:../begin[begin()] * #LANGUAGE# link:../end[end()] * #LANGUAGE# link:../available[available()] diff --git a/Language/Functions/Communication/Serial/setTimeout.adoc b/Language/Functions/Communication/Serial/setTimeout.adoc index 76e73dff1..41d5f224c 100644 --- a/Language/Functions/Communication/Serial/setTimeout.adoc +++ b/Language/Functions/Communication/Serial/setTimeout.adoc @@ -27,7 +27,7 @@ title: Serial.setTimeout() [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `time`: timeout duration in milliseconds. Allowed data types: `long`. diff --git a/Language/Functions/Communication/Serial/write.adoc b/Language/Functions/Communication/Serial/write.adoc index 00f0bdc66..cfcd0b944 100644 --- a/Language/Functions/Communication/Serial/write.adoc +++ b/Language/Functions/Communication/Serial/write.adoc @@ -24,7 +24,7 @@ Writes binary data to the serial port. This data is sent as a byte or series of [float] === Parameters -`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. + +`_Serial_`: serial port object. See the list of available serial ports for each board on the link:https://www.arduino.cc/en/Reference/serial[Serial main page]. + `val`: a value to send as a single byte. + `str`: a string to send as a series of bytes. + `buf`: an array to send as a series of bytes. + diff --git a/Language/Functions/Communication/stream.adoc b/Language/Functions/Communication/stream.adoc index 8950da800..7258a219e 100644 --- a/Language/Functions/Communication/stream.adoc +++ b/Language/Functions/Communication/stream.adoc @@ -22,8 +22,8 @@ Stream defines the reading functions in Arduino. When using any core functionali Some of the libraries that rely on Stream include : -* link:../serial[Serial] -* link:https://www.arduino.cc/en/Reference/Wire[Wire] +* link:https://www.arduino.cc/en/Reference/serial[Serial] +* link:https://www.arduino.cc/en/Reference/wire[Wire] * link:https://www.arduino.cc/en/Reference/Ethernet[Ethernet] * link:https://www.arduino.cc/en/Reference/SD[SD]