id
stringlengths
14
16
text
stringlengths
10
1.45k
source
stringlengths
46
118
bc0c002b415d-1
Parameters thisChar: variable. Allowed data types: char. Returns true: if thisChar is printable. Example Code if (isPrintable(myChar)) { // tests if myChar is printable char Serial.println("The character is printable"); } else { Serial.println("The character is not printable"); } See also LANGUAGE char LANGUAGE if (conditional operators) LANGUAGE while (conditional operators) LANGUAGE read()
https://www.arduino.cc/reference/en/language/functions/characters/isprintable/index.html
60e59bf15ed6-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Characters > Iscontrol isControl() [Characters] Description Analyse if a char is a control character. Returns true if thisChar is a control character. Syntax isControl(thisChar) Parameters thisChar: variable. Allowed data types: char. Returns true: if thisChar is a control character.
https://www.arduino.cc/reference/en/language/functions/characters/iscontrol/index.html
60e59bf15ed6-1
Returns true: if thisChar is a control character. Example Code if (isControl(myChar)) { // tests if myChar is a control character Serial.println("The character is a control character"); } else { Serial.println("The character is not a control character"); } See also LANGUAGE char LANGUAGE if (conditional operators) LANGUAGE while (conditional operators) LANGUAGE read()
https://www.arduino.cc/reference/en/language/functions/characters/iscontrol/index.html
ea204f78a78e-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Characters > Isgraph isGraph() [Characters] Description Analyse if a char is printable with some content (space is printable but has no content). Returns true if thisChar is printable. Syntax isGraph(thisChar) Parameters thisChar: variable. Allowed data types: char. Returns
https://www.arduino.cc/reference/en/language/functions/characters/isgraph/index.html
ea204f78a78e-1
Parameters thisChar: variable. Allowed data types: char. Returns true: if thisChar is printable. Example Code if (isGraph(myChar)) { // tests if myChar is a printable character but not a blank space. Serial.println("The character is printable"); } else { Serial.println("The character is not printable"); } See also LANGUAGE char LANGUAGE if (conditional operators) LANGUAGE while (conditional operators) LANGUAGE read()
https://www.arduino.cc/reference/en/language/functions/characters/isgraph/index.html
269bd7b84807-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Characters > Iswhitespace isWhitespace() [Characters] Description Analyse if a char is a space character. Returns true if the argument is a space or horizontal tab ('\t'). Syntax isWhitespace(thisChar) Parameters thisChar: variable. Allowed data types: char. Returns
https://www.arduino.cc/reference/en/language/functions/characters/iswhitespace/index.html
269bd7b84807-1
Parameters thisChar: variable. Allowed data types: char. Returns true: if thisChar is a space character. Example Code if (isWhitespace(myChar)) { // tests if myChar is a space character Serial.println("The character is a space or tab"); } else { Serial.println("The character is not a space or tab"); } See also LANGUAGE char LANGUAGE if (conditional operators) LANGUAGE while (conditional operators) LANGUAGE read()
https://www.arduino.cc/reference/en/language/functions/characters/iswhitespace/index.html
41f570ee8a15-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Characters > Isascii isAscii() [Characters] Description Analyse if a char is Ascii. Returns true if thisChar contains an Ascii character. Syntax isAscii(thisChar) Parameters thisChar: variable. Allowed data types: char. Returns true: if thisChar is Ascii.
https://www.arduino.cc/reference/en/language/functions/characters/isascii/index.html
41f570ee8a15-1
Returns true: if thisChar is Ascii. Example Code if (isAscii(myChar)) { // tests if myChar is an Ascii character Serial.println("The character is Ascii"); } else { Serial.println("The character is not Ascii"); } See also LANGUAGE char LANGUAGE if (conditional operators) LANGUAGE while (conditional operators) LANGUAGE read()
https://www.arduino.cc/reference/en/language/functions/characters/isascii/index.html
43d97c3db73c-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Characters > Isalphanumeric isAlphaNumeric() [Characters] Description Analyse if a char is alphanumeric (that is a letter or a numbers). Returns true if thisChar contains either a number or a letter. Syntax isAlphaNumeric(thisChar) Parameters thisChar: variable. Allowed data types: char. Returns
https://www.arduino.cc/reference/en/language/functions/characters/isalphanumeric/index.html
43d97c3db73c-1
Parameters thisChar: variable. Allowed data types: char. Returns true: if thisChar is alphanumeric. Example Code if (isAlphaNumeric(myChar)) { // tests if myChar isa letter or a number Serial.println("The character is alphanumeric"); } else { Serial.println("The character is not alphanumeric"); } See also LANGUAGE char LANGUAGE if (conditional operators) LANGUAGE while (conditional operators) LANGUAGE read()
https://www.arduino.cc/reference/en/language/functions/characters/isalphanumeric/index.html
d8eaf5c21cc4-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Characters > Isdigit isDigit() [Characters] Description Analyse if a char is a digit (that is a number). Returns true if thisChar is a number. Syntax isDigit(thisChar) Parameters thisChar: variable. Allowed data types: char. Returns
https://www.arduino.cc/reference/en/language/functions/characters/isdigit/index.html
d8eaf5c21cc4-1
Parameters thisChar: variable. Allowed data types: char. Returns true: if thisChar is a number. Example Code if (isDigit(myChar)) { // tests if myChar is a digit Serial.println("The character is a number"); } else { Serial.println("The character is not a number"); } See also LANGUAGE char LANGUAGE if (conditional operators) LANGUAGE while (conditional operators) LANGUAGE read()
https://www.arduino.cc/reference/en/language/functions/characters/isdigit/index.html
91cf548b545f-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Zero due mkr family > Analogwriteresolution analogWriteResolution() [Zero, Due & MKR Family] Description analogWriteResolution() is an extension of the Analog API for the Arduino Due.
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/index.html
91cf548b545f-1
Description analogWriteResolution() is an extension of the Analog API for the Arduino Due. analogWriteResolution() sets the resolution of the analogWrite() function. It defaults to 8 bits (values between 0-255) for backward compatibility with AVR based boards. The Due has the following hardware capabilities: 12 pins which default to 8-bit PWM, like the AVR-based boards. These can be changed to 12-bit resolution. 2 pins with 12-bit DAC (Digital-to-Analog Converter) By setting the write resolution to 12, you can use analogWrite() with values between 0 and 4095 to exploit the full DAC resolution or to set the PWM signal without rolling over. The Zero has the following hardware capabilities: 10 pins which default to 8-bit PWM, like the AVR-based boards. These can be changed to 12-bit resolution.
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/index.html
91cf548b545f-2
1 pin with 10-bit DAC (Digital-to-Analog Converter). By setting the write resolution to 10, you can use analogWrite() with values between 0 and 1023 to exploit the full DAC resolution The MKR Family of boards has the following hardware capabilities: 4 pins which default to 8-bit PWM, like the AVR-based boards. These can be changed from 8 (default) to 12-bit resolution. 1 pin with 10-bit DAC (Digital-to-Analog Converter) By setting the write resolution to 12 bits, you can use analogWrite() with values between 0 and 4095 for PWM signals; set 10 bit on the DAC pin to exploit the full DAC resolution of 1024 values. Syntax analogWriteResolution(bits) Parameters
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/index.html
91cf548b545f-3
Syntax analogWriteResolution(bits) Parameters bits: determines the resolution (in bits) of the values used in the analogWrite() function. The value can range from 1 to 32. If you choose a resolution higher or lower than your board’s hardware capabilities, the value used in analogWrite() will be either truncated if it’s too high or padded with zeros if it’s too low. See the note below for details. Returns Nothing Example Code Explain Code void setup() { // open a serial connection Serial.begin(9600); // make our digital pin an output pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); } void loop() { // read the input on A0 and map it to a PWM pin // with an attached LED int sensorVal = analogRead(A0);
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/index.html
91cf548b545f-4
// with an attached LED int sensorVal = analogRead(A0); Serial.print("Analog Read) : "); Serial.print(sensorVal); // the default PWM resolution analogWriteResolution(8); analogWrite(11, map(sensorVal, 0, 1023, 0, 255)); Serial.print(" , 8-bit PWM value : "); Serial.print(map(sensorVal, 0, 1023, 0, 255)); // change the PWM resolution to 12 bits // the full 12 bit resolution is only supported // on the Due analogWriteResolution(12); analogWrite(12, map(sensorVal, 0, 1023, 0, 4095)); Serial.print(" , 12-bit PWM value : ");
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/index.html
91cf548b545f-5
Serial.print(" , 12-bit PWM value : "); Serial.print(map(sensorVal, 0, 1023, 0, 4095)); // change the PWM resolution to 4 bits analogWriteResolution(4); analogWrite(13, map(sensorVal, 0, 1023, 0, 15)); Serial.print(", 4-bit PWM value : "); Serial.println(map(sensorVal, 0, 1023, 0, 15)); delay(5); } Notes and Warnings If you set the analogWriteResolution() value to a value higher than your board’s capabilities, the Arduino will discard the extra bits. For example: using the Due with analogWriteResolution(16) on a 12-bit DAC pin, only the first 12 bits of the values passed to analogWrite() will be used and the last 4 bits will be discarded.
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/index.html
91cf548b545f-6
If you set the analogWriteResolution() value to a value lower than your board’s capabilities, the missing bits will be padded with zeros to fill the hardware required size. For example: using the Due with analogWriteResolution(8) on a 12-bit DAC pin, the Arduino will add 4 zero bits to the 8-bit value used in analogWrite() to obtain the 12 bits required. See also LANGUAGE analogWrite() LANGUAGE analogRead() LANGUAGE map() EXAMPLE Description of the analog input pins
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/index.html
51215c2bd38f-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Zero due mkr family > Analogreadresolution analogReadResolution() [Zero, Due & MKR Family] Description analogReadResolution() is an extension of the Analog API for the Zero, Due, MKR family, Nano 33 (BLE and IoT) and Portenta.
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/index.html
51215c2bd38f-1
Sets the size (in bits) of the value returned by analogRead(). It defaults to 10 bits (returns values between 0-1023) for backward compatibility with AVR based boards. The Zero, Due, MKR family and Nano 33 (BLE and IoT) boards have 12-bit ADC capabilities that can be accessed by changing the resolution to 12. This will return values from analogRead() between 0 and 4095. The Portenta H7 has a 16 bit ADC, which will allow values between 0 and 65535. Syntax analogReadResolution(bits) Parameters bits: determines the resolution (in bits) of the value returned by the analogRead() function. You can set this between 1 and 32. You can set resolutions higher than the supported 12 or 16 bits, but values returned by analogRead() will suffer approximation. See the note below for details. Returns Nothing
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/index.html
51215c2bd38f-2
Returns Nothing Example Code The code shows how to use ADC with different resolutions. void setup() { // open a serial connection Serial.begin(9600); } void loop() { // read the input on A0 at default resolution (10 bits) // and send it out the serial connection analogReadResolution(10); Serial.print("ADC 10-bit (default) : "); Serial.print(analogRead(A0)); // change the resolution to 12 bits and read A0 analogReadResolution(12); Serial.print(", 12-bit : "); Serial.print(analogRead(A0)); // change the resolution to 16 bits and read A0 analogReadResolution(16); Serial.print(", 16-bit : "); Serial.print(analogRead(A0));
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/index.html
51215c2bd38f-3
Serial.print(", 16-bit : "); Serial.print(analogRead(A0)); // change the resolution to 8 bits and read A0 analogReadResolution(8); Serial.print(", 8-bit : "); Serial.println(analogRead(A0)); // a little delay to not hog Serial Monitor delay(100); } Notes and Warnings If you set the analogReadResolution() value to a value higher than your board’s capabilities, the Arduino will only report back at its highest resolution, padding the extra bits with zeros. For example: using the Due with analogReadResolution(16) will give you an approximated 16-bit number with the first 12 bits containing the real ADC reading and the last 4 bits padded with zeros.
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/index.html
51215c2bd38f-4
If you set the analogReadResolution() value to a value lower than your board’s capabilities, the extra least significant bits read from the ADC will be discarded. Using a 16 bit resolution (or any resolution higher than actual hardware capabilities) allows you to write sketches that automatically handle devices with a higher resolution ADC when these become available on future boards without changing a line of code. See also EXAMPLE Description of the analog input pins LANGUAGE analogRead()
https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/index.html
c7209c9ec66a-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Time > Millis millis() [Time] Description Returns the number of milliseconds passed since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days. Syntax time = millis() Parameters None Returns
https://www.arduino.cc/reference/en/language/functions/time/millis/index.html
c7209c9ec66a-1
Syntax time = millis() Parameters None Returns Number of milliseconds passed since the program started. Data type: unsigned long. Example Code This example code prints on the serial port the number of milliseconds passed since the Arduino board started running the code itself. unsigned long myTime; void setup() { Serial.begin(9600); } void loop() { Serial.print("Time: "); myTime = millis(); Serial.println(myTime); // prints time since program started delay(1000); // wait a second so as not to send massive amounts of data } 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.
https://www.arduino.cc/reference/en/language/functions/time/millis/index.html
c7209c9ec66a-2
Reconfiguration of the microcontroller’s timers may result in inaccurate millis() readings. The "Arduino AVR Boards" and "Arduino megaAVR Boards" cores use Timer0 to generate millis(). The "Arduino ARM (32-bits) Boards" and "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" cores use the SysTick timer. See also EXAMPLE Blink Without Delay
https://www.arduino.cc/reference/en/language/functions/time/millis/index.html
e31ef6081090-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Time > Delay delay() [Time] Description Pauses the program for the amount of time (in milliseconds) specified as parameter. (There are 1000 milliseconds in a second.) Syntax delay(ms) Parameters ms: the number of milliseconds to pause. Allowed data types: unsigned long. Returns Nothing
https://www.arduino.cc/reference/en/language/functions/time/delay/index.html
e31ef6081090-1
Returns Nothing Example Code The code pauses the program for one second before toggling the output pin. int ledPin = 13; // LED connected to digital pin 13 void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second } Notes and Warnings
https://www.arduino.cc/reference/en/language/functions/time/delay/index.html
e31ef6081090-2
delay(1000); // waits for a second } Notes and Warnings While it is easy to create a blinking LED with the delay() function and many sketches use short delays for such tasks as switch debouncing, the use of delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the Blink Without Delay sketch, which loops, polling the millis() function until enough time has elapsed. More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10’s of milliseconds unless the Arduino sketch is very simple.
https://www.arduino.cc/reference/en/language/functions/time/delay/index.html
e31ef6081090-3
Certain things do go on while the delay() function is controlling the Atmega chip, however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values and pin states are maintained, and interrupts will work as they should. See also EXAMPLE Blink Without Delay
https://www.arduino.cc/reference/en/language/functions/time/delay/index.html
3fac406ae934-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Time > Delaymicroseconds delayMicroseconds() [Time] Description Pauses the program for the amount of time (in microseconds) specified by the parameter. There are a thousand microseconds in a millisecond and a million microseconds in a second.
https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/index.html
3fac406ae934-1
Currently, the largest value that will produce an accurate delay is 16383; larger values can produce an extremely short delay. This could change in future Arduino releases. For delays longer than a few thousand microseconds, you should use delay() instead. Syntax delayMicroseconds(us) Parameters us: the number of microseconds to pause. Allowed data types: unsigned int. Returns Nothing Example Code The code configures pin number 8 to work as an output pin. It sends a train of pulses of approximately 100 microseconds period. The approximation is due to execution of the other instructions in the code. int outPin = 8; // digital pin 8 void setup() { pinMode(outPin, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(outPin, HIGH); // sets the pin on delayMicroseconds(50); // pauses for 50 microseconds
https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/index.html
3fac406ae934-2
delayMicroseconds(50); // pauses for 50 microseconds digitalWrite(outPin, LOW); // sets the pin off delayMicroseconds(50); // pauses for 50 microseconds } 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. See also
https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/index.html
c4f9cbc817f1-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Time > Micros micros() [Time] Description
https://www.arduino.cc/reference/en/language/functions/time/micros/index.html
c4f9cbc817f1-1
> Micros micros() [Time] Description Returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes. On the boards from the Arduino Portenta family this function has a resolution of one microsecond on all cores. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function has a resolution of four microseconds (i.e. the value returned is always a multiple of four). On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution of eight microseconds. Syntax time = micros() Parameters None Returns Returns the number of microseconds since the Arduino board began running the current program. Data type: unsigned long. Example Code The code returns the number of microseconds since the Arduino board began. unsigned long time; void setup() {
https://www.arduino.cc/reference/en/language/functions/time/micros/index.html
c4f9cbc817f1-2
unsigned long time; void setup() { Serial.begin(9600); } void loop() { Serial.print("Time: "); time = micros(); Serial.println(time); //prints time since program started delay(1000); // wait a second so as not to send massive amounts of data } Notes and Warnings There are 1,000 microseconds in a millisecond and 1,000,000 microseconds in a second. See also
https://www.arduino.cc/reference/en/language/functions/time/micros/index.html
063a6253c273-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Interrupts > Nointerrupts noInterrupts() [Interrupts] Description
https://www.arduino.cc/reference/en/language/functions/interrupts/nointerrupts/index.html
063a6253c273-1
noInterrupts() [Interrupts] 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. Syntax noInterrupts() Parameters None Returns Nothing Example Code The code shows how to enable interrupts. void setup() {} void loop() { noInterrupts(); // critical, time-sensitive code here interrupts(); // other code here } Notes and Warnings Note that disabling interrupts on the Arduino boards with native USB capabilities (e.g., Leonardo) will make the board not appear in the Port menu, since this disables its USB capability. See also
https://www.arduino.cc/reference/en/language/functions/interrupts/nointerrupts/index.html
2dead313b0df-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Interrupts > Interrupts interrupts() [Interrupts] Description
https://www.arduino.cc/reference/en/language/functions/interrupts/interrupts/index.html
2dead313b0df-1
interrupts() [Interrupts] Description Re-enables interrupts (after they’ve been disabled by noInterrupts(). Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code. Syntax interrupts() Parameters None Returns Nothing Example Code The code enables Interrupts. void setup() {} void loop() { noInterrupts(); // critical, time-sensitive code here interrupts(); // other code here } See also LANGUAGE attachInterrupts() LANGUAGE detachInterrupts()
https://www.arduino.cc/reference/en/language/functions/interrupts/interrupts/index.html
159bbe96f1f0-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Sq sq() [Math] Description Calculates the square of a number: the number multiplied by itself. Syntax sq(x) Parameters x: the number. Allowed data types: any data type. Returns The square of the number. Data type: double. Notes and Warnings
https://www.arduino.cc/reference/en/language/functions/math/sq/index.html
159bbe96f1f0-1
Returns The square of the number. Data type: double. Notes and Warnings Because of the way the sq() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results. This code will yield incorrect results: int inputSquared = sq(Serial.parseInt()); // avoid this Use this instead: int input = Serial.parseInt(); // keep other operations outside the sq function int inputSquared = sq(input); See also LANGUAGE abs() LANGUAGE constrain() LANGUAGE map() LANGUAGE max() LANGUAGE min() LANGUAGE pow() LANGUAGE sqrt()
https://www.arduino.cc/reference/en/language/functions/math/sq/index.html
ae61cf23ea76-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Min min() [Math] Description Calculates the minimum of two numbers. Syntax min(x, y) Parameters x: the first number. Allowed data types: any data type. y: the second number. Allowed data types: any data type. Returns The smaller of the two numbers.
https://www.arduino.cc/reference/en/language/functions/math/min/index.html
ae61cf23ea76-1
Returns The smaller of the two numbers. Example Code The code ensures that it never gets above 100. sensVal = min(sensVal, 100); // assigns sensVal to the smaller of sensVal or 100 // ensuring that it never gets above 100. Notes and Warnings Perhaps counter-intuitively, max() is often used to constrain the lower end of a variable’s range, while min() is used to constrain the upper end of the range. Because of the way the min() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results min(a++, 100); // avoid this - yields incorrect results min(a, 100); a++; // use this instead - keep other math outside the function See also LANGUAGE abs() LANGUAGE constrain() LANGUAGE map() LANGUAGE max() LANGUAGE pow() LANGUAGE sq() LANGUAGE sqrt()
https://www.arduino.cc/reference/en/language/functions/math/min/index.html
b0b247fa3e51-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Pow pow() [Math] Description Calculates the value of a number raised to a power. pow() can be used to raise a number to a fractional power. This is useful for generating exponential mapping of values or curves. Syntax pow(base, exponent) Parameters
https://www.arduino.cc/reference/en/language/functions/math/pow/index.html
b0b247fa3e51-1
Syntax pow(base, exponent) Parameters base: the number. Allowed data types: float. exponent: the power to which the base is raised. Allowed data types: float. Returns The result of the exponentiation. Data type: double. Example Code Calculate the value of x raised to the power of y: z = pow(x, y); See the (fscale) sketch for a more complex example of the use of pow(). See also LANGUAGE abs() LANGUAGE constrain() LANGUAGE map() LANGUAGE max() LANGUAGE min() LANGUAGE sq() LANGUAGE sqrt()
https://www.arduino.cc/reference/en/language/functions/math/pow/index.html
509d747787ba-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Max max() [Math] Description Calculates the maximum of two numbers. Syntax max(x, y) Parameters x: the first number. Allowed data types: any data type. y: the second number. Allowed data types: any data type. Returns
https://www.arduino.cc/reference/en/language/functions/math/max/index.html
509d747787ba-1
y: the second number. Allowed data types: any data type. Returns The larger of the two parameter values. Example Code The code ensures that sensVal is at least 20. sensVal = max(sensVal, 20); // assigns sensVal to the larger of sensVal or 20 // (effectively ensuring that it is at least 20) Notes and Warnings Perhaps counter-intuitively, max() is often used to constrain the lower end of a variable’s range, while min() is used to constrain the upper end of the range. Because of the way the max() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results max(a--, 0); // avoid this - yields incorrect results // use this instead: max(a, 0); a--; // keep other math outside the function See also LANGUAGE abs()
https://www.arduino.cc/reference/en/language/functions/math/max/index.html
509d747787ba-2
a--; // keep other math outside the function See also LANGUAGE abs() LANGUAGE constrain() LANGUAGE map() LANGUAGE min() LANGUAGE pow() LANGUAGE sq() LANGUAGE sqrt()
https://www.arduino.cc/reference/en/language/functions/math/max/index.html
8e80ec8b289e-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Abs abs() [Math] Description Calculates the absolute value of a number. Syntax abs(x) Parameters x: the number Returns x: if x is greater than or equal to 0. -x: if x is less than 0. Example Code
https://www.arduino.cc/reference/en/language/functions/math/abs/index.html
8e80ec8b289e-1
-x: if x is less than 0. Example Code Prints the absolute value of variable x to the Serial Monitor. void setup() { Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } int x = 42; Serial.print("The absolute value of "); Serial.print(x); Serial.print(" is "); Serial.println(abs(x)); x = -42; Serial.print("The absolute value of "); Serial.print(x); Serial.print(" is "); Serial.println(abs(x)); } void loop() { } Notes and Warnings Because of the way the abs() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results. abs(a++); // avoid this - yields incorrect results
https://www.arduino.cc/reference/en/language/functions/math/abs/index.html
8e80ec8b289e-2
abs(a++); // avoid this - yields incorrect results // use this instead: abs(a); a++; // keep other math outside the function See also LANGUAGE constrain() LANGUAGE map() LANGUAGE max() LANGUAGE min() LANGUAGE pow() LANGUAGE sq() LANGUAGE sqrt()
https://www.arduino.cc/reference/en/language/functions/math/abs/index.html
1fbeead3ed28-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Constrain constrain() [Math] Description Constrains a number to be within a range. Syntax constrain(x, a, b) Parameters x: the number to constrain Allowed data types: all data types.
https://www.arduino.cc/reference/en/language/functions/math/constrain/index.html
1fbeead3ed28-1
Parameters x: the number to constrain Allowed data types: all data types. a: the lower end of the range. Allowed data types: all data types. b: the upper end of the range. Allowed data types: all data types. Returns x: if x is between a and b. a: if x is less than a. b: if x is greater than b. Example Code The code limits the sensor values to between 10 to 150. sensVal = constrain(sensVal, 10, 150); // limits range of sensor values to between 10 and 150 Notes and Warnings Because of the way the constrain() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results. This code will yield incorrect results: int constrainedInput = constrain(Serial.parseInt(), minimumValue, maximumValue); // avoid this Use this instead:
https://www.arduino.cc/reference/en/language/functions/math/constrain/index.html
1fbeead3ed28-2
Use this instead: int input = Serial.parseInt(); // keep other operations outside the constrain function int constrainedInput = constrain(input, minimumValue, maximumValue); See also LANGUAGE abs() LANGUAGE map() LANGUAGE max() LANGUAGE min() LANGUAGE pow() LANGUAGE sq() LANGUAGE sqrt()
https://www.arduino.cc/reference/en/language/functions/math/constrain/index.html
b977c9f34434-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Map map() [Math] Description Re-maps a number from one range to another. That is, a value of fromLow would get mapped to toLow, a value of fromHigh to toHigh, values in-between to values in-between, etc.
https://www.arduino.cc/reference/en/language/functions/math/map/index.html
b977c9f34434-1
Does not constrain values to within the range, because out-of-range values are sometimes intended and useful. The constrain() function may be used either before or after this function, if limits to the ranges are desired. Note that the "lower bounds" of either range may be larger or smaller than the "upper bounds" so the map() function may be used to reverse a range of numbers, for example y = map(x, 1, 50, 50, 1); The function also handles negative numbers well, so that this example y = map(x, 1, 50, 50, -100); is also valid and works well. The map() function uses integer math so will not generate fractions, when the math might indicate that it should do so. Fractional remainders are truncated, and are not rounded or averaged. Syntax map(value, fromLow, fromHigh, toLow, toHigh) Parameters
https://www.arduino.cc/reference/en/language/functions/math/map/index.html
b977c9f34434-2
Syntax map(value, fromLow, fromHigh, toLow, toHigh) Parameters value: the number to map. fromLow: the lower bound of the value’s current range. fromHigh: the upper bound of the value’s current range. toLow: the lower bound of the value’s target range. toHigh: the upper bound of the value’s target range. Returns The mapped value. Data type: long. Example Code /* Map an analog value to 8 bits (0 to 255) */ void setup() {} void loop() { int val = analogRead(0); val = map(val, 0, 1023, 0, 255); analogWrite(9, val); } Appendix For the mathematically inclined, here’s the whole function
https://www.arduino.cc/reference/en/language/functions/math/map/index.html
b977c9f34434-3
} Appendix For the mathematically inclined, here’s the whole function long map(long x, long in_min, long in_max, long out_min, long out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } Notes & Warnings As previously mentioned, the map() function uses integer math. So fractions might get suppressed due to this. For example, fractions like 3/2, 4/3, 5/4 will all be returned as 1 from the map() function, despite their different actual values. So if your project requires precise calculations (e.g. voltage accurate to 3 decimal places), please consider avoiding map() and implementing the calculations manually in your code yourself. See also LANGUAGE abs() LANGUAGE constrain() LANGUAGE max() LANGUAGE min() LANGUAGE pow() LANGUAGE sq()
https://www.arduino.cc/reference/en/language/functions/math/map/index.html
b977c9f34434-4
LANGUAGE constrain() LANGUAGE max() LANGUAGE min() LANGUAGE pow() LANGUAGE sq() LANGUAGE sqrt()
https://www.arduino.cc/reference/en/language/functions/math/map/index.html
c35072357433-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Math > Sqrt sqrt() [Math] Calculates the square root of a number. Description Syntax sqrt(x) Parameters x: the number. Allowed data types: any data type. Returns The number’s square root. Data type: double. See also LANGUAGE abs() LANGUAGE constrain()
https://www.arduino.cc/reference/en/language/functions/math/sqrt/index.html
c35072357433-1
See also LANGUAGE abs() LANGUAGE constrain() LANGUAGE map() LANGUAGE max() LANGUAGE min() LANGUAGE pow() LANGUAGE sq()
https://www.arduino.cc/reference/en/language/functions/math/sqrt/index.html
9ef2e06b8dfd-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Trigonometry > Cos cos() [Trigonometry] Description Calculates the cosine of an angle (in radians). The result will be between -1 and 1. Syntax cos(rad) Parameters rad: The angle in radians. Allowed data types: float. Returns
https://www.arduino.cc/reference/en/language/functions/trigonometry/cos/index.html
9ef2e06b8dfd-1
Parameters rad: The angle in radians. Allowed data types: float. Returns The cos of the angle. Data type: double. See also LANGUAGE float LANGUAGE double
https://www.arduino.cc/reference/en/language/functions/trigonometry/cos/index.html
594b6cf73ae5-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Trigonometry > Tan tan() [Trigonometry] Description Calculates the tangent of an angle (in radians). The result will be between negative infinity and infinity. Syntax tan(rad) Parameters rad: The angle in radians. Allowed data types: float. Returns
https://www.arduino.cc/reference/en/language/functions/trigonometry/tan/index.html
594b6cf73ae5-1
Parameters rad: The angle in radians. Allowed data types: float. Returns The tangent of the angle. Data type: double. See also LANGUAGE float LANGUAGE double
https://www.arduino.cc/reference/en/language/functions/trigonometry/tan/index.html
41987f552304-0
Language functions variables structure Libraries IoT Cloud API Glossary The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. Last Revision: Searching... Last Build: 2023/06/30 Edit This Page Reference > Language > Functions > Trigonometry > Sin sin() [Trigonometry] Description Calculates the sine of an angle (in radians). The result will be between -1 and 1. Syntax sin(rad) Parameters rad: The angle in radians. Allowed data types: float. Returns
https://www.arduino.cc/reference/en/language/functions/trigonometry/sin/index.html
41987f552304-1
Parameters rad: The angle in radians. Allowed data types: float. Returns The sine of the angle. Data type: double. See also LANGUAGE float LANGUAGE double
https://www.arduino.cc/reference/en/language/functions/trigonometry/sin/index.html
60f3b4b5286e-0
Sprache Funktionen Variablen Struktur Bibliotheken IoT Cloud API Glossar Der Arduino-Referenztext ist lizenziert unter der Creative Commons Attribution-Share Alike 3.0 Lizenz. Findest du etwas, das verbessert werden kann? Über GitHub kannst du Korrekturen und neue Dokumentation vorschlagen. Zweifel, wie man Github benutzt? Erfahre in diesem Tutorial alles, was du wissen musst. Sprach-Referenz Die Programmiersprache von Arduino kann in drei Hauptteile unterteilt werden: Struktur, Werte (Variablen und Konstanten) und Funktionen. Funktionen Zum Steuern des Arduino-Boards und zur Durchführung von Berechnungen. Digital I/O digitalRead()
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-1
Digital I/O digitalRead() digitalWrite() pinMode() Analog I/O analogRead() analogReference() analogWrite() Zero-, Due-, MKR-Familie analogReadResolution() analogWriteResolution() Advanced I/O noTone() pulseIn() pulseInLong() shiftIn() shiftOut() tone() Zeit delay() delayMicroseconds() micros() millis() Mathematik abs()
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-2
millis() Mathematik abs() constrain() map() max() min() pow() sq() sqrt() Trigonometrie cos() sin() tan() Zeichen isAlpha() isAlphaNumeric() isAscii() isControl() isDigit() isGraph() isHexadecimalDigit() isLowerCase() isPrintable() isPunct()
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-3
isPrintable() isPunct() isSpace() isUpperCase() isWhitespace() Zufallszahlen random() randomSeed() Bits und Bytes bit() bitClear() bitRead() bitSet() bitWrite() highByte() lowByte() Externe Interrupts attachInterrupt() detachInterrupt() Interrupts interrupts() noInterrupts() Kommunikation Serial SPI
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-4
Kommunikation Serial SPI Stream Wire USB Keyboard Mouse Variablen Arduino-Datentypen und -konstanten. Konstanten Gleitkommazahlkonstanten Integer-Konstanten HIGH | LOW INPUT | OUTPUT | INPUT_PULLUP LED_BUILTIN true | false Umwandlung (unsigned int) (unsigned long) byte() char() float() int() long() word() Datentypen
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-5
word() Datentypen array bool boolean byte char const double float int long scope short size_t static string String() unsigned char unsigned int unsigned long void volatile word Variablenscope und Bezeichner Hilfsmittel PROGMEM
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-6
Hilfsmittel PROGMEM sizeof() Struktur Die Elemente der Arduino (C++) Programmiersprache. Sketch loop() setup() Kontrollstruktur break continue do...while else for goto if return switch...case while Weitere Syntax #define (define) #include (include) /* */ (Kommentarblock) //
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-7
(Kommentarblock) // (Einzeiliger Kommentar) ; (Semikolon) {} (Geschweifte Klammern) Arithmetische Operatoren % (Modulo) * (Multiplikation) + (Addition) - (Subtraktion) / (Division) = (Zuweisung) Vergleichsoperatoren != (Ungleich) <
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-8
!= (Ungleich) < (Kleiner) <= (Kleiner oder gleich) == (Gleich) > (Größer) >= (Größer oder gleich) Boolsche Operatoren ! (Logisches NICHT) && (Logisches UND) || (Logisches ODER) Zeiger-Operatoren & (Referenzoperator) * (Dereferenzoperator)
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-9
* (Dereferenzoperator) Bitweise Operatoren & (Bitweises UND) << (Bitshift links) >> (Bitshift rechts) ^ (Bitweises XOR) | (Bitweises OR) ~ (Bitweises NICHT) Verbundoperatoren %= (Zusammengesetzter Rest) &= (Zusammengesetztes Bitweises AND) *= (Zusammengesetzte Multiplikation)
https://www.arduino.cc/reference/de/index.html
60f3b4b5286e-10
*= (Zusammengesetzte Multiplikation) ++ (Inkrement) += (Zusammengesetzte Addition) -- (Dekrement) -= (Zusammengesetzte Subtraktion) /= (Zusammengesetzte Division) |= (Zusammengesetztes Bitweises ODER)
https://www.arduino.cc/reference/de/index.html
a9da749926a8-0
Sprache Funktionen Variablen Struktur Bibliotheken IoT Cloud API Glossar Der Arduino-Referenztext ist lizenziert unter der Creative Commons Attribution-Share Alike 3.0 Lizenz. Findest du etwas, das verbessert werden kann? Über GitHub kannst du Korrekturen und neue Dokumentation vorschlagen. Zweifel, wie man Github benutzt? Erfahre in diesem Tutorial alles, was du wissen musst. Last Revision: Searching... Last Build: 2023/06/30 Bearbeite diese Seite Reference > Language > Structure > Further syntax > Include #include [Further Syntax] Beschreibung #include wird verwendet, um externe Bibliotheken in den Sketch aufzunehmen.
https://www.arduino.cc/reference/de/language/structure/further-syntax/include/index.html
a9da749926a8-1
#include wird verwendet, um externe Bibliotheken in den Sketch aufzunehmen. Dadurch erhält der Programmierer Zugriff auf eine große Gruppe von Standard-C-Bibliotheken (Gruppen vorgefertigter Funktionen) sowie auf speziell für Arduino geschriebene Bibliotheken. Die Hauptreferenzseite für AVR C-Bibliotheken (AVR ist eine Referenz auf die Atmel-Chips, auf denen der Arduino basiert) ist hier. Beachte, dass #include, ähnlich wie #define kein Semikolon-Abschlusszeichen enthält und der Compiler bei der Eingabe kryptische Fehlermeldungen ausgibt. Syntax #include <LibraryFile.h> #include "LocalFile.h" Parameter
https://www.arduino.cc/reference/de/language/structure/further-syntax/include/index.html
a9da749926a8-2
Syntax #include <LibraryFile.h> #include "LocalFile.h" Parameter LibraryFile.h: Wenn die Syntax der spitzen Klammern verwendet wird, werden die Bibliothekspfade nach der Datei durchsucht. LocalFile.h: Wenn die Syntax in doppelten Anführungszeichen verwendet wird, wird der Ordner der Datei mit der Direktive #include nach der angegebenen Datei durchsucht. Anschließend wird in den Bibliothekspfaden gesucht, wenn sie nicht im lokalen Pfad gefunden wurden. Verwende diese Syntax für Header-Dateien im Ordner des Sketches. Beispielcode Dieses Beispiel enthält die Servobibliothek, sodass ihre Funktionen zur Steuerung eines Servomotors verwendet werden können. #include <Servo.h>
https://www.arduino.cc/reference/de/language/structure/further-syntax/include/index.html
a9da749926a8-3
#include <Servo.h> Servo myservo; // Servoobjekt erstellen, um einen Servomotor zu steuern void setup() { myservo.attach(9); // Bindet den Servomotor an Pin 9 an das Servoobjekt } void loop() { for (int pos = 0; pos <= 180; pos += 1) { // Geht von 0 Grad bis 180 Grad // in 1 Grad-Stufen myservo.write(pos); // Servo anweisen, in Position von Variable 'pos' zu gehen delay(15); // Wartet 15ms, bis der Servomotor die Position erreicht hat } for (int pos = 180; pos >= 0; pos -= 1) { // Geht von 180 Grad bis 0 Grad
https://www.arduino.cc/reference/de/language/structure/further-syntax/include/index.html
a9da749926a8-4
myservo.write(pos); // Servo anweisen, in Position von Variable 'pos' zu gehen delay(15); // Wartet 15ms, bis der Servomotor die Position erreicht hat } } Siehe auch
https://www.arduino.cc/reference/de/language/structure/further-syntax/include/index.html
bbf290c51d6d-0
Sprache Funktionen Variablen Struktur Bibliotheken IoT Cloud API Glossar Der Arduino-Referenztext ist lizenziert unter der Creative Commons Attribution-Share Alike 3.0 Lizenz. Findest du etwas, das verbessert werden kann? Über GitHub kannst du Korrekturen und neue Dokumentation vorschlagen. Zweifel, wie man Github benutzt? Erfahre in diesem Tutorial alles, was du wissen musst. Last Revision: Searching... Last Build: 2023/06/30 Bearbeite diese Seite Reference > Language > Structure > Further syntax > Define #define [Further Syntax] Beschreibung
https://www.arduino.cc/reference/de/language/structure/further-syntax/define/index.html
bbf290c51d6d-1
> Define #define [Further Syntax] Beschreibung #define ist eine nützliche C ++ - Komponente, mit der der Programmierer einem konstanten Wert einen Namen geben kann, bevor das Programm kompiliert wird. Definierte Konstanten in Arduino belegen keinen Programmspeicherplatz auf dem Chip. Der Compiler ersetzt zur Kompilierzeit Verweise auf diese Konstanten durch den definierten Wert. Dies kann jedoch einige unerwünschte Nebenwirkungen haben, wenn zum Beispiel ein konstanter Name, der #defined wurde, in einer anderen Konstanten- oder Variablenname enthalten ist. In diesem Fall würde der Text durch die #definierte Nummer (oder den Text) ersetzt.
https://www.arduino.cc/reference/de/language/structure/further-syntax/define/index.html
bbf290c51d6d-2
Generell sollte das const-Schlüsselwort für die Definition von Konstanten bevorzugt und anstelle von #define verwendet werden. Syntax #define Konstantenname Wert Parameter Konstantenname: Der Name des zu definierenden Makros. Wert: Der Wert, der dem Makro zugewiesen werden soll. Beispielcode #define ledPin 3 // Der Compiler ersetzt alle Erwähnungen von ledPin zur Kompilierzeit durch den Wert 3. Anmerkungen und Warnungen Es gibt kein Semikolon nach der Anweisung #define. Wenn eines hinzufügt wird, so wirft der Compiler weiter unten auf der Seite kryptische Fehler aus. #define ledPin 3; // Das ist ein Fehler
https://www.arduino.cc/reference/de/language/structure/further-syntax/define/index.html
bbf290c51d6d-3
#define ledPin 3; // Das ist ein Fehler Wenn ein Gleichheitszeichen nach der Anweisung #define einfügt wird, wird ebenfalls ein kryptischer Compiler-Fehler weiter unten auf der Seite generiert. #define ledPin = 3 // Das ist auch ein Fehler Siehe auch SPRACHE const SPRACHE Konstanten
https://www.arduino.cc/reference/de/language/structure/further-syntax/define/index.html
324590daccbb-0
Sprache Funktionen Variablen Struktur Bibliotheken IoT Cloud API Glossar Der Arduino-Referenztext ist lizenziert unter der Creative Commons Attribution-Share Alike 3.0 Lizenz. Findest du etwas, das verbessert werden kann? Über GitHub kannst du Korrekturen und neue Dokumentation vorschlagen. Zweifel, wie man Github benutzt? Erfahre in diesem Tutorial alles, was du wissen musst. Last Revision: Searching... Last Build: 2023/06/30 Bearbeite diese Seite Reference > Language > Structure > Further syntax > Blockcomment /* */ [Further Syntax] Beschreibung
https://www.arduino.cc/reference/de/language/structure/further-syntax/blockcomment/index.html
324590daccbb-1
/* */ [Further Syntax] Beschreibung Kommentare sind Zeilen im Programm, die dazu dienen, sich oder andere über die Funktionsweise des Programms zu informieren. Sie werden vom Compiler ignoriert und nicht in den Prozessor exportiert, sodass sie keinen Platz im Flash-Speicher des Mikrocontrollers beanspruchen. Der einzige Zweck von Kommentaren besteht darin, zu helfen (zu verstehen oder sich daran zu erinnern) oder andere über die Funktionsweise des Programms zu informieren. Der Anfang eines Blockkommentars oder eines mehrzeiligen Kommentars ist mit dem Symbol /* gekennzeichnet und das Symbol */ markiert sein Ende.
https://www.arduino.cc/reference/de/language/structure/further-syntax/blockcomment/index.html
324590daccbb-2
Diese Art von Kommentar wird aufgerufen, da sich dieser über mehrere Zeilen erstrecken kann. Sobald der Compiler das /* liest, ignoriert er alles, was folgt, bis er ein */ findet. Beispielcode /* Dies ist ein gültiger Kommentar */ /* Blink Schaltet eine LED für eine Sekunde ein und dann für eine Sekunde wiederholt aus. Dieser Beispielcode ist im öffentlichen Bereich. (Ein weiterer gültiger Kommentar) */ /* if (gwb == 0) { // Ein einzeiliger Kommentar ist in einem mehrzeiligen Kommentar in Ordnung x = 3; /* aber kein weiterer mehrzeiliger Kommentar - das ist ungültig */ }
https://www.arduino.cc/reference/de/language/structure/further-syntax/blockcomment/index.html
324590daccbb-3
} // Vergiss nicht den abschließenden Kommentar - Die Klammern müssen zusammenpassen! */ Anmerkungen und Warnungen Beim Experimentieren mit Code ist das Herauskommentieren von Programmteilen eine bequeme Möglichkeit, fehlerhafte Zeilen zu entfernen. Dadurch bleiben die Zeilen im Code erhalten, werden jedoch in Kommentare umgewandelt, sodass der Compiler sie einfach ignoriert. Dies kann besonders nützlich sein, wenn du versuchst, ein Problem zu finden, oder wenn ein Programm die Kompilierung ablehnt und der Compilerfehler kryptisch oder nicht hilfreich ist. Siehe auch
https://www.arduino.cc/reference/de/language/structure/further-syntax/blockcomment/index.html
d29f9dd9ae5f-0
Sprache Funktionen Variablen Struktur Bibliotheken IoT Cloud API Glossar Der Arduino-Referenztext ist lizenziert unter der Creative Commons Attribution-Share Alike 3.0 Lizenz. Findest du etwas, das verbessert werden kann? Über GitHub kannst du Korrekturen und neue Dokumentation vorschlagen. Zweifel, wie man Github benutzt? Erfahre in diesem Tutorial alles, was du wissen musst. Last Revision: Searching... Last Build: 2023/06/30 Bearbeite diese Seite Reference > Language > Structure > Further syntax > Curlybraces {} [Further Syntax] Beschreibung
https://www.arduino.cc/reference/de/language/structure/further-syntax/curlybraces/index.html
d29f9dd9ae5f-1
{} [Further Syntax] Beschreibung Geschweifte Klammern (auch als "geschweifte Klammern" oder "geschweifte Klammern" bezeichnet) sind ein Hauptbestandteil der Programmiersprache C ++. Sie werden in mehreren verschiedenen Konstrukten verwendet (siehe unten), was für Anfänger manchmal verwirrend sein kann. Auf eine öffnende geschweifte Klammer { muss immer eine schließende geschweifte Klammer } folgen. Dies ist eine Bedingung, die oft als ausgeglichene Klammern bezeichnet wird. Die Arduino IDE (Integrated Development Environment) enthält eine praktische Funktion zum Überprüfen des Gleichgewichts von geschweiften Klammern.
https://www.arduino.cc/reference/de/language/structure/further-syntax/curlybraces/index.html
d29f9dd9ae5f-2
Wähle einfach eine geschweifte Klammer aus oder klicke auf die Einfügemarke unmittelbar nach einer geschweiften Klammer. Der logische Begleiter wird hervorgehoben. Anfänger und Programmierer, die aus der BASIC-Sprache zu C ++ kommen, finden Klammern oft verwirrend oder abschreckend. Letztendlich aber, ersetzen dieselben geschweiften Klammern die RETURN-Anweisung in einer Subroutine (Funktion), die ENDIF-Anweisung in einer Bedingung und die NEXT-Anweisung in einer FOR-Schleife. Unausgeglichene geschweifte Klammern können oft zu kryptischen, undurchdringlichen Compiler-Fehlern führen, die in einem großen Programm manchmal schwer zu finden sind.
https://www.arduino.cc/reference/de/language/structure/further-syntax/curlybraces/index.html
d29f9dd9ae5f-3
Aufgrund ihrer unterschiedlichen Verwendungsmöglichkeiten sind Klammern auch für die Syntax eines Programms unglaublich wichtig. Wenn du eine oder zwei Zeilen einer Klammer verschiebst, hat dies oft einen dramatischen Einfluss auf die Bedeutung eines Programms. Beispielcode Die Hauptanwendungen von geschweiften Klammern sind in den folgenden Beispielen aufgeführt. Funktionen void myFunction(Datentyp Argument){ // Beliebige Anweisung(en) } Schleifen while (Boolean-Ausdruck) { // Beliebige Anweisung(en) } do { // Beliebige Anweisung(en) } while (Boolean-Ausdruck); for (Initialisierung; Schlussbedingung; inkrementierender Ausdruck) {
https://www.arduino.cc/reference/de/language/structure/further-syntax/curlybraces/index.html
d29f9dd9ae5f-4
// Beliebige Anweisung(en) } Bedingte Anweisungen if (Boolean-Ausdruck) { // Beliebige Anweisung(en) } else if (Boolean-Ausdruck) { // Beliebige Anweisung(en) } else { // Beliebige Anweisung(en) } Siehe auch
https://www.arduino.cc/reference/de/language/structure/further-syntax/curlybraces/index.html
2f4c6fabc86a-0
Sprache Funktionen Variablen Struktur Bibliotheken IoT Cloud API Glossar Der Arduino-Referenztext ist lizenziert unter der Creative Commons Attribution-Share Alike 3.0 Lizenz. Findest du etwas, das verbessert werden kann? Über GitHub kannst du Korrekturen und neue Dokumentation vorschlagen. Zweifel, wie man Github benutzt? Erfahre in diesem Tutorial alles, was du wissen musst. Last Revision: Searching... Last Build: 2023/06/30 Bearbeite diese Seite Reference > Language > Structure > Further syntax > Semicolon ; [Further Syntax] Beschreibung Wird verwendet, um eine Anweisung zu beenden. Beispielcode
https://www.arduino.cc/reference/de/language/structure/further-syntax/semicolon/index.html