Question

Posted (edited)

Hi,

I am working with the Pmod CMPS2 and an Arduino Uno to get an accurate reading of the direction a user is facing for a personal project. I am having trouble writing the code since the code on the website on Reference Materials is giving me a lot of errors. Is there any other code I can try?

Edited by varun332

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @varun332,

I will reach out to our content team about this issue. In the mean time I was able to verify the exiting code can be alter to work with only a few changes to the code. To fix existing code on the resource center here please use a text editor and replace the Wire.receive() with Wire.read(). Also change the #include <CMPS2.h> to #include "CMPS2.h" on the top of the CMPS2.c and the CMPS2.ino.

thank you,

Jon

Share this post


Link to post
Share on other sites
  • 0

Hi @jpeyron,

I tried that and it still didn't work. I even downloaded version 2 of the code and that doesn't work either.

These are all the errors I'm receiving:

 

 

sketch/CMPS2.cpp: In member function ‘void CMPS2::removeOffset()’:
sketch/CMPS2.cpp:63:48: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
       temp = Wire.requestFrom(this->deviceID, 1);
                                                ^
In file included from sketch/CMPS2.h:4:0,
                 from sketch/CMPS2.cpp:3:
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:44:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
  uint8_t requestFrom(int, int);
          ^
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:42:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t, uint8_t);
          ^
sketch/CMPS2.cpp:69:39: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
     Wire.requestFrom(this->deviceID, 6); //request data from 6 registers
                                       ^
In file included from sketch/CMPS2.h:4:0,
                 from sketch/CMPS2.cpp:3:
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:44:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
  uint8_t requestFrom(int, int);
          ^
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:42:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t, uint8_t);
          ^
sketch/CMPS2.cpp:97:48: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
       temp = Wire.requestFrom(this->deviceID, 1);
                                                ^
In file included from sketch/CMPS2.h:4:0,
                 from sketch/CMPS2.cpp:3:
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:44:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
  uint8_t requestFrom(int, int);
          ^
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:42:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t, uint8_t);
          ^
sketch/CMPS2.cpp:103:39: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
     Wire.requestFrom(this->deviceID, 6); //request data from 6 registers
                                       ^
In file included from sketch/CMPS2.h:4:0,
                 from sketch/CMPS2.cpp:3:
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:44:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
  uint8_t requestFrom(int, int);
          ^
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:42:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t, uint8_t);
          ^
sketch/CMPS2.cpp: In member function ‘int CMPS2::getMeasurement()’:
sketch/CMPS2.cpp:148:46: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
     temp = Wire.requestFrom(this->deviceID, 1);
                                              ^
In file included from sketch/CMPS2.h:4:0,
                 from sketch/CMPS2.cpp:3:
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:44:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
  uint8_t requestFrom(int, int);
          ^
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:42:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t, uint8_t);
          ^
sketch/CMPS2.cpp:154:37: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
   Wire.requestFrom(this->deviceID, 6); //request data from 6 registers
                                     ^
In file included from sketch/CMPS2.h:4:0,
                 from sketch/CMPS2.cpp:3:
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:44:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
  uint8_t requestFrom(int, int);
          ^
/Users/varunbhandari/Library/Arduino15/packages/Intel/hardware/arc32/2.0.4/libraries/Wire/src/Wire.h:42:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t, uint8_t);
          ^
/Users/varunbhandari/Desktop/Fourth Year        2017 - 2018/Second Semester/Capstone Design/CMPS2/CMPS2.ino: In function ‘void loop()’:
/Users/varunbhandari/Desktop/Fourth Year        2017 - 2018/Second Semester/Capstone Design/CMPS2/CMPS2.ino:30:11: warning: array subscript is above array bounds [-Warray-bounds]
   numStr = '\0';

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now