> For the complete documentation index, see [llms.txt](https://development-test.pycom.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://development-test.pycom.io/tutorials-and-examples/pysense.md).

# Pysense Examples

## Accelerometer

This basic example shows how to read pitch and roll from the on-board accelerometer and output it in comma separated value (CSV) format over serial.

```python
from LIS2HH12 import LIS2HH12
from pytrack import Pytrack
py = Pytrack()
acc = LIS2HH12()

while True:
   pitch = acc.pitch()
   roll = acc.roll()
   print('{},{}'.format(pitch, roll))
   time.sleep_ms(100)
```

![](https://3086745545-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LIL0iGdl11z7Jos_jpX%2F-LKN7scqKKkb6TqB3uYO%2F-LKN80YVki1yAl-d8inN%2Faccelerometer_visualiser.png?generation=1534782086369234\&alt=media)

If you want to visualise the data output by this script a Processing sketch is available [here](https://github.com/pycom/pycom-libraries/tree/master/examples/pytrack_pysense_accelerometer) that will show the board orientation in 3D.
