Has anyone written a sketch that will communicate, using the serial mode on the CMPS10 electronic compass. I can do it with I2C, but I cannot figure out, or make it work using trying to communicate with it serially...
Dennis
Has anyone written a sketch that will communicate, using the serial mode on the CMPS10 electronic compass. I can do it with I2C, but I cannot figure out, or make it work using trying to communicate with it serially...
Dennis
Do you have documentation on the CMPS10 serial port?
Well, yes...if you google CMPS10, there are several sites that show the documentation of the device. As I mentioned, there are 3 ways to, according to the documentation, to extract the compass heading, one of which is by using serial comunications. The communication, requires 2 stops bits..and I am not sure, having tried...to do this. I would appreciate your input, once you have reviewed the documentation.
DenoB
JohnLincoln:
Clearly there is a mistake here as two of the modes are both described as being selected by grounding the mode pin, and there is no mention of connecting the pin to the 3.3 - 5V supply pin.
No it's no mistake
To enter the PWM mode of operation you are required to connect the Select PWM pin to ground. After 500ms
the module will enter PWM mode and output a variable high pulse from the PWM out pin dependant on the
angle of the PCB.
So for PWM mode you would ground the mode pin and then ground the "Select PWM" pin (the same one that would be "Rx" in serial mode.
Try this version of the documentation: http://www.pishrobot.com/files/products/datasheets/cmps10.pdf
You can modify SoftwareSerial to use two stop bits. In SoftwareSerial.cpp change these lines near the end of SoftwareSerial::write() from:
SREG = oldSREG; // turn interrupts back on
tunedDelay(_tx_delay);
to
SREG = oldSREG; // turn interrupts back on
tunedDelay(_tx_delay);
tunedDelay(_tx_delay); // Second stop bit