Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau
- Kauj ruam 2: Nkag siab PWM ntawm ESP32
- Kauj Ruam 3: Kev Sib Txuas
- Kauj Ruam 4: Nruab ESP32 BOARDS hauv Arduino IDE
- Kauj ruam 5: Code
- Kauj Ruam 6: Xeem PWM Kev Ua Haujlwm
Video: PWM ESP32 - Dimming LED Nrog PWM ntawm ESP 32 Nrog Arduino IDE: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv cov lus qhia no peb yuav pom yuav ua li cas tsim PWM cov cim nrog ESP32 siv Arduino IDE & PWM yog siv los tsim cov txiaj ntsig sib piv los ntawm ib qho MCU thiab qhov sib piv tawm tuaj yeem yog ib qho ntawm 0V txog 3.3V (yog esp32) & los ntawm 0V rau 5 V.
Kauj Ruam 1: Yam Koj Xav Tau
Rau qhov kev qhia no koj yuav xav tau cov hauv qab no: ESP32
220 ohm resistors
Xim coj
daim ntawv qhia zaub mov
Ob peb dhia
Kauj ruam 2: Nkag siab PWM ntawm ESP32
ESP32 muaj 16 Channel PWM maub los thiab cov 16 Channels no muaj kev ywj pheej thiab tuaj yeem teeb tsa ntawm nws tus kheej kom tau txais PWM cov cim nrog cov khoom sib txawv rau qhov xav tau sib txawv. 0 txog 15) pwm Channels in ESP32. Koj yuav tsum xaiv koj tus PWM channel. >> Tom qab qhov no peb yuav tsum xaiv qhov zaus rau PWM, peb tuaj yeem mus rau 5000hz. >> Ntawm no peb muaj kev daws teeb meem ntawm 1 txog 16bits hauv ESP32 tab sis rau qhov kev qhia no peb yuav mus rau 8 ntsis xwb uas txhais tau tias ci ntsa iab yuav raug tswj los ntawm qhov muaj txiaj ntsig 0 txog 255. >> Koj yuav tsum teeb tsa LED rau PWM kom ua li ntawd koj yuav tsum siv kab kab hauv qab no thiab hauv qhov ntawd koj yuav tsum tau hais txog lub ledchannel (peb siv channel 0 ntawm ESP32) koj siv rau PWM & zaus yog zaus (peb siv 5000hz) ntawm PWM & kev daws teeb meem koj siv (peb siv 8bit daws teeb meem).ledcSetup (ledChannel, freq, daws teeb meem); Qhov muaj txiaj ntsig hauv peb kis: const int freq = 5000; const int cojChannel = 0; const int daws teeb meem = 8; >> tom qab ntawd hais txog qhov LED tus pin koj xav tau los ntawm kev siv cov lus txib hauv qab no: ledcAttachPin (ledPin, ledChannel);- ntawm no ledPin yog tus lej tsis. Qhov peb yuav siv & cojChannel yog cov channel uas peb yuav tsum xaiv rau PWM.5. Thaum kawg, txhawm rau tswj lub teeb ci LED siv PWM, koj siv cov haujlwm hauv qab no: >> qhov tseem ceeb tseem ceeb ntawm txoj cai yuav yog cov lus txib hauv qab no uas yuav sau cov lus sib piv rau LED tus pin: ledcWrite (ledChannel, lub luag haujlwm ua haujlwm); cov lus txib saum toj no xav tau 'ledChannel' & 'dutyCycle' qhov twg cov channel yog tus lej naj npawb peb yuav siv thiab lub voj voog ua haujlwm yog tus nqi peb tau sau raws li tso tawm rau tus pin LED.
Kauj Ruam 3: Kev Sib Txuas
Qhov kev txuas yog yooj yim heev. Koj yuav tsum txuas LED nrog Resistor rau GPIO16 raws li qhia hauv schmatics.
Kauj Ruam 4: Nruab ESP32 BOARDS hauv Arduino IDE
Nco ntsoov tias koj muaj Arduino IDE hauv koj lub PC thiab koj tau teeb tsa ESP32 Boards hauv koj Arduino IDE, thiab yog tias nws tsis yog qhov xwm txheej thov ua raws cov lus qhia hauv qab no ntawm kuv kom nruab nws.:
Kauj ruam 5: Code
Thov luam cov cai hauv qab no thiab rub nws mus rau koj tus ESP32: // tus lej ntawm tus pinconst LED coj mus rau ledPin = 16; // 16 sib raug rau GPIO16 // teeb tsa PWM cov khoom sib txuas int freq = 5000; const int ledChannel = 0; const int daws teeb meem = 8; void teeb tsa () {// teeb tsa LED PWM functionalitites ledcSetup (ledChannel, freq, daws teeb meem); // txuas cov channel mus rau GPIO kom tswj tau ledcAttachPin (ledPin, ledChannel);} lub voj void () {// nce LED ci rau (int dutyCycle = 0; dutyCycle <= 255; dutyCycle ++) {// hloov LED ci ntsa iab nrog PWM ledcWrite (ledChannel, dutyCycle); ncua (15); } // txo qhov ci ci LED rau (int dutyCycle = 255; dutyCycle> = 0; dutyCycle-) {// hloov qhov ci ci LED nrog PWM ledcWrite (ledChannel, dutyCycle); ncua (15); }}
Kauj Ruam 6: Xeem PWM Kev Ua Haujlwm
Tom qab xa cov cai koj yuav pom koj cov LEDs siv zog hloov pauv uas coj peb mus rau qhov kawg ntawm cov lus qhia no. Kev lom zem siv PWM nrog ESP32 hauv koj cov phiaj xwm.
Pom zoo:
Plotting Real-time Graph ntawm Android Los Ntawm Arduino Los Ntawm HC-05: 3 Cov Kauj Ruam
Plotting Real-time Graph ntawm Android Los ntawm Arduino Los ntawm HC-05: Hav nyob ntawm no, ntawm no yog kev qhia qhia yuav ua li cas npaj cov phiaj xwm ntawm lub sijhawm tiag tiag ntawm qhov tseem ceeb los ntawm tus tswj hwm micro xws li Arduino rau lub app. Nws siv Bluetooth qauv xws li HC-05 los ua lub cuab yeej xa xov mus rau kis thiab tau txais cov ntaub ntawv ntawm Ar
Pib Nrog Esp 8266 Esp-01 Nrog Arduino IDE - Txhim Kho Esp Boards hauv Arduino Lub Tswv Yim thiab Kev Ua Haujlwm Esp: 4 Cov Kauj Ruam
Pib Nrog Esp 8266 Esp-01 Nrog Arduino IDE | Txhim Kho Esp Boards hauv Arduino Lub Tswv Yim thiab Kev Ua Haujlwm Esp: Hauv cov lus qhia no peb yuav kawm paub yuav teeb tsa esp8266 cov laug cam hauv Arduino IDE li cas thiab yuav ua haujlwm li cas esp-01 thiab tso cov lej rau hauv. qhov no thiab feem ntau ntawm cov neeg ntsib teeb meem
Tau Txais LoRa (SX1278/XL1278-SMT) Ua Haujlwm Ntawm SPI ntawm WeMos D1 ESP-12F ESP8277 Motherboard Module Nrog OLED: 7 Kauj Ruam
Tau Txais LoRa (SX1278/XL1278 -SMT) Ua Haujlwm Ntawm SPI ntawm WeMos D1 ESP -12F ESP8277 Motherboard Module Nrog OLED: Qhov no coj kuv ib lub lim tiam los ua haujlwm - zoo li tsis muaj leej twg ua ntej kuv tau xam nws - yog li kuv vam tias qhov no cawm koj qee lub sij hawm! Txawv txawv lub npe "WeMos D1 ESP-12F ESP8266 Motherboard Module nrog 0.96 nti OLED Screen" yog $ 11 pawg tswj hwm kev txhim kho th
Kev tswj hwm tus kheej ntawm RPM ntawm Lub Cav Siv Lub Tswv Yim Los Ntawm IR Raws Li Tachometer: 5 Cov Kauj Ruam (nrog Duab)
Kev Tswj Tus Kheej ntawm RPM ntawm Lub Cav Siv Lub Tswv Yim Los Ntawm IR Raws Lub Tachometer: Muaj ib txwm xav tau rau kev siv tshuab txheej txheem, ua nws yooj yim/tsis txaus ntseeg. cov txheej txheem rau dej/siv dej rau peb daim av me me.Qhov teeb meem ntawm tsis muaj kab khoom siv tam sim no
Cov lus qhia ntawm Kev Ua Kom Zoo Mock-Up ntawm Track Slide Tsim rau Nqa/Txo Hauv Pem Hauv Ntej-Mounted Footrests ntawm Lub Hwj Huam Log: 9 Kauj Ruam (nrog Duab)
Cov lus qhia ntawm Kev Ua Kom Tiav Mock-Up ntawm Track Slide Tsim rau Nqa/Sab Qaum Nruab Nrab-Mounted Footrests ntawm Lub Hwj Huam Lub Rooj Zaum: Lub hauv paus tau teeb tsa lub tog zaum kom nqa tau hauv qab lub rooj kom zoo, thiab qis dua kom siv tau. Ib lub tswv yim rau kev ua haujlwm ywj pheej ntawm kev tuav cov footrest thiab kev xa tawm tsis suav nrog lub rooj zaum fais fab lag luam, thiab PWC cov neeg siv tau qhia txog qhov xav tau