mappe1 beta

Dependencies:   mbed

Committer:
GramTech
Date:
Thu Feb 27 07:46:22 2014 +0000
Revision:
0:b49b25afcee5
Child:
1:9bd095bf1698
mappe1

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