Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 class MyClass 00004 { 00005 public: 00006 MyClass(double messwert) : _messwert(messwert) { } 00007 MyClass() : _messwert(0.0) { } 00008 00009 void status() 00010 { 00011 printf("%f\n", _messwert); 00012 } 00013 private: 00014 double _messwert; 00015 }; 00016 00017 class MyClassB 00018 { 00019 private: 00020 I2C i2c; 00021 float result; 00022 00023 public: 00024 MyClassB(PinName sda, PinName scl) : i2c(sda, scl){ 00025 result = 0; 00026 } 00027 float read(); 00028 }; 00029 00030 float MyClassB::read() { 00031 return result; 00032 } 00033 00034 MyClass myClass(0.0); 00035 MyClassB sensor(p28, p27); 00036 00037 int main() { 00038 myClass.status(); 00039 wait_ms(100); 00040 00041 printf("Sensorwert: %f \n", sensor.read()); 00042 }
Generated on Fri Jul 15 2022 10:47:03 by
1.7.2