Added ABRO Arduino implementation

This commit is contained in:
Nis Wechselberg 2017-03-13 08:28:12 +01:00
parent 045f7bcad2
commit 842d4d3663
2 changed files with 165 additions and 0 deletions

36
ABRO/ABRO.ino Normal file
View file

@ -0,0 +1,36 @@
#include "ABROModel.c"
// Declarations
void setup() {
// Initializations
pinMode(11, INPUT);
pinMode(8, INPUT);
pinMode(5, INPUT);
pinMode(13, OUTPUT);
// Init model file
reset();
}
void loop() {
// Inputs
A = digitalRead(11) ? HIGH : LOW;
B = digitalRead(8) ? HIGH : LOW;
R = digitalRead(5) ? HIGH : LOW;
// Reaction of model
tick();
// Outputs
if (O) {
digitalWrite(13, HIGH);
} else {
digitalWrite(13, LOW);
}
}

129
ABRO/ABROModel.c Normal file
View file

@ -0,0 +1,129 @@
/*****************************************************************************/
/* G E N E R A T E D C C O D E */
/*****************************************************************************/
/* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient */
/* */
/* http://www.informatik.uni-kiel.de/rtsys/kieler/ */
/* Copyright 2014 by */
/* + Kiel University */
/* + Department of Computer Science */
/* + Real-Time and Embedded Systems Group */
/* */
/* This code is provided under the terms of the Eclipse Public License (EPL).*/
/*****************************************************************************/
char A;
char B;
char R;
char O;
char _trig;
char _trig2;
char _ABRO_local__termRegion;
char _ABRO_local__termRegion2;
char _GO;
char g0;
char g1;
char PRE_g1;
char g2;
char g4;
char g5;
char g6;
char g7;
char PRE_g7;
char g8;
char g9;
char g11;
char g12;
char g13;
char g14;
char PRE_g14;
char g15;
char g17;
char g18;
char g19;
char g20;
char PRE_g20;
char g21;
char g22;
char g23;
char g24;
char PRE_g24;
char g25;
char _condg4;
char _condg13;
char _condg19;
char g6_e1;
char g12_e2;
char g18_e3;
void reset() {
_GO = 1;
PRE_g1 = 0;
PRE_g7 = 0;
PRE_g14 = 0;
PRE_g20 = 0;
PRE_g24 = 0;
return;
}
void tick() {
{
g0 = _GO;
g25 = (PRE_g24);
g8 = (PRE_g7);
g9 = (g8 && R);
if (g9) {
_trig = 1;
}
g2 = (PRE_g1);
if (g2) {
_trig = 0;
_trig2 = 0;
_ABRO_local__termRegion = 0;
_ABRO_local__termRegion2 = 0;
}
g21 = (PRE_g20);
g17 = (g2 || g21);
g19 = (g17 && (!(B)));
_condg19 = _trig;
g18 = ((g17 && B) || (g19 && _condg19));
if (g18) {
_ABRO_local__termRegion2 = 1;
}
g15 = (PRE_g14);
g11 = (g2 || g15);
g13 = (g11 && (!(A)));
_condg13 = _trig;
g12 = ((g13 && _condg13) || (g11 && A));
if (g12) {
_ABRO_local__termRegion = 1;
}
g4 = (g2 || (g8 && (!(R))));
_condg4 = (_ABRO_local__termRegion && _ABRO_local__termRegion2);
g5 = (g4 && _condg4);
if (g5) {
_trig2 = 1;
}
g6 = (g9 || g5);
g7 = (g4 && (!(_condg4)));
g14 = (g13 && (!(_condg13)));
g20 = (g19 && (!(_condg19)));
g12_e2 = (!(g14));
g6_e1 = (!(g7));
g18_e3 = (!(g20));
g22 = ((g6_e1 || g6) && (g12_e2 || g12) && (g18_e3 || g18) && (g6 || g12 || g18));
g1 = (_GO || (g25 && R) || (g22 && _trig));
if (g1) {
O = 0;
}
g23 = (g22 && (!(_trig)));
if (g23) {
O = 1;
}
g24 = (g23 || (g25 && (!(R))));
}
PRE_g1 = g1;
PRE_g7 = g7;
PRE_g14 = g14;
PRE_g20 = g20;
PRE_g24 = g24;
_GO = 0;
return;
}