Hallo an alle,
Ich baue für meine Modellbahn eine eigene Zug- und Signalsteuerung, allerdings bekomme nun seit einger Zeit bei Kompilieren den Fehler "exit status 1".
Habe schon Arduino und die NeoPixel Bibliothek mehrfach neuinstalliert, ältere Versionen haben die Situation auch nicht gelöst. Boardwechsel bringt auch nichts.
Der Code:
int Sig, //Signalstellung
blk_out, //Blinker Output
ct, //Zähler Blinker
i; //Zähler
int spd, //Geschwindigkeit Ausgang
spdset, //Geschwindigkeit setzen
dir, // -2=volle zurück; -1=halbe zurück; 0=halt; 1=halbe vorwärts; 2=volle vorwärts
dirset, //Rischtung setzen
#include <Adafruit_NeoPixel.h>
#define LED_PIN 2
#define LED_COUNT 4
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, NEO_RGB + NEO_KHZ800);
int hs0, hs1, hs2, hs3, hs4, hs5, hs6; //Hauptsignalstellung
int vs0, vs1; //Vorsignalstellung
int ohs0, ohs1, ohs2, ohs3, ohs4, ohs5, ohs6; //Hauptsignalausgang
int ovs0, ovs1; //Vorsignalausgang
int rnd; //int für random
int min1, min2, min3, min4, min5, min6; //manuelle steuerung inputs
void setup() {
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(A0, INPUT_PULLUP);
pinMode(A1, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A4, INPUT_PULLUP);
pinMode(A5, INPUT_PULLUP);
pinMode(A6, INPUT_PULLUP);
pinMode(A7, INPUT_PULLUP);
hs0=0;hs1=0;hs2=0;hs3=0;hs4=0;hs5=0;hs6=0; //alle lampen auf 0 setzen
randomSeed(analogRead(A0));
rnd = random(0, 100); //random für ersatz- o. Hauptrot
Serial.begin(9600); //Serielle übertragung starten
strip.begin(); // (REQUIRED)
strip.show();
strip.setBrightness(20);
Serial.println(rnd);
Sig = 13; //alles in Grundstellung bringen
dirset = 0;
spdset = 0;
}
void loop() {
Signal();
Gleis();
Serial.println(i);
}
void Signal() {
//LED Helligkeit
const int ge = 100;
const int gr = 50;
const int rt = 155;
const int ws = 40;
switch (Sig) { //Signalstände
case 0:
hs0 = 0;
hs1 = 0;
hs2 = 0;
hs3 = 0;
hs4 = ws;
hs5 = 0;
hs6 = 0;
vs0 = 0;
vs1 = 0;
break;
case 1:
hs0 = 0;
hs1 = gr;
hs2 = 0;
hs3 = 0;
hs4 = 0;
hs5 = 0;
hs6 = 0;
vs0 = 0;
vs1 = gr;
break;
case 3:
hs0 = 0;
hs1 = gr;
hs2 = 0;
hs3 = 0;
hs4 = 0;
hs5 = ge;
hs6 = 0;
if(blk_out<ge){vs0=blk_out;}else{vs0=ge;}
vs1 = 0;
break;
case 7:
if(blk_out<ge){hs0=blk_out;}else{hs0=ge;}
hs1 = 0;
hs2 = 0;
hs3 = 0;
hs4 = 0;
hs5 = 0;
hs6 = 0;
vs0 = 0;
vs1 = gr;
break;
case 9:
if(blk_out<ge){hs0=blk_out;}else{hs0=ge;}
hs1 = 0;
hs2 = 0;
hs3 = 0;
hs4 = 0;
hs5 = ge;
hs6 = 0;
if(blk_out<ge){vs0=blk_out;}else{vs0=ge;}
vs1 = 0;
break;
case 10:
hs0 = ge;
hs1 = 0;
hs2 = 0;
hs3 = 0;
hs4 = 0;
hs5 = 0;
hs6 = 0;
vs0 = 0;
vs1 = gr;
break;
case 12:
hs0 = ge;
hs1 = 0;
hs2 = 0;
hs3 = 0;
hs4 = 0;
hs5 = ge;
hs6 = 0;
if(blk_out<ge){vs0=blk_out;}else{vs0=ge;}
vs1 = 0;
break;
case 13:
hs0 = 0;
hs1 = 0;
hs2 = 0;
if(rnd<90) {hs3=rt; hs6=0;}
hs4 = 0;
hs5 = 0;
if(rnd>89) {hs6=rt; hs3=0;}
vs0 = ge;
vs1 = 0;
break;
case 14:
hs0 = 0;
hs1 = 0;
hs2 = 0;
if(rnd<90) {hs3=rt; hs6=0;}
if(blk_out<ws){hs4=blk_out;}else{hs4=ws;}
hs5 = 0;
if(rnd>89) {hs6=rt; hs3=0;}
vs0 = ge;
vs1 = 0;
break;
case 15:
hs0 = 0;
hs1 = 0;
hs2 = ws;
if(rnd<90) {hs3=rt; hs6=0;}
hs4 = ws;
hs5 = 0;
if(rnd>89) {hs6=rt; hs3=0;}
vs0 = ws;
vs1 = 0;
break;
case 16:
hs0 = ge;
hs1 = gr;
hs2 = ws;
hs3 = rt;
if(blk_out<ws){hs4=blk_out;}else{hs4=ws;}
hs5 = ge;
hs6 = blk_out;
vs0 = ge;
vs1 = gr;
break;
}
if (ohs0 < hs0) {ohs0=ohs0+3;} //langsam angleichen
if (ohs0 > hs0) {ohs0=ohs0-3;}
if (ohs1 < hs1) {ohs1=ohs1+3;}
if (ohs1 > hs1) {ohs1=ohs1-3;}
if (ohs2 < hs2) {ohs2=ohs2+3;}
if (ohs2 > hs2) {ohs2=ohs2-3;}
if (ohs3 < hs3) {ohs3=ohs3+3;}
if (ohs3 > hs3) {ohs3=ohs3-3;}
if (ohs4 < hs4) {ohs4=ohs4+3;}
if (ohs4 > hs4) {ohs4=ohs4-3;}
if (ohs5 < hs5) {ohs5=ohs5+3;}
if (ohs5 > hs5) {ohs5=ohs5-3;}
if (ohs6 < hs6) {ohs6=ohs6+3;}
if (ohs6 > hs6) {ohs6=ohs6-3;}
if (ovs0 < vs0) {ovs0=ovs0+3;}
if (ovs0 > vs0) {ovs0=ovs0-3;}
if (ovs1 < vs1) {ovs1=ovs1+3;}
if (ovs1 > vs1) {ovs1=ovs1-3;}
strip.setPixelColor(0, strip.Color(ohs0, ohs1, ohs2)); //Output
strip.setPixelColor(1, strip.Color(ohs3, ohs4, ohs5));
strip.setPixelColor(2, strip.Color(ohs6, 0, 0));
strip.setPixelColor(3, strip.Color(ovs0, ovs1, 0));
strip.show();
blk();
}
void blk() {
ct++;
if(ct==125) {blk_out=250;}
if(ct==250) {blk_out=0; ct=0;}
//delay(2);
}
void Gleis() {
i++;
if (i=50) {
switch (dirset) {
case -2:
switch (dir) {
case -1:
if (spdset == 150 && spd == 150) {spdset = 250;dir = -2;}
break;
case 0:
if (spdset == 0 && spd == 0) {spdset = 150;dir = -1;}
break;
case 1:
if (spdset == 150 && spd == 150) {spdset = 0;dir = 0;}
break;
case 2:
if (spdset == 250 && spd == 250) {spdset = 0;dir = 0;}
break;
}
break;
case -1:
switch (dir) {
case -2:
if (spdset == 250 && spd == 250) {spdset = 150;dir = -1;}
break;
case 0:
if (spdset == 0 && spd == 0) {spdset = 150;dir = -1;}
break;
case 1:
if (spdset == 150 && spd == 150) {spdset = 0;dir = 0;}
break;
case 2:
if (spdset == 250 && spd == 250) {spdset = 0;dir = 0;}
break;
}
break;
case 0:
switch (dir) {
case -2:
if (spdset == 250 && spd == 250) {spdset = 0;dir = 0;}
break;
case -1:
if (spdset == 150 && spd == 150) {spdset = 0;dir = 0;}
break;
case 1:
if (spdset == 150 && spd == 150) {spdset = 0;dir = 0;}
break;
case 2:
if (spdset == 250 && spd == 250) {spdset = 0;dir = 0;}
break;
}
break;
case 1:
switch (dir) {
case -2:
if (spdset == 250 && spd == 250) {spdset = 0;dir = 0;}
break;
case -1:
if (spdset == 150 && spd == 150) {spdset = 0;dir = 0;}
break;
case 0:
if (spdset == 0 && spd == 0) {spdset = 150;dir = 1;}
break;
case 2:
if (spdset == 250 && spd == 250) {spdset = 150;dir = 1;}
break;
}
break;
case 2:
switch (dir) {
case -2:
if (spdset == 250 && spd == 250) {spdset = 0;dir = 0;}
break;
case -1:
if (spdset == 150 && spd == 150) {spdset = 0;dir = 0;}
break;
case 0:
if (spdset == 0 && spd == 0) {spdset = 150;dir = 1;}
break;
case 1:
if (spdset == 150 && spd == 150) {spdset = 250;dir = 2;}
break;
}
break;
}
if (spd < spdset) {spd = spd+1;} //Geschwindigkeit anpassen
if (spd > spdset) {spd = spd-1;}
analogWrite(3, spd); //Geschwindigkeit ausgeben
if (dir > 0) {digitalWrite(4, HIGH);} //Richtung ändern
if (dir < 0) {digitalWrite(4, LOW);}
i=0;
}
}
Und dazu die Fehlermeldung:
In file included from D:\OneDrive\Dokumente\Arduino\codes\block_neu\block_neu.ino:12:0:
D:\OneDrive\Dokumente\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:135:1: error: expected unqualified-id before 'typedef'
typedef uint16_t neoPixelType; ///< 3rd arg to Adafruit_NeoPixel constructor
^~~~~~~
D:\OneDrive\Dokumente\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:205:5: error: 'neoPixelType' has not been declared
neoPixelType type=NEO_GRB + NEO_KHZ800);
^~~~~~~~~~~~
D:\OneDrive\Dokumente\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:220:32: error: 'neoPixelType' has not been declared
void updateType(neoPixelType t);
^~~~~~~~~~~~
Bibliothek Adafruit_NeoPixel in Version 1.8.0 im Ordner: D:\OneDrive\Dokumente\Arduino\libraries\Adafruit_NeoPixel wird verwendet
exit status 1
Fehler beim Kompilieren für das Board Arduino Nano.
Würde mich sehr freuen wenn mir jemand bei der Sache helfen könne.