@@ -5,15 +5,15 @@ tags: [Reference, Arduino API]
5
5
author : Karl Söderby
6
6
---
7
7
8
- Compact version of the [ Arduino Language Reference] ( https://www.arduino.cc/reference/en/ ) .
8
+ Compact version of the [ Arduino Language Reference] ( https://www.arduino.cc/reference/en/ ) . This document is a ** TLDR; ** of the Arduino API.
9
9
10
- *** Please note that as of 2024/01/05, this article is a work in progress.***
10
+ *** Please note that as of 2024/01/05, this article is still a work in progress.***
11
11
12
12
## Functions
13
13
14
14
### Digital I/O
15
15
16
- | Method | Description | Returns |
16
+ | Method & Parameters | Description | Returns |
17
17
| --------------------------------------- | --------------------------------- | ------- |
18
18
| ` int digitalRead(int pin) ` | Reads the state of a digital pin. | ` int ` |
19
19
| ` void digitalWrite(int pin, int state) ` | Writes a state to a digital pin. | Nothing |
@@ -28,16 +28,17 @@ Compact version of the [Arduino Language Reference](https://www.arduino.cc/refer
28
28
29
29
### Analog I/O
30
30
31
- | Method | Description | Returns |
32
- | -------------------------------------------- | ---------------------------------------------- | ------------------------------- ------- |
33
- | ` int analogRead(int pin) ` | Reads the value of an analog pin. | ` int ` - value from the ADC (0-1023). \* |
34
- | ` void analogReadResolution(int resolution) ` | Sets ADC read resolution in bits. | Nothing |
35
- | ` void analogReference(int reference) ` | Changes the voltage reference for a board.** | Nothing |
36
- | ` void analogWrite(int pin, int value) ` | Writes a value to a PWM supported pin (0-255). | Nothing |
37
- | ` void analogWriteResolution(int resolution) ` | Sets write resolution for a board. | Nothing |
31
+ | Method & Parameters | Description | Returns |
32
+ | -------------------------------------------- | ---------------------------------------------------------------------- | ------- |
33
+ | ` int analogRead(int pin) ` | Reads the value of an analog pin in a 10-bit resolution (0-1023). \* | ` int ` |
34
+ | ` void analogReadResolution(int resolution) ` | Sets ADC read resolution in bits. | Nothing |
35
+ | ` void analogReference(int reference) ` | Changes the voltage reference for a board.** | Nothing |
36
+ | ` void analogWrite(int pin, int value) ` | Writes a value to a PWM supported pin in a 8-bit resolution (0-255).** | Nothing |
37
+ | ` void analogWriteResolution(int resolution) ` | Sets write resolution for a board. | Nothing |
38
38
39
39
- \* The value range changes based on the resolution. 0-1023 is 10-bit resolution, 0-4096 is 12-bit and so on.
40
- - ** Each board/architecture has a set of different reference voltages available. See the [ analog reference page] ( ) for more details.
40
+ - ** Each board/architecture has a set of different reference voltages available.
41
+ - *** The value range changes based on the resolution. 0-255 is default (8-bit).
41
42
42
43
### Advanced I/O
43
44
@@ -146,7 +147,7 @@ Compact version of the [Arduino Language Reference](https://www.arduino.cc/refer
146
147
| --------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------- |
147
148
| ` int available() ` | Returns the number of bytes available in the serial buffer. | ` int ` |
148
149
| ` int read() ` | Reads the next byte from the serial buffer. | ` int ` |
149
- | ` void flush() ` | Waits for the transmission of outgoing serial data to complete. | |
150
+ | ` void flush() ` | Waits for the transmission of outgoing serial data to complete. | Nothing |
150
151
| ` int find(char *target) ` | Searches for a target string in the serial buffer. | ` int ` |
151
152
| ` int findUntil(char *target, char *terminate) ` | Searches for a target string until a specified termination string is found. | ` int ` |
152
153
| ` int peek() ` | Returns the next byte in the serial buffer without removing it. | ` int ` |
@@ -156,7 +157,7 @@ Compact version of the [Arduino Language Reference](https://www.arduino.cc/refer
156
157
| ` String readStringUntil(char terminator) ` | Reads characters from the serial buffer into a String until a specified terminator is found. | ` String ` |
157
158
| ` int parseInt() ` | Reads characters from the serial buffer and converts them to an integer. | ` int ` |
158
159
| ` float parseFloat() ` | Reads characters from the serial buffer and converts them to a float. | ` float ` |
159
- | ` void setTimeout(unsigned long timeout) ` | Sets the maximum duration for ` find() ` , ` findUntil() ` , ` parseInt() ` , and ` parseFloat() ` . | |
160
+ | ` void setTimeout(unsigned long timeout) ` | Sets the maximum duration for ` find() ` , ` findUntil() ` , ` parseInt() ` , and ` parseFloat() ` . | Nothing |
160
161
161
162
### Serial
162
163
0 commit comments