RDCM-802 Digital Compass Module
It bought it with KYOHRITSU of Osaka.
Class library for RDCM-802 was here.
Sample program was here.
#include "mbed.h" #include "TextLCD.h" #include "RDCM802.h" DigitalOut myled(LED1); TextLCD lcd(p8, p12, p15, p16, p29, p30, TextLCD::LCD16x2); // rs, e, d0-d3 RDCM802 Compass(p18 /* D0 */, p19 /* D1 */, p20 /* D2 */); int main() { int nowCompass; while(1) { lcd.cls(); lcd.locate(0,0); nowCompass = Compass; lcd.printf("COMPASS:0x%04x\n",nowCompass); lcd.printf("[%s]\n",Compass.toString()); myled = 1; wait(0.2); myled = 0; wait(0.2); } }
Attention
There seems to be something to which the D0 bit and the D2 bit are written oppositely when retrieving it with Web.
For example, D0 is opposite to D2 in these two Web pages.
- http://www.geosensory.com/pdf/rdcm-802.pdf
- http://www.technobase.jp/eclib/OTHER/DATASHEET/rdcm802j.pdf
The class library that I wrote is processed by the row of this table.
N | NE | E | SE | S | SW | W | NW | |
D0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
D1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |
D2 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
0 comments
You need to log in to post a comment