
Can my Simulink model read data from an analog accelerometer plugged into my VEX microcontroller?
5 views (last 30 days)
Show older comments
MathWorks Support Team
on 16 Apr 2018
Answered: MathWorks Support Team
on 16 Apr 2018
I have been using the Simulink Coder Support Package for VEX Microcontrollers, specifically blocks from the "sensors" library. All the sensors I've used in the past have had dedicated blocks in the library, such as the gyroscope and the ultrasonic sensor. However, I am now trying to read data from an analog accelerometer as well, but there is no accelerometer sensor block. How can I read the data from this sensor in my Simulink model?
Accepted Answer
MathWorks Support Team
on 27 Sep 2018
The Simulink Coder Support Package for VEX does have some blocks that are sensor-specific for the most commonly used sensors - such as the ultrasonic sensor and the gyroscope blocks you have already used in your model. The support package also provides more generic blocks that let you interface with any sensor you plug into your digital or analog ports.
In this case, you have an analog accelerometer to plug into your VEX microcontroller. When plugged in, the accelerometer feeds data to 3 analog ports (one per axis). To read this data in your Simulink model, use the generic "Analog Input" block from the VEX sensors library, as shown in the screenshot below. If your accelerometer is plugged into analog ports 1, 2, and 3, this Simulink set-up would allow you to read the data from each of those ports. Note that you will need one analog input block per analog port used.

0 Comments
More Answers (0)
See Also
Categories
Find more on Deployment, Integration, and Supported 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!