nucleo F303K8, PWM Beispiel, simpel,

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
heseg
Date:
Fri Nov 22 14:26:08 2019 +0000
Parent:
2:c198a0f824eb
Commit message:
PWM-Beispiel, simply, LED, nucleo F303K8, HESEG, BULME

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r c198a0f824eb -r 4d6471745b1a main.cpp
--- a/main.cpp	Wed Jun 07 13:22:25 2017 +0000
+++ b/main.cpp	Fri Nov 22 14:26:08 2019 +0000
@@ -1,18 +1,27 @@
-#include "mbed.h"
+/* ************************************************************************ */
+/* ******************** Projekt: BuNuc_pwm1 ******************************* */
+/* *****  Abteilung Elektronik und Technische Informatik / Humer ********** */
+/* ***** BULME GRAZ, Ansteuerung einer LED mit einem PWM-Signal *********** */
+/* ************************************************************************ */
 
-PwmOut mypwm(PWM_OUT);
+#include "mbed.h"
+/* ******** Definitionen ************************************************** */
+PwmOut mitzi(D1);                 // Portleitung D1 = PWM_OUT
 
-DigitalOut myled(LED1);
+/* ******** Variablendefinitionen ***************************************** */
+float duty;
 
-int main() {
-    
-    mypwm.period_ms(10);
-    mypwm.pulsewidth_ms(1);
-  
-    printf("pwm set to %.2f %%\n", mypwm.read() * 100);
-    
-    while(1) {
-        myled = !myled;
-        wait(1);
-    }
-}
+/* ************** 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
+
diff -r c198a0f824eb -r 4d6471745b1a mbed.bld
--- a/mbed.bld	Wed Jun 07 13:22:25 2017 +0000
+++ b/mbed.bld	Fri Nov 22 14:26:08 2019 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc
\ No newline at end of file