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.
Dependencies: mbos Watchdog TextLCD mbed ConfigFile
Task4LedBlink.cpp
00001 #include "Task4LedBlink.h" 00002 00003 void LedBlinkTask(void) 00004 {/** 00005 *\brief TASK 4 00006 LED 1: Quick blink=NOT fix, Slow blink=fix OK 00007 LED 2: blinks proportionally to HDOP 00008 LED 3: blinks proportionally to VDOP 00009 */ 00010 00011 static int LedCnt1=0; 00012 // static int LedCnt2=0; 00013 int OnH=0; 00014 int OnV=0; 00015 00016 #define MAX 20 00017 00018 os.SetTimer(LED_BLINK_TMR, 100, 100); 00019 00020 while(1) 00021 { 00022 os.WaitEvent(LED_BLINK_EVT); 00023 00024 if((info.HDOP>0)&&(info.HDOP<=2)) 00025 { 00026 OnH=2; 00027 } 00028 else if((info.HDOP>2)&&(info.HDOP<=4)) 00029 { 00030 OnH=4; 00031 } 00032 else if((info.HDOP>4)&&(info.HDOP<=6)) 00033 { 00034 OnH=6; 00035 } 00036 else if((info.HDOP>6)) 00037 { 00038 OnH=MAX/2; 00039 } 00040 00041 if((info.VDOP>0)&&(info.VDOP<=2)) 00042 { 00043 OnV=2; 00044 } 00045 else if((info.VDOP>2)&&(info.VDOP<=4)) 00046 { 00047 OnV=4; 00048 } 00049 else if((info.VDOP>4)&&(info.VDOP<=6)) 00050 { 00051 OnV=6; 00052 } 00053 else if((info.VDOP>6)) 00054 { 00055 OnV=MAX/2; 00056 } 00057 00058 if(info.sig == 0) 00059 { 00060 led1=!led1; 00061 led2=0; 00062 led3=0; 00063 } 00064 else 00065 { 00066 if(LedCnt1<=MAX/2) 00067 { 00068 LedCnt1++; 00069 led1=0; 00070 if(LedCnt1<OnH) 00071 { 00072 led2=!led2; 00073 } 00074 else 00075 { 00076 led2=0; 00077 } 00078 00079 if(LedCnt1<OnV) 00080 { 00081 led3=!led3; 00082 } 00083 else 00084 { 00085 led3=0; 00086 } 00087 } 00088 else if((LedCnt1>MAX/2)&&(LedCnt1<=MAX)) 00089 { 00090 LedCnt1++; 00091 led1=1; 00092 led2=0; 00093 led3=0; 00094 } 00095 else if(LedCnt1>MAX) 00096 { 00097 LedCnt1=0; 00098 } 00099 } 00100 } 00101 }
Generated on Thu Jul 14 2022 14:06:47 by
1.7.2