mappe1 beta

Dependencies:   mbed

Committer:
GramTech
Date:
Thu Feb 27 08:06:40 2014 +0000
Revision:
2:316f91ebaf49
Parent:
1:9bd095bf1698
Child:
3:e55f06ddce90
mappe2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GramTech 0:b49b25afcee5 1 #include "mbed.h"
GramTech 0:b49b25afcee5 2 #include "SerialBuff.h"
GramTech 0:b49b25afcee5 3 #include "Timer.h"
GramTech 0:b49b25afcee5 4
GramTech 0:b49b25afcee5 5 DigitalOut drift1(LED1),drift2(LED2),drift3(LED3),drift4(LED4);
GramTech 0:b49b25afcee5 6 DigitalOut rod1(p23),rod2(p24),rod3(p25),rod4(p26),rod5(p27),rod6(p28),rod7(p29),rod8(p30);
GramTech 0:b49b25afcee5 7 DigitalIn reset1(p13);
GramTech 0:b49b25afcee5 8 AnalogIn sone1(p15),sone2(p16),sone3(p17),sone4(p18);
GramTech 0:b49b25afcee5 9
GramTech 0:b49b25afcee5 10 Ticker t1;
GramTech 0:b49b25afcee5 11
GramTech 0:b49b25afcee5 12 LocalFileSystem local("local");
GramTech 0:b49b25afcee5 13
GramTech 0:b49b25afcee5 14 Serial pc(USBTX, USBRX);
GramTech 0:b49b25afcee5 15
GramTech 0:b49b25afcee5 16
GramTech 0:b49b25afcee5 17 void alarm1(void);
GramTech 0:b49b25afcee5 18 void alarm2(void);
GramTech 0:b49b25afcee5 19 void alarm3(void);
GramTech 0:b49b25afcee5 20 void alarm4(void);
GramTech 0:b49b25afcee5 21 void blink1(void);
GramTech 0:b49b25afcee5 22 void blink2(void);
GramTech 0:b49b25afcee5 23 void blink3(void);
GramTech 0:b49b25afcee5 24 void blink4(void);
GramTech 0:b49b25afcee5 25 void logg(void);
GramTech 0:b49b25afcee5 26 void testlogg(void);
GramTech 0:b49b25afcee5 27 void reset(void);
GramTech 0:b49b25afcee5 28 void sekunder(void);
GramTech 0:b49b25afcee5 29 void passord(void);
GramTech 0:b49b25afcee5 30 void meny(void);
GramTech 0:b49b25afcee5 31 void status(void);
GramTech 0:b49b25afcee5 32 void linje1(void);
GramTech 0:b49b25afcee5 33
GramTech 0:b49b25afcee5 34 #define grense0 1 // 3.3v
GramTech 0:b49b25afcee5 35 #define grense3 0.5 // sone 1 0.5
GramTech 0:b49b25afcee5 36 #define grense2 0.662 // sone 2 0.662
GramTech 0:b49b25afcee5 37 #define grense1 0.398 // sone 1 og 2 0.398
GramTech 0:b49b25afcee5 38 #define blink 0.1
GramTech 0:b49b25afcee5 39 #define vindu 0.08
GramTech 0:b49b25afcee5 40
GramTech 0:b49b25afcee5 41 volatile unsigned int sek = 0,min = 0,hour = 0,dag = 0,stat_rod1,stat_rod2,stat_rod3,stat_rod4,stat_rod5,stat_rod6,stat_rod7,stat_rod8,stat_reset,passord_1,valg,reset2;
GramTech 0:b49b25afcee5 42
GramTech 0:b49b25afcee5 43
GramTech 0:b49b25afcee5 44 int main()
GramTech 0:b49b25afcee5 45 {
GramTech 0:b49b25afcee5 46 reset1.mode(PullDown);
GramTech 0:b49b25afcee5 47 passord();
GramTech 2:316f91ebaf49 48 meny();
GramTech 0:b49b25afcee5 49 t1.attach(&sekunder, 1.0);
GramTech 0:b49b25afcee5 50 while(1) {
GramTech 0:b49b25afcee5 51 alarm1();
GramTech 0:b49b25afcee5 52 alarm2();
GramTech 0:b49b25afcee5 53 alarm3();
GramTech 0:b49b25afcee5 54 alarm4();
GramTech 0:b49b25afcee5 55
GramTech 0:b49b25afcee5 56 reset();
GramTech 0:b49b25afcee5 57 wait (0.1);
GramTech 0:b49b25afcee5 58 }
GramTech 0:b49b25afcee5 59
GramTech 0:b49b25afcee5 60 }
GramTech 0:b49b25afcee5 61 void meny(void)
GramTech 0:b49b25afcee5 62 {
GramTech 0:b49b25afcee5 63
GramTech 0:b49b25afcee5 64 printf("\r\n\r\nMeny\r\n\r\n");
GramTech 0:b49b25afcee5 65 printf("Tast:\r\n");
GramTech 0:b49b25afcee5 66 printf("1 starte systemet\r\n");
GramTech 0:b49b25afcee5 67 printf("2 reset alarmen\r\n");
GramTech 0:b49b25afcee5 68 printf("3 avslutte systemet\r\n");
GramTech 0:b49b25afcee5 69 printf("4 status\r\n");
GramTech 0:b49b25afcee5 70 scanf("%d",&valg);
GramTech 0:b49b25afcee5 71
GramTech 0:b49b25afcee5 72 if(valg == 1) {
GramTech 2:316f91ebaf49 73
GramTech 0:b49b25afcee5 74 } else if(valg == 2) {
GramTech 0:b49b25afcee5 75 reset2 = 1;
GramTech 0:b49b25afcee5 76 } else if(valg == 3) {
GramTech 2:316f91ebaf49 77 passord();
GramTech 0:b49b25afcee5 78 } else if(valg == 4) {
GramTech 0:b49b25afcee5 79 status();
GramTech 0:b49b25afcee5 80 } else {
GramTech 0:b49b25afcee5 81
GramTech 0:b49b25afcee5 82 }
GramTech 0:b49b25afcee5 83 }
GramTech 0:b49b25afcee5 84
GramTech 0:b49b25afcee5 85
GramTech 0:b49b25afcee5 86
GramTech 0:b49b25afcee5 87 void linje1(void)
GramTech 0:b49b25afcee5 88 {
GramTech 0:b49b25afcee5 89 printf("\r\nVelkommen til BitGuard 3.25.1");
GramTech 0:b49b25afcee5 90 }
GramTech 0:b49b25afcee5 91
GramTech 0:b49b25afcee5 92 void status(void)
GramTech 0:b49b25afcee5 93 {
GramTech 0:b49b25afcee5 94 if(rod1 == 1) {
GramTech 0:b49b25afcee5 95 printf("sløyfe 1\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 96 }
GramTech 0:b49b25afcee5 97 if (rod2 == 1) {
GramTech 0:b49b25afcee5 98 printf("sløyfe 1\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 99 }
GramTech 0:b49b25afcee5 100 if(rod3 == 1) {
GramTech 0:b49b25afcee5 101 printf("sløyfe 2\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 102 }
GramTech 0:b49b25afcee5 103 if(rod4 == 1) {
GramTech 0:b49b25afcee5 104 printf("sløyfe 2\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 105 }
GramTech 0:b49b25afcee5 106 if(rod5 == 1) {
GramTech 0:b49b25afcee5 107 printf("sløyfe 3\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 108 }
GramTech 0:b49b25afcee5 109 if(rod6 == 1) {
GramTech 0:b49b25afcee5 110 printf("sløyfe 3\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 111 }
GramTech 0:b49b25afcee5 112 if(rod7 == 1) {
GramTech 0:b49b25afcee5 113 printf("sløyfe 4\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 114
GramTech 0:b49b25afcee5 115 }
GramTech 0:b49b25afcee5 116 if(rod8 == 1) {
GramTech 0:b49b25afcee5 117 printf("sløyfe 4\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 118 }
GramTech 0:b49b25afcee5 119 if(reset1 == 0) {
GramTech 0:b49b25afcee5 120 printf("alarmen har blitt resatt\r\n");
GramTech 0:b49b25afcee5 121 } else {
GramTech 0:b49b25afcee5 122 printf("\r\nalt er i orden, ingen alarm er utlost");
GramTech 0:b49b25afcee5 123 }
GramTech 0:b49b25afcee5 124 meny();
GramTech 0:b49b25afcee5 125 }
GramTech 0:b49b25afcee5 126 void passord (void)
GramTech 0:b49b25afcee5 127 {
GramTech 0:b49b25afcee5 128 printf("Hei!\r\nvenligst tast inn passord\r\n");
GramTech 0:b49b25afcee5 129 scanf("%d", &passord_1);
GramTech 0:b49b25afcee5 130 while (passord_1 != 258456) {
GramTech 0:b49b25afcee5 131 printf("passord du har tastet inn er feil \r\nvenligst prov igjen\r\n ");
GramTech 0:b49b25afcee5 132 scanf("%d", &passord_1);
GramTech 0:b49b25afcee5 133 }
GramTech 0:b49b25afcee5 134 linje1();
GramTech 0:b49b25afcee5 135 }
GramTech 0:b49b25afcee5 136 void sekunder(void)
GramTech 0:b49b25afcee5 137 {
GramTech 0:b49b25afcee5 138 sek++;
GramTech 0:b49b25afcee5 139 min = sek / 60;
GramTech 0:b49b25afcee5 140 sek = sek % 60;
GramTech 0:b49b25afcee5 141 hour = min / 60;
GramTech 0:b49b25afcee5 142 min %= 60;
GramTech 0:b49b25afcee5 143 dag = hour / 24;
GramTech 0:b49b25afcee5 144 hour %= 24;
GramTech 0:b49b25afcee5 145
GramTech 0:b49b25afcee5 146 }
GramTech 0:b49b25afcee5 147 void alarm1(void)
GramTech 0:b49b25afcee5 148 {
GramTech 0:b49b25afcee5 149 if( (sone1 >= (grense0 - vindu)) && (sone1 <= (grense0 + vindu))) {
GramTech 0:b49b25afcee5 150 blink1();
GramTech 0:b49b25afcee5 151 testlogg();
GramTech 0:b49b25afcee5 152 } else if( (sone1 >= (grense1 - vindu)) && (sone1 <= (grense1 + vindu))) {
GramTech 0:b49b25afcee5 153 blink1();
GramTech 0:b49b25afcee5 154 rod1 = 1;
GramTech 0:b49b25afcee5 155 rod2 = 1;
GramTech 0:b49b25afcee5 156
GramTech 0:b49b25afcee5 157 } else if( (sone1 >= (grense2 - vindu)) && (sone1 <= (grense2 + vindu))) {
GramTech 0:b49b25afcee5 158 blink1();
GramTech 0:b49b25afcee5 159 rod1 = 1;
GramTech 0:b49b25afcee5 160
GramTech 0:b49b25afcee5 161 } else {
GramTech 0:b49b25afcee5 162 blink1();
GramTech 0:b49b25afcee5 163 rod2 = 1;
GramTech 0:b49b25afcee5 164
GramTech 0:b49b25afcee5 165
GramTech 0:b49b25afcee5 166 }
GramTech 0:b49b25afcee5 167
GramTech 0:b49b25afcee5 168
GramTech 0:b49b25afcee5 169
GramTech 0:b49b25afcee5 170 }
GramTech 0:b49b25afcee5 171
GramTech 0:b49b25afcee5 172
GramTech 0:b49b25afcee5 173
GramTech 0:b49b25afcee5 174
GramTech 0:b49b25afcee5 175 void alarm2(void)
GramTech 0:b49b25afcee5 176 {
GramTech 0:b49b25afcee5 177 if((sone2 >= (grense0 - vindu)) && (sone2 <= (grense0 + vindu))) {
GramTech 0:b49b25afcee5 178 blink2();
GramTech 0:b49b25afcee5 179 testlogg();
GramTech 0:b49b25afcee5 180 } else if((sone2 >= (grense1 - vindu)) && (sone2 <= (grense1 + vindu))) {
GramTech 0:b49b25afcee5 181 blink2();
GramTech 0:b49b25afcee5 182 rod3 = 1;
GramTech 0:b49b25afcee5 183 rod4 = 1;
GramTech 0:b49b25afcee5 184 } else if((sone2 >= (grense2 - vindu)) && (sone2 <= (grense2 + vindu))) {
GramTech 0:b49b25afcee5 185 blink2();
GramTech 0:b49b25afcee5 186 rod3 = 1;
GramTech 0:b49b25afcee5 187
GramTech 0:b49b25afcee5 188 } else {
GramTech 0:b49b25afcee5 189 blink2();
GramTech 0:b49b25afcee5 190 rod4 = 1;
GramTech 0:b49b25afcee5 191
GramTech 0:b49b25afcee5 192 }
GramTech 0:b49b25afcee5 193
GramTech 0:b49b25afcee5 194
GramTech 0:b49b25afcee5 195 }
GramTech 0:b49b25afcee5 196
GramTech 0:b49b25afcee5 197 void alarm3(void)
GramTech 0:b49b25afcee5 198 {
GramTech 0:b49b25afcee5 199 if( (sone3 >= (grense0 - vindu)) && (sone3 <= (grense0 + vindu))) {
GramTech 0:b49b25afcee5 200 blink3();
GramTech 0:b49b25afcee5 201 testlogg();
GramTech 0:b49b25afcee5 202 } else if( (sone3 >= (grense1 - vindu)) && (sone3 <= (grense1 + vindu))) {
GramTech 0:b49b25afcee5 203 blink3();
GramTech 0:b49b25afcee5 204 rod5 = 1;
GramTech 0:b49b25afcee5 205 rod6 = 1;
GramTech 0:b49b25afcee5 206 } else if( (sone3 >= (grense2 - vindu)) && (sone3 <= (grense2 + vindu))) {
GramTech 0:b49b25afcee5 207 blink3();
GramTech 0:b49b25afcee5 208 rod5 = 1;
GramTech 0:b49b25afcee5 209 } else {
GramTech 0:b49b25afcee5 210 blink3();
GramTech 0:b49b25afcee5 211 rod6 = 1;
GramTech 0:b49b25afcee5 212
GramTech 0:b49b25afcee5 213 }
GramTech 0:b49b25afcee5 214
GramTech 0:b49b25afcee5 215
GramTech 0:b49b25afcee5 216
GramTech 0:b49b25afcee5 217 }
GramTech 0:b49b25afcee5 218
GramTech 0:b49b25afcee5 219 void alarm4(void)
GramTech 0:b49b25afcee5 220 {
GramTech 0:b49b25afcee5 221 if( (sone4 >= (grense0 - vindu)) && (sone4 <= (grense0 + vindu))) {
GramTech 0:b49b25afcee5 222 blink4();
GramTech 0:b49b25afcee5 223 testlogg();
GramTech 0:b49b25afcee5 224 } else if( (sone4 >= (grense1 - vindu)) && (sone4 <= (grense1 + vindu))) {
GramTech 0:b49b25afcee5 225 blink4();
GramTech 0:b49b25afcee5 226 rod7 = 1;
GramTech 0:b49b25afcee5 227 rod8 = 1;
GramTech 0:b49b25afcee5 228 } else if( (sone4 >= (grense2 - vindu)) && (sone4 <= (grense2 + vindu))) {
GramTech 0:b49b25afcee5 229 blink4();
GramTech 0:b49b25afcee5 230 rod7 = 1;
GramTech 0:b49b25afcee5 231 } else {
GramTech 0:b49b25afcee5 232 blink4();
GramTech 0:b49b25afcee5 233 rod8 = 1;
GramTech 0:b49b25afcee5 234
GramTech 0:b49b25afcee5 235 }
GramTech 0:b49b25afcee5 236
GramTech 0:b49b25afcee5 237
GramTech 0:b49b25afcee5 238
GramTech 0:b49b25afcee5 239 }
GramTech 0:b49b25afcee5 240 void blink1(void)
GramTech 0:b49b25afcee5 241 {
GramTech 0:b49b25afcee5 242 if ( rod1 == 1||rod2 == 1) {
GramTech 0:b49b25afcee5 243 drift1 = 1;
GramTech 0:b49b25afcee5 244 wait(blink);
GramTech 0:b49b25afcee5 245 drift1 = 0;
GramTech 0:b49b25afcee5 246 } else {
GramTech 0:b49b25afcee5 247 drift1 = 1;
GramTech 0:b49b25afcee5 248 }
GramTech 0:b49b25afcee5 249 }
GramTech 0:b49b25afcee5 250
GramTech 0:b49b25afcee5 251 void blink2(void)
GramTech 0:b49b25afcee5 252 {
GramTech 0:b49b25afcee5 253 if ( rod3 == 1||rod4 == 1) {
GramTech 0:b49b25afcee5 254 drift2 = 1;
GramTech 0:b49b25afcee5 255 wait(blink);
GramTech 0:b49b25afcee5 256 drift2 = 0;
GramTech 0:b49b25afcee5 257 } else {
GramTech 0:b49b25afcee5 258 drift2 = 1;
GramTech 0:b49b25afcee5 259 }
GramTech 0:b49b25afcee5 260 }
GramTech 0:b49b25afcee5 261
GramTech 0:b49b25afcee5 262 void blink3(void)
GramTech 0:b49b25afcee5 263 {
GramTech 0:b49b25afcee5 264 if ( rod5 == 1||rod6 == 1) {
GramTech 0:b49b25afcee5 265 drift3 = 1;
GramTech 0:b49b25afcee5 266 wait(blink);
GramTech 0:b49b25afcee5 267 drift3 = 0;
GramTech 0:b49b25afcee5 268 } else {
GramTech 0:b49b25afcee5 269 drift3 = 1;
GramTech 0:b49b25afcee5 270 }
GramTech 0:b49b25afcee5 271 }
GramTech 0:b49b25afcee5 272
GramTech 0:b49b25afcee5 273 void blink4(void)
GramTech 0:b49b25afcee5 274 {
GramTech 0:b49b25afcee5 275 if ( rod7 == 1||rod8 == 1) {
GramTech 0:b49b25afcee5 276 drift4 = 1;
GramTech 0:b49b25afcee5 277 wait(blink);
GramTech 0:b49b25afcee5 278 drift4 = 0;
GramTech 0:b49b25afcee5 279 } else {
GramTech 0:b49b25afcee5 280 drift4 = 1;
GramTech 0:b49b25afcee5 281 }
GramTech 0:b49b25afcee5 282 }
GramTech 0:b49b25afcee5 283 void reset(void)
GramTech 0:b49b25afcee5 284 {
GramTech 0:b49b25afcee5 285 if (reset1 == 0 || reset2 == 1 ) {
GramTech 0:b49b25afcee5 286 rod1=rod2=rod3=rod4=rod5=rod6=rod7=rod8=drift1=drift2=drift3=drift4 = 0 ;
GramTech 0:b49b25afcee5 287 }
GramTech 0:b49b25afcee5 288 reset2 = 0;
GramTech 0:b49b25afcee5 289 // scanf("%d",&valg);
GramTech 0:b49b25afcee5 290 }
GramTech 0:b49b25afcee5 291
GramTech 0:b49b25afcee5 292
GramTech 0:b49b25afcee5 293 void testlogg(void)
GramTech 0:b49b25afcee5 294 {
GramTech 0:b49b25afcee5 295 if(rod1||rod2||rod3||rod4||rod5||rod6||rod7||rod8 == 1) {
GramTech 0:b49b25afcee5 296 logg();
GramTech 0:b49b25afcee5 297
GramTech 0:b49b25afcee5 298 }
GramTech 0:b49b25afcee5 299 }
GramTech 0:b49b25afcee5 300
GramTech 0:b49b25afcee5 301
GramTech 0:b49b25afcee5 302 void logg(void)
GramTech 0:b49b25afcee5 303 {
GramTech 0:b49b25afcee5 304 FILE *fp = fopen("/local/logg.txt", "a");
GramTech 0:b49b25afcee5 305 if (fp == NULL) {
GramTech 0:b49b25afcee5 306 pc.printf("Filfeil - avslutter\r\n");
GramTech 0:b49b25afcee5 307 exit(1);
GramTech 0:b49b25afcee5 308 }
GramTech 0:b49b25afcee5 309
GramTech 0:b49b25afcee5 310 if(rod1 == 1 && stat_rod1 == 0 ) {
GramTech 0:b49b25afcee5 311 fprintf(fp,"sløyfe 1\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 312 stat_rod1 = 1;
GramTech 0:b49b25afcee5 313 }
GramTech 0:b49b25afcee5 314 if (rod2 == 1 && stat_rod2 == 0 ) {
GramTech 0:b49b25afcee5 315 fprintf(fp,"sløyfe 1\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 316 stat_rod2 = 1;
GramTech 0:b49b25afcee5 317 }
GramTech 0:b49b25afcee5 318 if(rod3 == 1 && stat_rod3 == 0 ) {
GramTech 0:b49b25afcee5 319 fprintf(fp,"sløyfe 2\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 320 stat_rod3 = 1;
GramTech 0:b49b25afcee5 321 }
GramTech 0:b49b25afcee5 322 if(rod4 == 1 && stat_rod4 == 0 ) {
GramTech 0:b49b25afcee5 323 fprintf(fp,"sløyfe 2\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 324 stat_rod4 = 1;
GramTech 0:b49b25afcee5 325 }
GramTech 0:b49b25afcee5 326 if(rod5 == 1 && stat_rod5 == 0 ) {
GramTech 0:b49b25afcee5 327 fprintf(fp,"sløyfe 3\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 328 stat_rod5 = 1;
GramTech 0:b49b25afcee5 329 }
GramTech 0:b49b25afcee5 330 if(rod6 == 1 && stat_rod6 == 0 ) {
GramTech 0:b49b25afcee5 331 fprintf(fp,"sløyfe 3\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 332 stat_rod6 = 1;
GramTech 0:b49b25afcee5 333 }
GramTech 0:b49b25afcee5 334 if(rod7 == 1 && stat_rod7 == 0 ) {
GramTech 0:b49b25afcee5 335 fprintf(fp,"sløyfe 4\r\ndetektor 1 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 336 stat_rod7 = 1;
GramTech 0:b49b25afcee5 337 }
GramTech 0:b49b25afcee5 338 if(rod8 == 1 && stat_rod8 == 0 ) {
GramTech 0:b49b25afcee5 339 fprintf(fp,"sløyfe 4\r\ndetektor 2 har slått ut etter %dsek %dmin %dtimer %ddager\r\n",sek,min,hour,dag);
GramTech 0:b49b25afcee5 340 stat_rod8 = 1;
GramTech 0:b49b25afcee5 341 }
GramTech 0:b49b25afcee5 342 if(reset1 == 0 && stat_reset == 0) {
GramTech 0:b49b25afcee5 343 fprintf(fp,"alarmen har blitt resatt\r\n");
GramTech 0:b49b25afcee5 344 stat_reset = 1;
GramTech 0:b49b25afcee5 345 }
GramTech 0:b49b25afcee5 346 fclose(fp);
GramTech 0:b49b25afcee5 347 }