Use a touchscreen display to select which sensor measurement to display
Dependencies: mbed DisplayModule24_demo_day10
Diff: compass.h
- Revision:
- 5:8a2afc6fdeb0
- Child:
- 7:b275c76de4ba
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compass.h Tue Jan 17 19:23:00 2017 +0000 @@ -0,0 +1,20 @@ +/* +* Compass I2C interface header file +* Laura Delaney +* 1/11/2017 +*/ + +#ifndef COMPASS_H_ +#define COMPASS_H_ + +extern I2C connection; +//initialize the sensor to single measure mode +void compass_init(int num_avg = 1); +//calculates the heading from the data, prints the heading if DEBUG_MODE is defined +float calc_heading(short mags[3], float declination); //x, z, y +//gets the heading, adjusted for the given declination +float get_heading(float declination); //spokane is +14.85 and getting smaller +//gets the average of n readings. If n is not given, averages 5 readings +float get_avg_heading(float declination, int n = 5); + +#endif