Lesson 6: The Serial Monitor
หน้านี้ต้องใช้เบราว์เซอร์ล่าสุด (รองรับ SharedArrayBuffer) กรุณาอัปเดต Chrome, Edge, Firefox หรือ Safari เป็นเวอร์ชันล่าสุด
English
The board can talk
Serial.begin(9600);opens the cable to the computer at 9600 bits per second.Serial.println("Hi");sends a line. You see it under the board, in the Serial Monitor.Serial.printdoes the same without a new line.
int count = 0;
void setup() {
Serial.begin(9600);
Serial.println("Hello!");
}
void loop() {
count = count + 1;
Serial.print("Count: ");
Serial.println(count);
delay(1000);
}
- This is how Arduino programmers find bugs: print the numbers and look at them.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Print Hello, Arduino! once, when the board starts.
คลิก Run เพื่อดูผลลัพธ์ที่นี่
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Count down: print 5, 4, 3, 2, 1 (one number on each line), then Go!. Use a for loop in setup().
คลิก Run เพื่อดูผลลัพธ์ที่นี่