1. Demo
2. Code
// the setup routine runs once when you press reset:void setup() {
// initialize the serial
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
int i = 0;
void loop() {
Serial.write("*** Test(");
Serial.print(i);
Serial.write(") ***\n");
delay(100);
i++;
}
3. Description
- Serial communication is to display a text string. You can see the string on the serial monitor.- Serial.print and Serial.println
: Serial.print is to display a text string without '\n'
: Serial.println is to display a text string with '\n'. '\n' means next line.
- Serial.write
: Serial.write can have '\n' in the text string.
댓글 없음:
댓글 쓰기