Zhang Yuexin

C# programmer. Know a bit of hardware knowledge. 3D model design novice.

张高兴 - 土味儿编程


张高兴的 Windows 10 IoT 开发笔记:ADXL345 加速度传感器

本文约 150 字,包含 0 张图片,3 个代码段,阅读时间约 1 分钟
QR Code


This is a Windows 10 IoT Core project on the Raspberry Pi 2/3, coded by C#.



ADXL345 connect to SPI

  • VCC - 3.3 V
  • GND - GND
  • CS - CS0 - Pin24
  • SDO - Pin21
  • SDA - Pin19
  • SCL - Pin23


In Chinese : http://wenku.baidu.com/view/87a1cf5c312b3169a451a47e.html

In English : https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/ADXL345/Reference

ms-iot some code : https://github.com/ms-iot/samples/tree/develop/SPIAccelerometer/CS

How to Use

  • First, you need to create a ADXL345 object. After that you should call InitializeAsync() to initialize.
ADXL345 sensor = new ADXL345(0, GravityRange.Four);
await sensor.InitializeAsync();
  • Second, ReadAcceleration().
var accel = sensor.ReadAcceleration();
  • If you want to close the sensor, call Dispose().
最后更新时间 : 2017/01/23 14:02 张高兴 阅读(116899) 评论(0)
文章标签: C# UWP IoT Raspberry Pi
Click to Refresh