fsfs

Dependencies:   4DGL-uLCD-SE LSM303D mbed

Fork of LSM303D_SPI by Shurjo Banerjee

main.cpp

Committer:
shurjo_1234
Date:
2015-01-15
Revision:
1:bad5121a35c7
Parent:
0:684294feee71
Child:
2:2a81657780dc

File content as of revision 1:bad5121a35c7:

#include "mbed.h"
#include "LSM303D.h"
#include <string>
 
SPI spi(p5, p6, p7); // mosi, miso, sclk
SPI spi2(p11, p12, p13);

Serial pc(USBTX, USBRX); // tx, rx

LSM303D sensor1(spi,p15);
LSM303D sensor2(spi,p16);
LSM303D sensor3(spi,p17);
LSM303D sensor4(spi,p18);

LSM303D sensor5(spi2,p27);
LSM303D sensor6(spi2,p28);
LSM303D sensor7(spi2,p29);
LSM303D sensor8(spi2,p30);
 
int main() {
    sensor1.initialize();
    sensor2.initialize();
    sensor3.initialize();
    sensor4.initialize();
    
    sensor5.initialize();
    sensor6.initialize();
    sensor7.initialize();
    sensor8.initialize();
    
    
    while (true)
    {
        char c = pc.getc();
        
        
        int a[] = {sensor1.magnitometer(0), sensor1.magnitometer(1), sensor1.magnitometer(2),
                   sensor2.magnitometer(0), sensor2.magnitometer(1), sensor2.magnitometer(2),
                   sensor3.magnitometer(0), sensor3.magnitometer(1), sensor3.magnitometer(2),
                   sensor4.magnitometer(0), sensor4.magnitometer(1), sensor4.magnitometer(2),
                   sensor5.magnitometer(0), sensor5.magnitometer(1), sensor5.magnitometer(2),
                   sensor6.magnitometer(0), sensor6.magnitometer(1), sensor6.magnitometer(2),
                   sensor7.magnitometer(0), sensor7.magnitometer(1), sensor7.magnitometer(2),
                   sensor8.magnitometer(0), sensor8.magnitometer(1), sensor8.magnitometer(2)};
                   
        int t = a[c-'a'];
        pc.printf("%d",t);
                
    }       

    
}