Cov txheej txheem:

Siv MATLAB App Designer Nrog Arduino: 5 Kauj Ruam
Siv MATLAB App Designer Nrog Arduino: 5 Kauj Ruam

Video: Siv MATLAB App Designer Nrog Arduino: 5 Kauj Ruam

Video: Siv MATLAB App Designer Nrog Arduino: 5 Kauj Ruam
Video: BCAG Transit & Non-Motorized Transportation Plan 2024, Hlis ntuj nqeg
Anonim
Siv MATLAB App Designer Nrog Arduino
Siv MATLAB App Designer Nrog Arduino

MATLAB App Designer yog lub cuab yeej muaj zog uas tso cai rau koj los tsim Cov Duab Sib Txuas Cov Neeg Siv (GUIs) nrog txhua yam ntawm MATLAB kev ua haujlwm.

Hauv qhov kev qhia no peb yuav ua GUI los tswj lub teeb ci ntawm LED los ntawm kev yooj yim ua raws cov kauj ruam.

Nco tseg: Cov ntawv qhia no siv Arduino khoos phis tawj txhawb nqa pob ntawm MATLAB, yog xav paub ntxiv thov mus saib

Kauj ruam 1: Qhib App Designer

Qhib App Designer
Qhib App Designer

Pib los ntawm kev qhib MATLAB thiab tsim cov ntaub ntawv App Designer tshiab.

Kauj ruam 2: Tsim App

Tsim App
Tsim App
Tsim App
Tsim App
Tsim App
Tsim App

Nias txuag ntawm lub kaum sab laug saum toj kawg nkaus ntawm lub vijtsam thiab npe nws DimmingLED.

Luag ib daim ntawv lo los ntawm cov tsev qiv ntawv tivthaiv mus rau thaj tsam tsim qauv.

Rub lub pob qhov rooj thaum tuav tus yuam sij tswj kom tiv thaiv App Designer los ntawm kev ntxiv daim ntawv lo nrog ib sab nrog lub pob qhov rooj.

Nias ntawm Daim Ntawv Qhia, tom qab ntawd hloov cov ntawv mus rau Duty Cycle thiab qhov loj me rau 36.

Kauj Ruam 3: Txuas Arduino

Txuas Arduino
Txuas Arduino

Txuas Arduino los ntawm USB chaw nres nkoj (hauv kuv qhov xwm txheej kuv siv Arduino nano).

xaim ib qho LED thiab ib tus tiv thaiv raws li hauv qab no schematic.

Kauj ruam 4:

Duab
Duab
Duab
Duab
Duab
Duab

Rov qab mus rau App Designer thiab Nyem rau CodeView saum toj ntawm thaj chaw tsim.

ntxig ib qho khoom ntiag tug los ntawm kaum sab laug saum toj kawg nkaus ntawm qhov screen.

tshem tawm cov khoom ntiag tug thiab npe nws "a".

Los ntawm cov tivthaiv browser txoj cai nyem rau ntawm app. UIfigure thiab xaiv Ntxiv StartUpFcn callback.

Sau: app.a = Arduino ();

Los ntawm Tus Txheej Txheem Browser nyem rau ntawm app.knop thiab xaiv Ntxiv Tus Nqi Hloov pauv Fcn rov qab.

Sau Cov Ntawv hauv qab no rau nws, tom qab ntawd nyem Khiav.

changeValue = event. Value;

app. DutyCycleLabel. Text = char (hlua (hloov pauv tus nqi) + ' %');

writePWMDutyCycle (app.a, 'D3', hloovValue/100.0);

Kauj ruam 5: Nrog koj zoo siab

Nrog koj zoo siab
Nrog koj zoo siab
Nrog koj zoo siab
Nrog koj zoo siab
Nrog koj zoo siab
Nrog koj zoo siab

Tam sim no koj tuaj yeem tswj lub teeb ci LED los ntawm koj li app tsim tshiab

Pom zoo: