Car Code Details
Car Code Details
pinMode()
[Digital I/O]
Description
Syntax
pinMode(pin, mode)
Parameters
digitalWrite()
[Digital I/O]
Description
Write a HIGH or a LOW value to a digital pin.
If the pin has been configured as an OUTPUT with pinMode(), its voltage
will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for
HIGH, 0V (ground) for LOW.
Syntax
digitalWrite(pin, value)
Parameters
Serial.available()
Description
Get the number of bytes (characters) available for reading from the
serial port. This is data that’s already arrived and stored in the serial
receive buffer (which holds 64 bytes).
Serial.available()
Parameters
Serial: serial port object. See the list of available serial ports for each
board on the Serial main page
Serial.read()
Description
Syntax
Serial.read()
Parameters
Serial: serial port object. See the list of available serial ports for each
board on the Serial main page .
analogWrite()
[Analog I/O]
Description
Writes an analog value (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.
0 - 8, 10, A3 (18),
MKR boards * 732 Hz
A4 (19)
0 - 8, 10, 11, A3
MKR1000 WiFi * 732 Hz
(18), A4 (19)
3 - 13, A0 (14), A1
Zero * 732 Hz
(15)
* In addition to PWM capabilities on the pins noted above, the MKR and
Zero boards have true analog output when using analogWrite() on the
DAC0 (A0) pin.
** In addition to PWM capabilities on the pins noted above, the Due has
true analog output when using analogWrite() on pins DAC0 and DAC1.
You do not need to call pinMode() to set the pin as an output before
calling analogWrite(). The analogWrite function has nothing to do with
the analog pins or the analogRead function.
Syntax
analogWrite(pin, value)
Parameters
pin: the Arduino pin to write to. Allowed data types: int.
value: the duty cycle: between 0 (always off) and 255 (always on).
Allowed data types: int.
analogWrite()
[Analog I/O]
Description
Writes an analog value (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.
0 - 8, 10, A3 (18),
MKR boards * 732 Hz
A4 (19)
(18), A4 (19)
3 - 13, A0 (14), A1
Zero * 732 Hz
(15)
* In addition to PWM capabilities on the pins noted above, the MKR and
Zero boards have true analog output when using analogWrite() on the
DAC0 (A0) pin.
** In addition to PWM capabilities on the pins noted above, the Due has
true analog output when using analogWrite() on pins DAC0 and DAC1.
You do not need to call pinMode() to set the pin as an output before
calling analogWrite(). The analogWrite function has nothing to do with
the analog pins or the analogRead function.
Syntax
analogWrite(pin, value)
Parameters
pin: the Arduino pin to write to. Allowed data types: int.
value: the duty cycle: between 0 (always off) and 255 (always on).
Allowed data types: int
Serial.println()
Description
Prints data to the serial port as human-readable ASCII text followed by
a carriage return character (ASCII 13, or '\r') and a newline character
(ASCII 10, or '\n'). This command takes the same forms as
Serial.print() .
Syntax
Serial.println(val)
Serial.println(val, format)
Parameters
Serial: serial port object. See the list of available serial ports for each
board on the 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).