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.
Dependents: PXMathLibrary_Example
PXMathLibrary.cpp@0:0a62c0d19710, 2020-06-14 (annotated)
- Committer:
- mpakdel
- Date:
- Sun Jun 14 06:41:04 2020 +0000
- Revision:
- 0:0a62c0d19710
Majid Pakdel Math Library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mpakdel | 0:0a62c0d19710 | 1 | #include "mbed.h" |
| mpakdel | 0:0a62c0d19710 | 2 | #include "PXMathLibrary.h" |
| mpakdel | 0:0a62c0d19710 | 3 | |
| mpakdel | 0:0a62c0d19710 | 4 | PXMathLibrary::PXMathLibrary(PinName pin1, PinName pin2):_pin1(pin1), _pin2(pin2) { |
| mpakdel | 0:0a62c0d19710 | 5 | |
| mpakdel | 0:0a62c0d19710 | 6 | } |
| mpakdel | 0:0a62c0d19710 | 7 | |
| mpakdel | 0:0a62c0d19710 | 8 | void PXMathLibrary::mean() { |
| mpakdel | 0:0a62c0d19710 | 9 | float x = _pin1.read(); |
| mpakdel | 0:0a62c0d19710 | 10 | float y = _pin2.read(); |
| mpakdel | 0:0a62c0d19710 | 11 | float z = (x+y)/2.0f; |
| mpakdel | 0:0a62c0d19710 | 12 | printf("%10.3f \t %10.3f \t %10.3f \n\r", x, y, z); |
| mpakdel | 0:0a62c0d19710 | 13 | } |
| mpakdel | 0:0a62c0d19710 | 14 |