# How to use data from accelerometer to control camera and perspective in Processing

**URL:** <https://discourse.processing.org/t/how-to-use-data-from-accelerometer-to-control-camera-and-perspective-in-processing/36799>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [May 10, 2022, 11:49am UTC](https://discourse.processing.org/t/how-to-use-data-from-accelerometer-to-control-camera-and-perspective-in-processing/36799 "2022-05-10T11:49:11Z")\
**Posts on this page:** 3\
**Page:** 3

<div class="post-metadata">

**Author:** ![EllenYang](https://avatars.discourse-cdn.com/v4/letter/e/c68b51/32.png) [@EllenYang](https://discourse.processing.org/u/EllenYang)\
**Post date:** [May 11, 2022, 3:05pm UTC](https://discourse.processing.org/t/how-to-use-data-from-accelerometer-to-control-camera-and-perspective-in-processing/36799/41 "2022-05-11T15:05:25Z")

</div>

I have smoothed the data so now they are something like:

 ![Screen Shot 2022-05-11 at 11.02.35 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/2/8/28008483f4b3c4a0aca90faa14e3b8f74ec55620.png)  
So the numbers varied from 0.00 to 10.00  
To be honest, I really don’t know why we don’t receive negative numbers, I’m studying the introduction and data sheet of my accelerometer right now: [Gravity: I2C LIS331HH Triple Axis Accelerometer Sensor Wiki - DFRobot](https://wiki.dfrobot.com/Gravity_I2C_LIS331HH_Triple_Axis_Accelerometer_SKU_SEN0411#ino1)

---

<div class="post-metadata">

**Author:** ![EllenYang](https://avatars.discourse-cdn.com/v4/letter/e/c68b51/32.png) [@EllenYang](https://discourse.processing.org/u/EllenYang)\
**Post date:** [May 12, 2022, 1:14am UTC](https://discourse.processing.org/t/how-to-use-data-from-accelerometer-to-control-camera-and-perspective-in-processing/36799/42 "2022-05-12T01:14:58Z")

</div>

I added three variables: DxA, DyA, DzA to measure the change of acceleration (delta A). Now it partially works but now in a smooth way, and it seems that I can’t change perspective of y and z direction but can only change x. It kept moving away from the screen

---

<div class="post-metadata">

**Author:** ![EllenYang](https://avatars.discourse-cdn.com/v4/letter/e/c68b51/32.png) [@EllenYang](https://discourse.processing.org/u/EllenYang)\
**Post date:** [May 12, 2022, 2:21am UTC](https://discourse.processing.org/t/how-to-use-data-from-accelerometer-to-control-camera-and-perspective-in-processing/36799/43 "2022-05-12T02:21:37Z")

</div>

omg after testings now it works!!! I’m so excited.  
Thank you Chrisir for all your help! Much appreciated!!

[Previous page](https://discourse.processing.org/t/how-to-use-data-from-accelerometer-to-control-camera-and-perspective-in-processing/36799.md?page=2)
