pasicr Posted February 14, 2021 Share Posted February 14, 2021 Hi there, I use Pmod CMPS2 example with Arduino, https://reference.digilentinc.com/reference/pmod/pmodcmps2/start code work OK like compass, but I need to use the sensor like magnetic field sensor and get value from sensor for X, Y and Z value of magnetic filed in mG (that is implemented in code but the final result on serial monitor is compass value, not 3 axis magnetic field values) Can somebody help me with advice or code? Thanks Regards Link to comment Share on other sites More sharing options...
JColvin Posted February 15, 2021 Share Posted February 15, 2021 Hi @pasicr, The code as is won't provide you the mG values as those are set as private variables within the corresponding .h file. You could adjust the library code to make the x, y, and z values public, or it looks like you may be able to call the getX, getY, and getZ in the Arduino code which should return the values you are looking for (albeit for a single sample rather than an average). Thanks, JColvin Link to comment Share on other sites More sharing options...
pasicr Posted February 16, 2021 Author Share Posted February 16, 2021 Thanks for info, I will try to change library code, one more question about Set/Reset function, how can I call this function in void loop()? First call set after that call reset? is it correct? Regards Link to comment Share on other sites More sharing options...
JColvin Posted February 17, 2021 Share Posted February 17, 2021 Hi @pasicr, The Set and Reset functionality is not individually implemented in the library. It looks like the Set command is part of the init and removeOffset functions based on the description listed in the cpp library though. Thanks, JColvin Link to comment Share on other sites More sharing options...
Question
pasicr
Hi there, I use Pmod CMPS2 example with Arduino, https://reference.digilentinc.com/reference/pmod/pmodcmps2/start
code work OK like compass, but I need to use the sensor like magnetic field sensor and get value from sensor for X, Y and Z value of
magnetic filed in mG (that is implemented in code but the final result on serial monitor is compass value, not 3 axis magnetic field values)
Can somebody help me with advice or code?
Thanks
Regards
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.