![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Use a touchscreen display to select which sensor measurement to display
Dependencies: mbed DisplayModule24_demo_day10
acc.h@8:a7b7edb66de5, 2017-01-17 (annotated)
- Committer:
- ldelaney17
- Date:
- Tue Jan 17 21:28:13 2017 +0000
- Revision:
- 8:a7b7edb66de5
- Parent:
- 6:3ee97b2c012c
final commit; cleaned up debug code; added comments; set 10s ticker period
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ldelaney17 | 1:f2a5ea8ff543 | 1 | /* |
ldelaney17 | 1:f2a5ea8ff543 | 2 | * Accelerometer header file |
ldelaney17 | 1:f2a5ea8ff543 | 3 | * initializes accelerometer to collect sensor data |
ldelaney17 | 1:f2a5ea8ff543 | 4 | * includes a function to return the magnitude of the acceleration |
ldelaney17 | 1:f2a5ea8ff543 | 5 | */ |
ldelaney17 | 1:f2a5ea8ff543 | 6 | #ifndef ACC_H |
ldelaney17 | 1:f2a5ea8ff543 | 7 | #define ACC_H |
ldelaney17 | 1:f2a5ea8ff543 | 8 | |
ldelaney17 | 1:f2a5ea8ff543 | 9 | #include "mbed.h" |
ldelaney17 | 1:f2a5ea8ff543 | 10 | |
ldelaney17 | 1:f2a5ea8ff543 | 11 | extern I2C connection; |
ldelaney17 | 1:f2a5ea8ff543 | 12 | extern Serial pc; |
ldelaney17 | 1:f2a5ea8ff543 | 13 | const int addr_acc = 0x53 << 1; |
ldelaney17 | 1:f2a5ea8ff543 | 14 | void acc_init(); |
ldelaney17 | 2:1ab4c19b99d4 | 15 | //gets a single magnitude reading. Prints the acceleration data if DEBUG_MODE is defined |
ldelaney17 | 1:f2a5ea8ff543 | 16 | float get_acc_magnitude(); |
ldelaney17 | 2:1ab4c19b99d4 | 17 | // averages n magnitude readings. Will make no readings and retrun for 0 and negative values of n |
ldelaney17 | 2:1ab4c19b99d4 | 18 | float get_avg_mag(int n =5); |
ldelaney17 | 1:f2a5ea8ff543 | 19 | |
ldelaney17 | 1:f2a5ea8ff543 | 20 | #endif |