You can tinker with it if you like based on the application, or just use it as it is. Attachments Accelerometer. Participated in the Makerspace Contest View Contest. Did you make this project? Share it with us!
I Made It! Remote Control Light Switch by alanmerritt in Arduino. Answer Upvote. Reply Upvote. Jonasborneland CodeChamp Reply 2 years ago. Similarly, we should remove the following lines from the loop :.
Instead, in the loop we tell the sensor to begin reading the values for the three axes. In this example we will not be using the readings from the Z axis as it is not required for this application to function, therefore you could remove it.
After the IMU. The statements will calculate the direction in which the board will be tilting towards, as well as provide the axe's degree values.
Lastly, we Serial. Note: For the following code to properly work, the board's facing direction and inclination during the initialization of the code, need to be specific. More information will be shared on the "testing it out" section. In order to get a correct reading of the board data, before uploading the sketch to the board hold the board in your hand, from the side of the USB port. The board should be facing up and "pointing" away from you.
The image below illustrates the board's position and how it works:. Interacting with the X and Y axes. Now, you can verify and upload the sketch to the board and open the Monitor from the menu on the left. If you tilt the board upwards, downwards, right or left, you will see the results printing every second according to the direction of your movement! You can find more basic tutorials in the built-in examples section.
You can also explore the language reference , a detailed collection of the Arduino programming language. Built-in Examples. ADXL3xx Accelerometer. The pins used are designed to be easily. They won't change:.
Contribute to Arduino Join the community and suggest improvements to this article via GitHub. Make sure to read out contribution policy before making your pull request. Missing something?
0コメント