Ejaz Jamil / Mbed 2 deprecated Nucleo_pwm

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ejazjamil
Date:
Sat Jan 13 07:27:58 2018 +0000
Parent:
0:f1d90fe4b6b4
Commit message:
Lab 1

Changed in this revision

cse360.cpp Show annotated file Show diff for this revision Revisions of this file
cse360.h Show annotated file Show diff for this revision Revisions of this file
lab.cpp Show annotated file Show diff for this revision Revisions of this file
lab.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cse360.cpp	Sat Jan 13 07:27:58 2018 +0000
@@ -0,0 +1,16 @@
+
+#include "cse360.h"
+#include "mbed.h"
+
+int cse360::date() {
+    return 20180110;
+}
+
+int cse360::classes() {
+    return 28;
+}
+
+cse360::~cse360() {
+    printf("bye");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cse360.h	Sat Jan 13 07:27:58 2018 +0000
@@ -0,0 +1,15 @@
+
+class cse360 {
+    public:
+    static int rollnum;
+    
+    cse360() {
+        rollnum = 0;
+    }
+    
+    ~cse360();
+
+    int date();
+    int classes();
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lab.cpp	Sat Jan 13 07:27:58 2018 +0000
@@ -0,0 +1,10 @@
+#include "lab.h"
+
+
+int Lab::date() {
+    return 20180113;
+}
+
+int Lab::assignment() {
+    return 12;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lab.h	Sat Jan 13 07:27:58 2018 +0000
@@ -0,0 +1,10 @@
+#include "cse360.h"
+
+class Lab : cse360 {
+    public:
+    int date();
+    
+    private:
+    int assignment();
+};
+
--- a/main.cpp	Sat Jan 13 06:19:40 2018 +0000
+++ b/main.cpp	Sat Jan 13 07:27:58 2018 +0000
@@ -1,35 +1,21 @@
 #include "mbed.h"
+//#include "cse360.h"
+#include "lab.h"
 
 PwmOut mypwm(PWM_OUT);
 
 DigitalOut myled(LED1);
 
 
-class cse360 {
-    int date();
-    int classes();
-};
-
-int cse360::date() {
-    return 20180110;
-}
-
-int cse360::classes() {
-    return 28;
-}
-
-
-class Lab {
-    int date();
-    int assignment();
-};
-
-int Lab::date() {
-    return 20180113;
-}
-
-int Lab::assignment() {
-    return 12;
+void gotoExample() {
+print1:
+    printf("VALUE=1\n");
+print2:
+    printf("VALUE=2\n");
+print3:
+    printf("VALUE=3\n");
+    
+    goto print2;
 }
 
 
@@ -38,6 +24,11 @@
     mypwm.period_ms(10);
     mypwm.pulsewidth_ms(1);
   
+    // printf("rollnum: %d\n", cse360::rollnum);
+    for(int i=0;i<10;i++) {
+        printf("i=%d\n",i);
+    }
+
     printf("pwm set to %.2f %%\n", mypwm.read() * 100);
     
     while(1) {