/************************************************************************************************** * * LIS3LV02DQ * * Version: 1.0.0 - Januar 2009 * Author: Christoph Wartmann / chair for caad - ETH Zürich / wartmann[at].arch.ethz.ch * Etienne Ribeiro / tutorial assistant caad / eribeiro[at]ethz.ch * * Desc: Shows the use of an LIS3LV02DQ Accelerator. * ***************************************************************************************************/ // // Const int DATAIN = 27; //27//MISO (SDO) int DATAOUT = 26; //26//MOSI (SDA) int SPICLOCK = 25; //25//sck (SCL) int SLAVESELECT = 24; //24//ss for /LIS3LV02DQ, active low (CS) // int onboardLED = 48; // Wiring-Board: Pin 48, Arduino: Pin 13 // Var boolean success; // // Setup void setup() { // LED (2 * blink) pinMode(onboardLED, OUTPUT); digitalWrite(onboardLED, HIGH); delay(200); digitalWrite(onboardLED, LOW); delay(200); digitalWrite(onboardLED, HIGH); // Serial Serial.begin(9600); // Append Sensor success = LIS3L_AppendSensor (DATAOUT, DATAIN, SPICLOCK, SLAVESELECT); // +-6g } // // Loop void loop() { // Mesure Acceleration int val_x = LIS3L_Read ('x'); int val_y = LIS3L_Read ('y'); int val_z = LIS3L_Read ('z'); int val_xg = LIS3L_ParseToG (val_x); int val_yg = LIS3L_ParseToG (val_y); int val_zg = LIS3L_ParseToG (val_z); Serial.print("x"); Serial.println(val_xg, DEC); Serial.print("y"); Serial.println(val_yg, DEC); Serial.print("z"); Serial.println(val_zg, DEC); // take a break delay (100); }