Make a directory inside your “tessel-code” folder called “accelerometer”, change directory into that folder, and initialize a tessel project:
mkdir accelerometer; cd accelerometer; t2 init
Plug the accelerometer module into Tessel port A with the hexagon/icon side down and the electrical components on the top, then plug Tessel into your computer via USB.
Install by typing
npm install accel-mma84 into the command line.
Rename “index.js” to “accelerometer.js” and replace the file’s contents with the following:
Save the file.
In your command line,
t2 run accelerometer.js
Watch x, y, and z values appear in your terminal! Move the Tessel module around to see acceleration along different axes.
Bonus: Instead of just printing data, can you make the accelerometer tell you something useful? Make the Tessel log whether it’s right side up or upside down.
To see what else you can do with the accelerometer module, see the module docs here.