Code Analysis
setup(){
}
The
setup()
function is called when a sketch starts. Use it to initialize variables, pin modes,
start using libraries, etc. The
setup()
function will only run once, after each powerup or reset of
the Arduino board.
loop(){
}
After creating a
setup()
function, which initializes and sets the initial values, the
loop()
function does precisely what its name suggests, and loops consecutively, allowing your program
to change and respond. Use it to actively control the Arduino board.
int
ledPin =
4
;
Description:
Converts a value to the int data type.
Syntax:
int(
x) or (int)x (C-style type conversion)
Parameters:
x: a value. Allowed data types: any type.
Assigned an
int
type 4 to variable named ledPin.
pinMode(ledPin, OUTPUT);
Description:
Configures the specified pin to behave either as an input or an output. See the Digital Pins page
for details on the functionality of the pins.
As of Arduino 1.0.1, it is possible to enable the internal pull-up resistors with the mode
INPUT_PULLUP
. Additionally, the
INPUT
mode explicitly disables the internal pullups.
Syntax:
pinMode(
pin, mode)
Parameters:
12
Grove Beginner Kit For Arduino
®
Содержание Grove Beginner Kit
Страница 1: ...Grove Beginner Kit For Arduino User Manual ...
Страница 63: ...62 Grove Beginner Kit For Arduino ...