Configuration variable
This commit is contained in:
parent
bb777a91cc
commit
75af2b9196
|
@ -44,6 +44,15 @@ int comend; //value of combined left and middle digit. In case of practise end t
|
|||
|
||||
int segment[16] = {0x03f, 0x006, 0x05b, 0x04f, 0x066, 0x06d, 0x07d, 0x007, 0x07f, 0x06f, 0x040, 0x000, 0x03f, 0x000, 0x000, 0x073}; //0,1,2,3,4,5,6,7,8,9,-, , , , ,P
|
||||
|
||||
|
||||
enum PanelSide_t {LEFT, RIGHT};
|
||||
enum BuzzerStatus_t {BUZZER_OFF, BUZZER_ON};
|
||||
struct cfg_t {
|
||||
PanelSide_t PanelSide : 1;
|
||||
BuzzerStatus_t BuzzerStatus : 1;
|
||||
uint8_t : 0;
|
||||
} cfg;
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
|
@ -54,6 +63,10 @@ void setup()
|
|||
DDRA = 0xFF;
|
||||
DDRC = 0xFF;
|
||||
|
||||
// Load system configuration
|
||||
cfg.BuzzerStatus = digitalRead(A4) ? BUZZER_ON : BUZZER_OFF;
|
||||
cfg.PanelSide = digitalRead(A5) ? RIGHT : LEFT;
|
||||
|
||||
remember1 = 0;
|
||||
loop1 = 0;
|
||||
blinkk = 0;
|
||||
|
@ -83,8 +96,6 @@ void loop()
|
|||
// Check if string terminator
|
||||
if (digit == '\n')
|
||||
{
|
||||
bufferPtr = 0;
|
||||
|
||||
// Make string conversion
|
||||
serialvalue = inputString.toInt();
|
||||
inputString = "";
|
||||
|
@ -152,7 +163,7 @@ void loop()
|
|||
|
||||
//(((((statevalue>>7)&B00000111)=2)?LOW:HIGH) and )
|
||||
|
||||
if (digitalRead(A4))
|
||||
if (cfg.BuzzerStatus == BUZZER_ON) // digitalRead(A4)
|
||||
{ //buzzer yes/no switch
|
||||
digitalWrite(18, trafficvalue & 0x0008); //buzzer
|
||||
}
|
||||
|
@ -211,7 +222,7 @@ void loop()
|
|||
|
||||
//outputs depending on switch (A5 input) if right side or leftside is used
|
||||
|
||||
if (digitalRead(A5))
|
||||
if (cfg.PanelSide == RIGHT)
|
||||
{ //right side
|
||||
//Trafic lights:
|
||||
digitalWrite(19, (trafficvalue & 0x0010) ? HIGH : LOW); //green right side
|
||||
|
|
Loading…
Reference in New Issue