Tina Dokic
/
i2c-_pins_tinf_06-10-2020
tinf
Revision 0:5ca7c8550369, committed 2020-10-06
- Comitter:
- tina_dokic
- Date:
- Tue Oct 06 17:25:44 2020 +0000
- Commit message:
- tinf
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 06 17:25:44 2020 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" + + +class MyClassB +{ +public: + MyClassB(PinName sda, PinName scl): _i2c (sda, scl) + { + _result =0; + }// I2C Pins übergeben p28, p27 + float read(); + +private: + I2C _i2c; + float _result; +}; + +float MyClassB :: read(){ + return _result; +} + + + +MyClass myClass(0.0); +MyClassB sensor(p28, p27); + +int main() +{ + myClass.status(); + wait_ms(500); + + printf("Sensorwert: %f\n", sensor.read()); + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 06 17:25:44 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file