Cov txheej txheem:

Tswj DC Motors Nrog L298N Siv CloudX Microcontroller: 3 Kauj Ruam
Tswj DC Motors Nrog L298N Siv CloudX Microcontroller: 3 Kauj Ruam

Video: Tswj DC Motors Nrog L298N Siv CloudX Microcontroller: 3 Kauj Ruam

Video: Tswj DC Motors Nrog L298N Siv CloudX Microcontroller: 3 Kauj Ruam
Video: Ib Ob Peb, Los Seev Cev (Official Music Video) - Douachi Yang 2024, Hlis ntuj nqeg
Anonim
Tswj DC Motors Nrog L298N Siv CloudX Microcontroller
Tswj DC Motors Nrog L298N Siv CloudX Microcontroller
Tswj DC Motors Nrog L298N Siv CloudX Microcontroller
Tswj DC Motors Nrog L298N Siv CloudX Microcontroller

Hauv qhov haujlwm no peb yuav piav qhia yuav siv peb L298N H-choj kom nce thiab txo qis ntawm DC lub cev muaj zog. L298N H-choj module tuaj yeem siv nrog lub cav uas muaj qhov hluav taws xob nruab nrab ntawm 5 thiab 35V DC.

Kuj tseem muaj tus tswj hwm 5V onboard, yog li yog tias koj cov khoom siv hluav taws xob nce mus txog 12V koj tuaj yeem tseem tuaj yeem siv 5V los ntawm pawg thawj coj saib. Cov L298 H-choj ob lub cav tswj lub cev muaj zog yog qhov pheej yig thiab muaj nyob ntawm no

Kauj Ruam 1: Cheeb Tsam

Cheebtsam
Cheebtsam
Cheebtsam
Cheebtsam
Cheebtsam
Cheebtsam
  • CloudX microcontroller
  • CloudX Softcard
  • V3 USB kab
  • L298N H-choj
  • Cov qhob cij
  • Jumper xov hlau
  • DC tsav
  • 10 k resistor
  • 4* laub khawm

koj tuaj yeem online ntawm no

Kauj Ruam 2: Daim duab Circuit Court

Daim duab Circuit Court
Daim duab Circuit Court

ua raws li Circuit Court

Kauj ruam 3: Code

theej cov cai no rau koj li CloudX IDE

#ncig #ncig

kos npe char, j;

ntsis chij;

teeb tsa () {

// teeb tsa ntawm no rau (i = 1; i <5; i ++) {pinMode (i, INPUT); } PWM1_Init (5000); PWM2_Init (5000); PWM1_Start (); PWM2_Start (); PWM1_Duty (0); PWM2_Duty (0); kuv = j = 0; loop () {// Qhov program no yog (! readPin (1)) {delayMs (200); if (flag == 0) {PWM1_Duty (i); PWM2_Duty (0); } if (flag == 1) {PWM2_Duty (j); PWM1_Duty (0); } chij = ~ chij; } yog (! readPin (2)) {delayMs (200); yog (chij == 1) {// i -= 10; kuv-; yog (i <= 0) i = 0; PWM1_Duty (i); PWM2_Duty (0); } yog (chij == 0) {// j -= 10; j--; yog (j <= 0) j = 0; PWM2_Duty (j); PWM1_Duty (0); }} yog (! readPin (3)) {delayMs (200); yog (chij == 1) {// kuv += 10; kuv ++; yog (i> = 100) kuv = 100; PWM1_Duty (i); PWM2_Duty (0); } yog (chij == 0) {// j += 10; j ++; yog (j> = 100) j = 100; PWM2_Duty (j); PWM1_Duty (0); }}

yog (! readPin (4)) {

delayMs (200); PWM1_Duty (0); PWM2_Duty (0); kuv = 0; j = 0; }

}

}

Pom zoo: