LSM9DS1 i2c

Dependencies:   mbed

Committer:
antimo8@alice.it
Date:
Sun Jul 08 11:12:03 2018 +0200
Revision:
1:a7dc83962b93
Parent:
0:986686a93674
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
antimo8@alice.it 1:a7dc83962b93 1 #include "mbed.h"
antimo8@alice.it 1:a7dc83962b93 2 #include "LSM9DS1.h"
antimo8@alice.it 1:a7dc83962b93 3
antimo8@alice.it 1:a7dc83962b93 4 DigitalOut led1(LED1);
antimo8@alice.it 1:a7dc83962b93 5 //I2C i2c(I2C_SCL,I2C_SDA);
antimo8@alice.it 1:a7dc83962b93 6 I2C i2c(I2C_SDA, I2C_SCL);
antimo8@alice.it 1:a7dc83962b93 7
antimo8@alice.it 1:a7dc83962b93 8 //Timer timer;
antimo8@alice.it 1:a7dc83962b93 9
antimo8@alice.it 1:a7dc83962b93 10 Serial pc(SERIAL_TX, SERIAL_RX);
antimo8@alice.it 1:a7dc83962b93 11
antimo8@alice.it 1:a7dc83962b93 12 int main()
antimo8@alice.it 1:a7dc83962b93 13 {
antimo8@alice.it 1:a7dc83962b93 14 // int x = 0;
antimo8@alice.it 1:a7dc83962b93 15 // int y = 0;
antimo8@alice.it 1:a7dc83962b93 16 // int z = 0;
antimo8@alice.it 1:a7dc83962b93 17 //smeAccelerometer.begin();
antimo8@alice.it 1:a7dc83962b93 18 /*Info system clock*/
antimo8@alice.it 1:a7dc83962b93 19 //pc.printf("\n\rSystemCoreClock=%d\r\n",SystemCoreClock);
antimo8@alice.it 1:a7dc83962b93 20 pc.printf("\n\r SystemCoreClock=\r\n");
antimo8@alice.it 1:a7dc83962b93 21 while(1)
antimo8@alice.it 1:a7dc83962b93 22 {
antimo8@alice.it 1:a7dc83962b93 23 // x = smeAccelerometer.readX();
antimo8@alice.it 1:a7dc83962b93 24 // y = smeAccelerometer.readY();
antimo8@alice.it 1:a7dc83962b93 25 // z = smeAccelerometer.readZ();
antimo8@alice.it 1:a7dc83962b93 26
antimo8@alice.it 1:a7dc83962b93 27 //pc.printf("\n\rSystemCoreClock=%d\r\n",SystemCoreClock);
antimo8@alice.it 1:a7dc83962b93 28 // S
antimo8@alice.it 1:a7dc83962b93 29 /*to main retention, otherwise thread will be died*/
antimo8@alice.it 1:a7dc83962b93 30 /*don't leave empty */
antimo8@alice.it 1:a7dc83962b93 31 pc.printf("\n\r SystemCoreClock=\r\n");
antimo8@alice.it 1:a7dc83962b93 32 led1 = 1;
antimo8@alice.it 1:a7dc83962b93 33 wait(0.2);
antimo8@alice.it 1:a7dc83962b93 34 led1 = 0;
antimo8@alice.it 1:a7dc83962b93 35 wait(0.2);
antimo8@alice.it 1:a7dc83962b93 36 }
antimo8@alice.it 1:a7dc83962b93 37
antimo8@alice.it 1:a7dc83962b93 38 return 0;
antimo8@alice.it 1:a7dc83962b93 39 }