![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
tes ir atas semua
Dependencies: mbed ADS1115 StepperMotor SRF05 TPA81new
SharpIR/SharpIR.h@49:d23d76689933, 2019-03-06 (annotated)
- Committer:
- hisyamfs
- Date:
- Wed Mar 06 13:17:10 2019 +0000
- Revision:
- 49:d23d76689933
- Parent:
- 14:207770fefedf
tes bisa semua, tanpa servo. uvtron nggak bisa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hisyamfs | 14:207770fefedf | 1 | #include "mbed.h" |
hisyamfs | 14:207770fefedf | 2 | |
hisyamfs | 14:207770fefedf | 3 | #define def_a 330377 |
hisyamfs | 14:207770fefedf | 4 | #define def_b -1.349f |
hisyamfs | 14:207770fefedf | 5 | |
hisyamfs | 14:207770fefedf | 6 | class SharpIR{ |
hisyamfs | 14:207770fefedf | 7 | public: |
hisyamfs | 14:207770fefedf | 8 | // Konstruktor SharpIR |
hisyamfs | 14:207770fefedf | 9 | // @param apin pin AnalogIn yang tersambung ke sensor |
hisyamfs | 14:207770fefedf | 10 | SharpIR(PinName apin); |
hisyamfs | 14:207770fefedf | 11 | // Konstruktor SharpIR |
hisyamfs | 14:207770fefedf | 12 | // @param apin pin AnalogIn yang tersambung ke sensor |
hisyamfs | 14:207770fefedf | 13 | // @param a nilai dari int a, tergantung kalibrasi |
hisyamfs | 14:207770fefedf | 14 | // @param b nilai dari float b, tergantung kalibrasi |
hisyamfs | 14:207770fefedf | 15 | // @note jarak diperoleh dari hasil pembacaan dengan rumus a*pow(meas, b), dimana meas nilai tegangan output sensor |
hisyamfs | 14:207770fefedf | 16 | SharpIR(PinName apin, int a, float b); |
hisyamfs | 14:207770fefedf | 17 | // Baca data dari sensor |
hisyamfs | 14:207770fefedf | 18 | // @return jarak hasil pembacaan dalam cm |
hisyamfs | 14:207770fefedf | 19 | float read(); |
hisyamfs | 14:207770fefedf | 20 | private: |
hisyamfs | 14:207770fefedf | 21 | AnalogIn _ain; |
hisyamfs | 14:207770fefedf | 22 | float _a; |
hisyamfs | 14:207770fefedf | 23 | float _b; |
hisyamfs | 14:207770fefedf | 24 | }; |