# Use deviceorientation and devicemotion events

**URL:** https://discourse.processing.org/t/use-deviceorientation-and-devicemotion-events/35845
**Category:** p5.js
**Created:** [March 20, 2022, 1:26am UTC](https://discourse.processing.org/t/use-deviceorientation-and-devicemotion-events/35845 "2022-03-20T01:26:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ch3](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ch3/32/15935_2.png) [@ch3](https://discourse.processing.org/u/ch3)
#### Post date: [March 20, 2022, 1:26am UTC](https://discourse.processing.org/t/use-deviceorientation-and-devicemotion-events/35845/1 "2022-03-20T01:26:37Z")

</div>

Hi there,  
I came across the [sensor-js demo](https://sensor-js.xyz/demo.html) and I am trying to figure out how to pull the orientation values in a p5 sketch running on a mobile.  
How would you go about attaching and using the deviceorientation and devicemotion events?

Here is the [source](https://github.com/sensor-js/sensor-js.github.io/blob/master/demo.html) of the demo.

Thank you
