shalab shalab / Mbed 2 deprecated Tutorial07_ClassIntro

Dependencies:   mbed

Revision:
0:0c662a5aeb15
Child:
1:08ed9f1ccd06
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Feb 28 10:36:09 2014 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#define toggle(a) {a=a^1;}
+
+DigitalOut led1(LED1); 
+Serial pc(USBTX, USBRX);
+
+class Student {
+    public:
+        Student(){
+            pc.printf("Student()\r\n");
+        }
+        
+        ~Student(){
+            pc.printf("~Student()\r\n");
+        }  
+         
+        void foo() {
+            pc.printf("foo()\r\n");
+        }
+};
+
+int main() {
+     
+    {
+        Student s;
+        s.foo(); 
+    }
+    
+    while (1) {
+        toggle(led1);
+        wait(1);
+    };
+   
+}