Code for Altimu10v4, reads all the i2c sensor and display its values trught serial.
Dependencies: L3GD20 LPS25H LSM303D mbed
Revision 0:1393d5ef2374, committed 2018-06-16
- Comitter:
- renanbmx123
- Date:
- Sat Jun 16 03:27:53 2018 +0000
- Commit message:
- First commit of Altimu10v4.
Changed in this revision
diff -r 000000000000 -r 1393d5ef2374 L3GD20.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/L3GD20.lib Sat Jun 16 03:27:53 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/bclaus/code/L3GD20/#b45dbca259f8
diff -r 000000000000 -r 1393d5ef2374 LPS25H.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LPS25H.lib Sat Jun 16 03:27:53 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/kenjiArai/code/LPS25H/#9db35e42ddbc
diff -r 000000000000 -r 1393d5ef2374 LSM303D.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LSM303D.lib Sat Jun 16 03:27:53 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/bclaus/code/LSM303D/#8cd0c3c11b48
diff -r 000000000000 -r 1393d5ef2374 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jun 16 03:27:53 2018 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" +#include "L3GD20.h" +#include "LSM303D.h" +#include "LPS25H.h" + +I2C i2c(p28,p27); + +L3GD20 gyro(p28, p27); +LSM303D lsm(p28, p27); +LPS25H baro(i2c, LPS25H_V_CHIP_ADDR); + +Serial pc(USBTX,USBRX); + + +int main(){ + + float g[3]; + float acc[3] ,mag[3]; + pc.baud(9600); + + while (1){ + + //Gyroscope + gyro.read(&g[0],&g[1],&g[2]); + pc.printf("Gyro-> X:%f Y:%f Z:%f\n",g[0] ,g[1] ,g[2]); + //Acell/Mag + if (lsm.read(&acc[0],&acc[1],&acc[2],&mag[0],&mag[1],&mag[2])) + { + pc.printf("Acc-> X:%.3f Y%.3f Z%.3f\nMag-> X%3f Y%3f Z%3f)\n",acc[0],acc[1],acc[2],mag[0],mag[1],mag[2]); + } + //Barometer + baro.get(); + pc.printf("Pres:%6.1fpa\nTemp: %4.1fc\n", baro.pressure(), baro.temperature()); + wait(0.5); + } +} \ No newline at end of file
diff -r 000000000000 -r 1393d5ef2374 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jun 16 03:27:53 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file