Hi
I am using a teensy 3.0 with a TPIC6B595 to run a segmented LED in conjunction with the ADXL362. I have the teesny working properly with the shift register and LED but I can not get the accelerometer to share the data its collecting. I know it is collecting data because I can open the serial monitor and it shows the accelerometer responding to movement but when I try and serial print the variable holding the data it returns a zero. I am a little new to working with libraries, so maybe I am not calling the right variable or I have some syntax wrong. I appreciate and comments. This is a slight modification of the simple read example that comes in the library.
/*
ADXL362_SimpleRead.ino - Simple XYZ axis reading example
for Analog Devices ADXL362 - Micropower 3-axis accelerometer
go to http://www.analog.com/ADXL362 for datasheet
License: CC BY-SA 3.0: Creative Commons Share-alike 3.0. Feel free
to use and abuse this code however you'd like. If you find it useful
please attribute, and SHARE-ALIKE!
Created June 2012
by Anne Mahaffey - hosted on http://annem.github.com/ADXL362
Connect SCLK, MISO, MOSI, and CSB of ADXL362 to
SCLK, MISO, MOSI, and DP 10 of Arduino
(check http://arduino.cc/en/Reference/SPI for details)
*/
#include <SPI.h>
#include <ADXL362.h>
ADXL362 x2;
int temp;
int XValue, YValue, ZValue, Temperature;
void setup(){
Serial.begin(9600);
x2.begin(); // Setup SPI protocol, issue device soft reset
x2.beginMeasure(); // Switch ADXL362 to measure mode
x2.checkAllControlRegs(); // Burst Read all Control Registers, to check for proper setup
Serial.print("\n\nBegin Loop Function:\n");
}
void loop(){
// read all three axis in burst to ensure all measurements correspond to same sample time
x2.readXYZTData(XValue, YValue, ZValue, Temperature);
delay(100); // Arbitrary delay to make serial monitor easier to observe
Serial.println(XValue);
}