Here
Dependencies: Hexi_KW40Z Hexi_OLED_SSD1351 nRF24L01 FXOS8700
Revision 21:6d54edeb2f33, committed 2017-04-26
- Comitter:
- tdh50
- Date:
- Wed Apr 26 16:41:30 2017 +0000
- Parent:
- 20:c0d25619a65e
- Commit message:
- Changed fall threshold
Changed in this revision
FXOS8700.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c0d25619a65e -r 6d54edeb2f33 FXOS8700.lib --- a/FXOS8700.lib Wed Apr 19 17:11:00 2017 +0000 +++ b/FXOS8700.lib Wed Apr 26 16:41:30 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/tdh50/code/FXOS8700/#b7334257ebe8 +https://developer.mbed.org/users/tdh50/code/FXOS8700/#cbe52f68f6a0
diff -r c0d25619a65e -r 6d54edeb2f33 main.cpp --- a/main.cpp Wed Apr 19 17:11:00 2017 +0000 +++ b/main.cpp Wed Apr 26 16:41:30 2017 +0000 @@ -123,10 +123,10 @@ } else { screenNum--; } - } else { - StartHaptic(); + } else if(alert == false) { screenNum = 5; } + StartHaptic(); } } @@ -173,6 +173,9 @@ int main() { accel.accel_config(); + + oled.FillScreen(COLOR_BLACK); + // Get & set OLED Class Default Text Properties oled.GetTextProperties(&textProperties); @@ -193,10 +196,11 @@ //Change font color to white textProperties.fontColor = COLOR_WHITE; - textProperties.alignParam = OLED_TEXT_ALIGN_CENTER; + textProperties.alignParam = OLED_TEXT_ALIGN_RIGHT; txThread.start(txTask); //Start transmitting Sensor Tag Data + while (true) { accel.acquire_accel_data_g(accel_data); accel_rms = sqrt(((accel_data[0]*accel_data[0])+(accel_data[1]*accel_data[1])+(accel_data[2]*accel_data[2]))/3); @@ -204,11 +208,13 @@ y = accel_data[1] *10000; z = accel_data[2] *10000; + + // Check screen, alert and num values //printf("Screen = %i Num = %i alert = %d\n\r",screenNum,num,alert); // Check Fall Data //printf("%4.4f\n\r",accel_rms); - if(accel_rms*10 > 12.4) { //Triggers AlertBMP if fall is detected + if(accel_rms*10 > 14.0 && alert == false) { //Triggers AlertBMP if fall is detected oled.DrawImage(AlertBMP,0,0); previous = screenNum;//Allows to return to previous screen. num = screenNum - 1;//^ @@ -220,6 +226,8 @@ //Trigger Blinking Red LED when alarm is set off if(alert == true) { redLed = !redLed; + hapticTimer.start(30); + haptic = 1; } if((screenNum != num && alert == false) || screenNum == 4) { redLed = 1;