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 001/107] 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 3ef87e10bbb4ea32075b5ed66c13e07977326a92 Mon Sep 17 00:00:00 2001 From: MalcolmBoura Date: Wed, 30 Sep 2020 15:11:16 +0100 Subject: [PATCH 002/107] 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 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 003/107] 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 fca865ba7b9ae7244be23f6364ae0986d3196bb9 Mon Sep 17 00:00:00 2001 From: Marco Tedaldi Date: Thu, 18 Mar 2021 10:36:59 +0100 Subject: [PATCH 004/107] 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 e893eb10155b388716742fe516705b42096709dd Mon Sep 17 00:00:00 2001 From: Vincent Tavernier Date: Wed, 21 Apr 2021 18:19:21 +0200 Subject: [PATCH 005/107] 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 006/107] 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 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 007/107] 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 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 008/107] 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 11c51188575cb1070c794acb249668016765e641 Mon Sep 17 00:00:00 2001 From: Stefan Lenz Date: Sun, 26 Dec 2021 19:05:52 +0100 Subject: [PATCH 009/107] 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 010/107] 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 011/107] 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 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 012/107] 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 013/107] 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 014/107] 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 015/107] 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 016/107] 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 017/107] 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 018/107] 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 019/107] 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 020/107] 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 021/107] 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 022/107] 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 023/107] 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 024/107] 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 025/107] 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 026/107] 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 027/107] 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 028/107] 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 029/107] [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 030/107] 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 031/107] 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 032/107] 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 033/107] 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 034/107] 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 035/107] 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 036/107] 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 037/107] 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 038/107] 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 039/107] 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 040/107] 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 041/107] 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 042/107] 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 043/107] 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 044/107] 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 045/107] 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 046/107] 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 047/107] 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 048/107] 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 049/107] 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 050/107] 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 051/107] 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 052/107] 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 053/107] 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 054/107] 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 055/107] 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 056/107] 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 057/107] 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 058/107] 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 059/107] 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 060/107] 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 061/107] 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 062/107] 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 063/107] 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 064/107] 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 065/107] 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 066/107] 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 067/107] 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 068/107] 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 069/107] 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 070/107] 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 071/107] 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 072/107] 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 073/107] 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 074/107] 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 075/107] 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 076/107] 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 077/107] 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 078/107] 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 079/107] 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 080/107] 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 081/107] 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 082/107] 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 083/107] 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 084/107] 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 085/107] 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 086/107] 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 087/107] 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 088/107] 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 089/107] 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 090/107] 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 091/107] 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 092/107] 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 093/107] 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 094/107] 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 095/107] 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 096/107] 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 097/107] 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 098/107] 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 099/107] 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 100/107] 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 101/107] 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 102/107] 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 103/107] 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 104/107] 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 105/107] 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 106/107] 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 107/107] 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]