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.
Fork of Alarmsystem_log_funksjon_funker_ikke by
Diff: main.cpp
- Revision:
- 13:0622c228b67d
- Parent:
- 12:0193024eab13
- Child:
- 14:8e7aaf0cf5d7
--- a/main.cpp Mon Feb 19 08:17:48 2018 +0000
+++ b/main.cpp Tue Feb 20 07:48:13 2018 +0000
@@ -2,41 +2,43 @@
#include "rtos.h"
#include <RtosTimer.h>
#include <math.h>
-
-
#include "mbed_error.h"
+/////DEFINISJONER/////
#define Inn 4
+Serial pc(USBTX, USBRX);
//#define Feil 0<1
-
-//DigitalOut myled2(LED2);
-Serial pc(USBTX, USBRX);
-DigitalOut Driftslys(LED1);
-BusOut AlarmUtganger1(p21, p22, p23, p24); //1 - Dør 1 Sone 1, 2 - Dør 1 Sone 2, 4 - Dør 1 Sone 3, 8 - Dør 1 Sone 4
-BusOut AlarmUtganger2(p25, p26, p27, p28); //1 - Dør 2 Sone 1, 2 - Dør 2 Sone 2, 4 - Dør 2 Sone 3, 8 - Dør 2 Sone 4
+/////INNGANGER/////
DigitalIn Servicebryter(p20);
AnalogIn _Sone1(p15);
AnalogIn _Sone2(p16);
AnalogIn _Sone3(p17);
AnalogIn _Sone4(p19);
+
+/////UTGANGER/////
+DigitalOut Driftslys(LED1);
+BusOut AlarmUtganger1(p21, p22, p23, p24); //1 - Dør 1 Sone 1, 2 - Dør 1 Sone 2, 4 - Dør 1 Sone 3, 8 - Dør 1 Sone 4
+BusOut AlarmUtganger2(p25, p26, p27, p28); //1 - Dør 2 Sone 1, 2 - Dør 2 Sone 2, 4 - Dør 2 Sone 3, 8 - Dør 2 Sone 4
+//DigitalOut myled2(LED2);
+
+/////VARIABLER/////
float Soner[Inn];
int tilstand = 0;
int TilstandSjekk(int, int);
-void Alarmf();
-Thread thread;
volatile bool running = true;
-//Ticker AlarmBlink; // 10Hz blinking for alarmfunksjon på lys og telling
+//volatile int Klokke = 0;
//nt Tid = 0;
+/////FUNKSJON DEKLARASJONER/////
+void Alarmf();
+Thread thread;
int Tilstandssjekk();
//void Alarm();
-//volatile int Klokke = 0;
+//Ticker AlarmBlink; // 10Hz blinking for alarmfunksjon på lys og telling
-void Alarmf(void) {
- Driftslys = !Driftslys;
-}
+/////MAIN/////
int main()
{
while(1) {
@@ -84,6 +86,11 @@
}
}
+/////FUNKSJONER/////
+void Alarmf(void) {
+ Driftslys = !Driftslys;
+}
+
int TilstandSjekk(int i, int tilstand)
{
if(tilstand == 0) {
@@ -138,8 +145,6 @@
}
return 0;
}
-
-
/*void Alarm()
{
