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.
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include "HMC6352.h" 00004 00005 HMC6352 compass(p28,p27); 00006 TextLCD lcd(p6, p7, p8, p9, p10, p11, p12);//Connect LCD module from p5 to p12. 00007 AnalogIn ad_h(p19); 00008 AnalogIn ad_t(p20); 00009 00010 int main() { 00011 00012 float H_data, T_data; 00013 float C_data; 00014 00015 lcd.cls(); 00016 lcd.printf("White Wizard"); 00017 00018 //Continuous mode, periodic set/reset, 20Hz measurement rate. 00019 compass.setOpMode(HMC6352_CONTINUOUS, 1, 20); 00020 00021 wait(3); 00022 00023 lcd.cls(); 00024 00025 while(1){ 00026 C_data = compass.sample(); 00027 T_data = ad_t.read() * 3.3; 00028 T_data = 100.0 * (T_data - 0.5); 00029 00030 H_data = ad_h.read() * 3.3; 00031 H_data = (80.0 / 1.4) * (H_data - 0.6); 00032 00033 lcd.cls(); 00034 lcd.printf("C:%d T:%d H:%d", (int)(C_data/10.0), (int)T_data, (int)H_data); 00035 wait(1); 00036 } 00037 }
Generated on Wed Jul 20 2022 22:03:36 by
1.7.2