lap trinh stm32 arduino
Đầu tiên các bạn cài IDE Arduino
SETUP STM32_Arduino
B1: Cài đặt Arduino IDE
– Link: https://www.arduino.cc/en/Main/Donate
– Cài đặt Board Arduino DUE
B2: Tải File STM32 và Cài đặt
– Link: https://github.com/rogerclarkmelbourn…
– Ðổi tên thành STM32
– Copy đến thư mục: C:\Program Files (x86)\Arduino\hardware
– Cài đặt drivers:
+ C:\Program Files (x86)\Arduino\hardware\STM32\drivers\win
+ chạy file: install_drivers, install_STM_COM_drivers
– Cài đặt Tool:
+ C:\Program Files (x86)\Arduino\hardware\STM32\tools\win
+ chạy file: stlink_upload, serial_upload, maple_upload.
B3: Thiết lập cài đặt co bản và test
– Cài đặt preferences: build.path = E:\ARDUINO\File_Hex
– Copy file: rxtxSerial.dll đến thu mục C:\Program Files (x86)\Arduino
Viết chương trình đầu tiên Nháy led Arduino
Trên Board STM32F103C8T6 các bạn mua bất cứ đâu
B1:mở arduino bình thường chon board stm32f103c8
#define led PC13 //port 13 trên board
#define LED_PIN PB9 // TIMER4
void setup() {
// put your setup code here, to run once:
pinMode(led, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(100);
}// wait for a second
}
B2:vào mục upload method dùng mạch nạp stlink
sau đó nạp chương trình như bình thường !
Tải thư viện :Arduino_STM32-master (1)
tải thư viện rxtxSerial.dll :