added code to read the accelerometer, made example accelerometer a class call