Arduino Xin chào thế giới

Phần cứng cần chuẩn bị

1×Arduino Uno R3 Amazon
1×USB 2.0 cable type A/B (for USB-A PC) Amazon
1×USB 2.0 cable type C/B (for USB-C PC) Amazon
1×(Khuyến nghị) Screw Terminal Block Shield for Arduino Uno Amazon
1×(Khuyến nghị) Sensors/Servo Expansion Shield for Arduino Uno Amazon
1×(Khuyến nghị) Breadboard Shield for Arduino Uno Amazon
1×(Khuyến nghị) Enclosure for Arduino Uno Amazon
1×(Khuyến nghị) Prototyping Base Plate & Breadboard Kit for Arduino UNO Amazon

Or you can buy the following kits:

1×DIYables STEM V3 Starter Kit (Arduino included) Amazon
1×DIYables Sensor Kit (18 sensors/displays) Amazon
Tiết lộ: Một số liên kết trong bài viết này là liên kết tiếp thị Amazon và có thể nhận hoa hồng theo chính sách của chương trình.

Các bước nhanh chóng

  • Kết nối Arduino với PC bằng cáp USB.
  • Mở Arduino IDE.
  • Chọn bo mạch Arduino.
Arduino ide - cách chọn bo mạch Arduino
  • Chọn cổng nối tiếp Arduino (số hiệu có thể khác nhau)
Arduino ide - cách chọn cổng com
  • Gõ đoạn mã sau đây
void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: Serial.println("Hello World!"); delay(1000); }
  • Nhấp nút Upload trên Arduino IDE để tải mã lên Arduino
Arduino ide - cách nạp chương trình
  • Mở Serial Monitor bằng cách nhấp vào biểu tượng Serial Monitor
Arduino ide - cách mở serial monitor
  • Xem kết quả trên Serial Monitor:
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
Arduino Uno
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Uno' on 'COM15')
New Line
9600 baud
Hello World! Hello World! Hello World!
Ln 11, Col 1
Arduino Uno on COM15
2

Chỉnh sửa mã Arduino

  • Thay thế “Hello World!” bằng bất kỳ văn bản nào, ví dụ, “Arduino Get Started”.
  • Nạp mã vào Arduino
  • Xem kết quả trên Serial Monitor
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
Arduino Uno
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Uno' on 'COM15')
New Line
9600 baud
Arduino Get Started
Ln 11, Col 1
Arduino Uno on COM15
2

Video Tutorial

Việc sản xuất video tốn rất nhiều thời gian. Nếu video hướng dẫn hữu ích cho việc học của bạn, hãy đăng ký kênh YouTube để ủng hộ. Nếu nhu cầu đủ cao, chúng tôi sẽ cố gắng làm thêm nhiều video.

Các tham chiếu hàm

Xin chúc mừng!
Bạn vừa mới hoàn thành bước đầu tiên trên hành trình học Arduino. Hãy tiến lên!