Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CMPS12_KRAI.h
00001 /* 00002 * adopted from 00003 * CMPS03 by: Aarom Berk 00004 * 00005 * Bismillahirahmanirrahim 00006 */ 00007 00008 #ifndef CMPS12_KRAI_H 00009 #define CMPS12_KRAI_H 00010 00011 /** 00012 * Includes 00013 */ 00014 #include "mbed.h" 00015 00016 #define CMPS_DEFAULT_I2C_ADDRESS 0xC0 00017 //set register kompas 00018 #define SOFTWARE_REVISION_REG 0x0 00019 #define COMPASS_BEARING_WORD_REG 0x2 00020 #define COMPASS_PITCH_WORD_REG 0x4 00021 #define COMPASS_ROLL_WORD_REG 0x5 00022 00023 /** Interface to read compass using I2C communciation 00024 * compass type : CMPS 12 00025 */ 00026 class CMPS12_KRAI { 00027 00028 I2C* i2c; 00029 int i2cAddress; 00030 00031 public: 00032 00033 /** Create CMPS12 inteface 00034 * 00035 * 00036 * @param sda mbed pin to use for I2C SDA 00037 * @param scl mbed pin to use for I2C SCL 00038 * @param address I2C address of this device. 00039 */ 00040 CMPS12_KRAI(PinName sda, PinName scl, int address); 00041 00042 /** Membaca revisi dari kompas 00043 * 00044 */ 00045 char readSoftwareRevision(void); 00046 00047 /** Membaca nilai dari kompas 00048 * 00049 * Range nilai 0 - 3599 00050 */ 00051 int getAngle(void); 00052 00053 /** Membaca nilai sudut pitch dari kompas 00054 * 00055 * Range nilai 0 - 3599 00056 */ 00057 int getPitch(void); 00058 00059 /** Membaca nilai sudut roll dari kompas 00060 * 00061 * Range nilai (+/-90) 00062 */ 00063 int getRoll(void); 00064 00065 /** Kalibrasi kompas 00066 * 00067 */ 00068 void calibrate(void); 00069 00070 /** Stop calibrate 00071 * 00072 */ 00073 void stopCalibrate(void); 00074 00075 int getAccelX(void); 00076 }; 00077 00078 #endif /* CMPS_KRAI_H */
Generated on Tue Jul 12 2022 22:57:42 by
