Connecting ADXL345 and Raspberry Pi using SPI or I2C
5 views (last 30 days)
Show older comments
Is there a way in which I can download the .m file used in the video 'Using MATLAB and Raspberry Pi with an Accelerometer', so that I can see how to read the data from an acclerometer via SPI within MATLAB? Or if I could get some form of help with writing my own I would be grateful.
Link to the video: https://uk.mathworks.com/videos/using-matlab-and-raspberry-pi-with-an-accelerometer-94189.html
Alternatively, is there anywhere I could find help connecting reading the same accelerometer via I2C? I can connect it via I2C, gain the address of the ADXL345 as 0x53, but then I can't see how to read the data. I know that the x,y and z data is on 0x32 to 0x37, but I can't see how to return the data within MATLAB. I find the video 'Using MATLAB and Raspberry Pi with an I2C Sensor' somewhat useful until, again it comes to reading the data. Link to video:
https://uk.mathworks.com/videos/using-matlab-and-raspberry-pi-with-an-i2c-sensor-94194.html
I am fairly new to the Raspberry Pi and connecting components via SPI/I2C, so would be very grateful for a simplified explanation/point in the right direction where I can learn more.
3 Comments
Arvind Srivastav
on 5 Mar 2018
Hi Darren, I'm having a similar problem. Is the output of "address = char(scanI2CBus(rpi))" non-empty in your case?
Answers (0)
See Also
Categories
Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!