test program for MPL3115A2
Dependencies: C12832 LM75B MPL3115A2 mbed
main.cpp@2:ef315a40af7b, 2017-11-22 (annotated)
- Committer:
- bouaziz
- Date:
- Wed Nov 22 09:27:32 2017 +0000
- Revision:
- 2:ef315a40af7b
- Parent:
- 1:4870f310b921
- Child:
- 3:cb376fbf96dd
test capteur pression lycee
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:27799234e2ed | 1 | #include "mbed.h" |
bouaziz | 2:ef315a40af7b | 2 | #include "LM75B.h" |
Rhyme | 0:27799234e2ed | 3 | #include "MSS.h" |
Rhyme | 0:27799234e2ed | 4 | #include "MPL3115A2.h" |
Rhyme | 0:27799234e2ed | 5 | #define MPL3115A2_I2C_ADDRESS (0x60) |
Rhyme | 0:27799234e2ed | 6 | |
bouaziz | 2:ef315a40af7b | 7 | Serial pc(USBTX,USBRX); |
bouaziz | 2:ef315a40af7b | 8 | |
bouaziz | 2:ef315a40af7b | 9 | #include "C12832.h" |
bouaziz | 2:ef315a40af7b | 10 | C12832 lcd(p5, p7, p6, p8, p11); |
bouaziz | 2:ef315a40af7b | 11 | LM75B sensor(p28,p27); |
bouaziz | 2:ef315a40af7b | 12 | MPL3115A2 mpl(PIN_SDA, PIN_SCL, MPL3115A2_I2C_ADDRESS) ; |
bouaziz | 2:ef315a40af7b | 13 | |
Rhyme | 0:27799234e2ed | 14 | int main() { |
Rhyme | 1:4870f310b921 | 15 | double alt, bar, temp ; |
bouaziz | 2:ef315a40af7b | 16 | mpl.setBarIn((unsigned short)(101800/2)); |
Rhyme | 0:27799234e2ed | 17 | |
bouaziz | 2:ef315a40af7b | 18 | sensor.open(); |
Rhyme | 0:27799234e2ed | 19 | |
Rhyme | 0:27799234e2ed | 20 | while(1) { |
Rhyme | 0:27799234e2ed | 21 | alt = mpl.getAltitude() ; |
Rhyme | 0:27799234e2ed | 22 | bar = mpl.getPressure() ; |
Rhyme | 1:4870f310b921 | 23 | temp = mpl.getTemperature() ; |
bouaziz | 2:ef315a40af7b | 24 | lcd.cls(); |
bouaziz | 2:ef315a40af7b | 25 | lcd.locate(0,1); |
bouaziz | 2:ef315a40af7b | 26 | lcd.printf("ALTI, BAR, TEMP",alt, bar, temp) ; |
bouaziz | 2:ef315a40af7b | 27 | lcd.locate(0,10); |
bouaziz | 2:ef315a40af7b | 28 | lcd.printf("%5.2f, %5.2f, %5.2f %5.3f",alt, bar, temp,sensor.temp()) ; |
Rhyme | 0:27799234e2ed | 29 | wait(1) ; |
Rhyme | 0:27799234e2ed | 30 | } |
Rhyme | 0:27799234e2ed | 31 | } |