Michael Planner
/
InitListen
Codeschnippseln für diese Übung
Diff: main.cpp
- Revision:
- 1:c65875995efb
- Parent:
- 0:76d9c940a794
- Child:
- 2:7a0bae2281e8
diff -r 76d9c940a794 -r c65875995efb main.cpp --- a/main.cpp Tue Oct 06 16:36:31 2020 +0000 +++ b/main.cpp Tue Oct 13 16:34:21 2020 +0000 @@ -1,27 +1,47 @@ #include "mbed.h" - +#include "class4.cpp" class MyClassB { private: I2C i2c; - float result; + float _result; public: + MyClassB(I2C& i2cCopy) : i2c(i2cCopy) + { + //c = i2cCopy; + _result = 0; + } MyClassB(PinName sda, PinName scl) : i2c(sda, scl) { - result = 0; + _result = 0; } - float read(); + + float Read(); }; -float MyClassB::read() { return result; } +float MyClassB::Read() { return _result; } -MyClassB sensor(p28, p27); + + + +Serial pc(USBTX, USBRX); +MyPrintClass printClass(&pc); int main() { - float x = sensor.read(); + int x[] = { 1, 4, 7, 3, 10, 20 }; + char s[] = "Hallo Welt!"; + + while (1) + { + printClass.PrintString(s, sizeof(s)); + printClass.PrintIntValues(68); + printClass.PrintIntValues(x, sizeof(x) / sizeof(int)); + + wait(500); + } } \ No newline at end of file