
Code Analysis
Serial.begin(
9600
);
Description:
Sets the data rate in bits per second (baud) for serial data transmission. For communicating with
Serial Monitor, make sure to use one of the baud rates listed in the menu at the bottom right
corner of its screen. You can, however, specify other rates - for example, to communicate over
pins 0 and 1 with a component that requires a particular baud rate.
An optional second argument configures the data, parity, and stop bits. The default is 8 data bits,
no parity, one stop bit.
The software running on the computer communicates with the development board, and the baud
rate is 9600.
Syntax:
Serial.begin(
speed)
Parameters:
speed: Speed of Serial communication. i.e
9600
,
115200
and etc.
Set the Serial baud rate to 9600.
Serial.println(sensorValue);
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) or Serial.println(val, format)
Parameters:
val: the value to print. Allowed data types: any data type.
format: specifies the number base (for integral data types) or the number of decimal places (for
floating point types).
Serial port print the Light sensor’s value. So you open the
serial monitor on the IED interface,
and you see the value of the output sensor.
32
Grove Beginner Kit For Arduino
®