Josef Humer
/
BuNuc_pwm1
nucleo F303K8, PWM Beispiel, simpel,
main.cpp
- Committer:
- heseg
- Date:
- 2019-11-22
- Revision:
- 3:4d6471745b1a
- Parent:
- 0:4860a91fb495
File content as of revision 3:4d6471745b1a:
/* ************************************************************************ */ /* ******************** Projekt: BuNuc_pwm1 ******************************* */ /* ***** Abteilung Elektronik und Technische Informatik / Humer ********** */ /* ***** BULME GRAZ, Ansteuerung einer LED mit einem PWM-Signal *********** */ /* ************************************************************************ */ #include "mbed.h" /* ******** Definitionen ************************************************** */ PwmOut mitzi(D1); // Portleitung D1 = PWM_OUT /* ******** Variablendefinitionen ***************************************** */ float duty; /* ************** Hauptprogramm ***************************************** */ int main() // Hauptprogramm { mitzi.period(0.02); // 20msec period while(1) { mitzi = duty; // Erhöhe um 5% duty += 0.05; wait(0.2); if(mitzi==1) duty=0; } // end while } //end main