Codeschnippseln für diese Übung

Dependencies:   mbed

Revision:
1:c65875995efb
Child:
2:7a0bae2281e8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/class4.cpp	Tue Oct 13 16:34:21 2020 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+
+
+class MyPrintClass
+{
+    private:
+        Serial* pc;
+        
+    public:
+        MyPrintClass(Serial* serial) : pc(serial)
+        {
+            
+        }
+        
+        
+        void PrintIntValues(int value)
+        {
+            pc->printf("Int-Wert: %d\n", value);
+        }
+        void PrintIntValues(int *values, int count)
+        {
+            pc->printf("Auflistung der %d Messwerte:\n", count);
+            
+            for (int i = 0; i < count; i++)
+            {
+                pc->printf("[%d] -> %d\n", i, values[i]);
+            }
+            
+            pc->printf("Auflistung beendet!\n\n");
+        }
+        
+        void PrintString(char *str, int count)
+        {
+            pc->printf("String: ");
+            
+            for (int i = 0; i < count; i++)
+            {
+                pc->putc(str[i]);
+            }
+            
+            pc->printf("\n");
+        }
+        
+};
\ No newline at end of file