///////////////////////////////////////////////////////////////////////////////////// Programmanaam : DCC++ handregelaar// Versie : 2.6// Datum versie : 20 - 04 - 2020// Autheur : Ronald Hofmeester// Auteursrecht (c): licentievrije, vrij te gebruiken///////////////////////////////////////////////////////////////////////////////////// Configuratie locomotieven.// Pas het aantal aan.// Toevoegen of verwijderen in LocAD, Rijrichting en Snelheid en SnelheidDCC.// RegelaarRijStappen instelbaar tussen 0 tot max 255. default = 50.const int Aantal = 5; // max 16const int LocAD[Aantal] = {343, 351, 352, 1315, 2218};byte Rijrichting[Aantal] = { 1, 1, 1, 1, 1};int Snelheid[Aantal] = {0, 0, 0, 0, 0};int SnelheidDCC[Aantal] = {0, 0, 0, 0, 0};byte RegelaarRijStappen = 50;// Library#include <Wire.h>#include <LiquidCrystal_I2C.h>#include <EEPROM.h>// Rotaryswitchconst int IO_pinCLK = 2;const int IO_pinDT = 3;int LaatsteStand = 0; // Laatste stand rotary switchvolatile int RotaryStand1 = 0;volatile int RotaryStand2 = 0;volatile int RotaryStand3 = 0;// Drukknopenconst int AantalInputs = 7;const int IO_pin[AantalInputs] = {4, 5, 6, 7, 8, 9, 10};int InputStatus[AantalInputs];int LaatsteInputStatus[AantalInputs] = {LOW, LOW, LOW, LOW, LOW, LOW, LOW};bool InputVlag[AantalInputs] = {LOW, LOW, LOW, LOW, LOW, LOW, LOW};int InputTeller[AantalInputs];long LaatsteDebounceTijd[AantalInputs] = {0, 0, 0, 0, 0, 0, 0};long DebounceVertraging = 50;// Overige variabelenbool Aan = 0, Functie = 0, MultiTractie = 0, Knop1 = 0, Knop2 = 0;bool SetAllToZero = 0, SetStart = 0;byte Reset1 = 0, Reset2 = 0;int Rijstappen;int KeuzeFunctie;int KeuzeMultiTractie;byte Parameter[Aantal];byte ActieveLoc, LezenActieveLoc, TempActieveLoc;byte FN0to4[Aantal];byte FN5to8[Aantal];byte FN9to12[Aantal];byte FN13to20[Aantal];byte FN21to28[Aantal];const byte AantalGeheugenPlaatsen = 9;byte Geheugen[AantalGeheugenPlaatsen] = {1, 0, 0, 0, 0, 0, 0, 0, 0};bool Bezet1 = 0, Bezet2 = 0, Bezet3 = 0, Bezet4 = 0;bool Lock = 0, LockMT = 0;bool SetOpslaan = 0;LiquidCrystal_I2C lcd(0x27, 16, 2);void isr () { static unsigned long lastInterruptTime = 0; unsigned long interruptTime = millis(); if (interruptTime - lastInterruptTime > 5) { // 5, if (digitalRead(IO_pinCLK) == LOW) { RotaryStand1-- ; RotaryStand2-- ; RotaryStand3-- ; } else { RotaryStand1++ ; RotaryStand2++ ; RotaryStand3++ ; } } RotaryStand1 = min(RegelaarRijStappen, max(0, RotaryStand1)); // Rijstappen RotaryStand2 = min(28, max(0, RotaryStand2)); // Functie RotaryStand3 = min(4, max(0, RotaryStand3)); // MultiTractie lastInterruptTime = interruptTime; if (Lock == 1) { // Let op lock door multitractie Slave 1 en of 2 RotaryStand1 = 0; }}void setup() { Serial.begin(115200); Serial.print("<0>"); Serial.println(); for (int i = 0; i < AantalInputs; i++) { pinMode(IO_pin[i], INPUT); digitalWrite(IO_pin[i], HIGH); } pinMode (IO_pinCLK, INPUT); pinMode (IO_pinDT, INPUT); for (int i = 0; i < AantalGeheugenPlaatsen; i++) { Geheugen[i] = EEPROM.read(i); } for (int i = 0; i < Aantal; i++) { int A = ((i + 1) * 10); Parameter[i] = EEPROM.read(0 + A); Rijrichting[i] = EEPROM.read(1 + A); FN0to4[i] = EEPROM.read(2 + A); FN5to8[i] = EEPROM.read(3 + A); FN9to12[i] = EEPROM.read(4 + A); FN13to20[i] = EEPROM.read(5 + A); FN21to28[i] = EEPROM.read(6 + A); } lcd.begin(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print(" DCC++ "); lcd.setCursor(0, 1); lcd.print(" Rijregelaar "); delay(2200); lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Versie "); lcd.setCursor(0, 1); lcd.print(" 2.6 "); delay(1500); lcd.clear(); attachInterrupt(digitalPinToInterrupt(IO_pinDT), isr, LOW);}void loop() { SetInputVlag(); ResultaatInputVlag(); if (Aan == 0) { Main(); Zero(); } else if (Aan == 1) { Serial.print("<1>"); Serial.println(); if (Functie == 1) { RotaryStand1 = Rijstappen; KeuzeFunctie = RotaryStand2; SetFunctie(); } if (MultiTractie == 1) { RotaryStand1 = Rijstappen; KeuzeMultiTractie = RotaryStand3; Parameter[ActieveLoc] = KeuzeMultiTractie; Reset2 = 0; SetMultiTractie(); } if (Functie == 0 && MultiTractie == 0) { if (Reset2 <= 20) { Reset2++ ; } Rijstappen = RotaryStand1; RotaryStand2 = KeuzeFunctie; RotaryStand3 = Parameter[ActieveLoc]; Rijden(); } } // Geheugen Multitrctie if (Geheugen[1] - 1 == ActieveLoc) { Bezet1 = 1; if (Parameter[ActieveLoc] != 1) { Bezet1 = 0; } } if (Geheugen[2] - 1 == ActieveLoc) { Bezet2 = 1; if (Parameter[ActieveLoc] != 2) { Bezet2 = 0; } } if (Geheugen[3] - 1 == ActieveLoc) { Bezet3 = 1; if (Parameter[ActieveLoc] != 3) { Bezet3 = 0; } } if (Geheugen[4] - 1 == ActieveLoc) { Bezet4 = 1; if (Parameter[ActieveLoc] != 4) { Bezet4 = 0; } }}void Zero() { // zet alle locomotieven snelheid op nul. if (SetStart == 0) { SetAllToZero = 1; } if (SetAllToZero == 1) { Reset1++; for (int i = 0; i < Aantal; i++) { Serial.print("<1> <t1 "); Serial.print(LocAD[i] ); Serial.print(" "); Serial.print("0"); Serial.print(" "); Serial.print(Rijrichting[i] ); Serial.write(" >"); Serial.println(); Snelheid[i] = 0; } if (Reset1 >= 10) { SetAllToZero = 0; SetStart = 1; Serial.print("<0>"); Serial.println(); } }}void SetInputVlag() { for (int i = 0; i < AantalInputs; i++) { int Lezen = digitalRead(IO_pin[i]); if (Lezen != LaatsteInputStatus[i]) { LaatsteDebounceTijd[i] = millis(); } if ((millis() - LaatsteDebounceTijd[i]) > DebounceVertraging) { if (Lezen != InputStatus[i]) { InputStatus[i] = Lezen; Knop1 = !InputStatus[5]; Knop2 = !InputStatus[6]; if (InputStatus[i] == HIGH) { InputVlag[i] = HIGH; } } } LaatsteInputStatus[i] = Lezen; }}void ResultaatInputVlag() { for (int i = 0; i < AantalInputs; i++) { if (InputVlag[i] == HIGH) { InputTeller[i]++; Statusdrukknop(i); InputVlag[i] = LOW; } }}void Statusdrukknop(int input) { if (input == 0 && RotaryStand1 == 0 && SetStart == 1) { // Aan. if (Aan == 0) { Aan = 1; } else { Aan = 0; RotaryStand1 = 0; } } else if (input == 0 && Aan == 1) { // Uit. Aan = 0; RotaryStand1 = 0; Functie = 0; MultiTractie = 0; } else if (input == 4 && Rijstappen > 0 && Aan == 1 && Functie == 0 && MultiTractie == 0) { // Noodstop. Aan = 0; RotaryStand1 = 0; Reset1 = 0; SetStart = 0; Zero(); } else if (input == 1 && Aan == 1 && Functie == 0 && MultiTractie == 0) { // Keuze locomotief if (Geheugen[0] == Aantal) { Geheugen[0] = 1; } else { Geheugen[0]++; } } else if (input == 2 && Aan == 1 && MultiTractie == 0) { // Doe functie if (Functie == 0) { Functie = 1; } else { Functie = 0; } } else if (((input == 3 && MultiTractie == 0) || (Knop2 == 1 && MultiTractie == 1)) && Aan == 1 && Rijstappen == 0 && Functie == 0) { // Doe Multitractie if (MultiTractie == 0) { MultiTractie = 1; } else { MultiTractie = 0; } }}void SetFunctie() { if (KeuzeFunctie <= 4) { if (bitRead(FN0to4[ActieveLoc], KeuzeFunctie) == 0 ) { if (Knop1 == 1) { bitWrite(FN0to4[ActieveLoc], KeuzeFunctie, 1); } } else if (bitRead(FN0to4[ActieveLoc], KeuzeFunctie) == 1 ) { if (Knop2 == 1) { bitWrite(FN0to4[ActieveLoc], KeuzeFunctie, 0); } } } else if (KeuzeFunctie >= 5 && KeuzeFunctie <= 8) { if (bitRead(FN5to8[ActieveLoc], KeuzeFunctie - 5) == 0 ) { if (Knop1 == 1) { bitWrite(FN5to8[ActieveLoc], KeuzeFunctie - 5, 1); } } else if (bitRead(FN5to8[ActieveLoc], KeuzeFunctie - 5) == 1 ) { if (Knop2 == 1) { bitWrite(FN5to8[ActieveLoc], KeuzeFunctie - 5, 0); } } } else if (KeuzeFunctie >= 9 && KeuzeFunctie <= 12) { if (bitRead(FN9to12[ActieveLoc], KeuzeFunctie - 9) == 0 ) { if (Knop1 == 1) { bitWrite(FN9to12[ActieveLoc], KeuzeFunctie - 9, 1); } } else if (bitRead(FN9to12[ActieveLoc], KeuzeFunctie - 9) == 1 ) { if (Knop2 == 1) { bitWrite(FN9to12[ActieveLoc], KeuzeFunctie - 9, 0); } } } else if (KeuzeFunctie >= 13 && KeuzeFunctie <= 20) { if (bitRead(FN13to20[ActieveLoc], KeuzeFunctie - 13) == 0 ) { if (Knop1 == 1) { bitWrite(FN13to20[ActieveLoc], KeuzeFunctie - 13, 1); } } else if (bitRead(FN13to20[ActieveLoc], KeuzeFunctie - 13) == 1 ) { if (Knop2 == 1) { bitWrite(FN13to20[ActieveLoc], KeuzeFunctie - 13, 0); } } } else if (KeuzeFunctie >= 21 && KeuzeFunctie <= 28) { if (bitRead(FN21to28[ActieveLoc], KeuzeFunctie - 21) == 0 ) { if (Knop1 == 1) { bitWrite(FN21to28[ActieveLoc], KeuzeFunctie - 21, 1); } } else if (bitRead(FN21to28[ActieveLoc], KeuzeFunctie - 21) == 1 ) { if (Knop2 == 1) { bitWrite(FN21to28[ActieveLoc], KeuzeFunctie - 21, 0); } } } lcd.setCursor(0, 0); lcd.print("Set Functie "); lcd.setCursor(0, 1); lcd.print("#"); lcd.print(ActieveLoc + 1, DEC); lcd.print(" "); lcd.setCursor(4, 1); lcd.print("F="); if (KeuzeFunctie >= 0 && KeuzeFunctie <= 3) { lcd.print(KeuzeFunctie + 1, DEC); lcd.print(" "); lcd.setCursor(9, 1); if (bitRead(FN0to4[ActieveLoc], KeuzeFunctie) == 0) { lcd.print("UIT"); } else if (bitRead(FN0to4[ActieveLoc], KeuzeFunctie) == 1) { lcd.print("AAN"); } } else if (KeuzeFunctie == 4) { lcd.print(0, DEC); lcd.print(" "); lcd.setCursor(9, 1); if (bitRead(FN0to4[ActieveLoc], KeuzeFunctie) == 0) { lcd.print("UIT"); } else if (bitRead(FN0to4[ActieveLoc], KeuzeFunctie) == 1) { lcd.print("AAN"); } } else if (KeuzeFunctie >= 5 && KeuzeFunctie <= 8) { lcd.print(KeuzeFunctie, DEC); lcd.print(" "); lcd.setCursor(9, 1); if (bitRead(FN5to8[ActieveLoc], KeuzeFunctie - 5) == 0) { lcd.print("UIT"); } else if (bitRead(FN5to8[ActieveLoc], KeuzeFunctie - 5) == 1) { lcd.print("AAN"); } } else if (KeuzeFunctie >= 9 && KeuzeFunctie <= 12) { lcd.print(KeuzeFunctie, DEC); lcd.print(" "); lcd.setCursor(9, 1); if (bitRead(FN9to12[ActieveLoc], KeuzeFunctie - 9) == 0) { lcd.print("UIT"); } else if (bitRead(FN9to12[ActieveLoc], KeuzeFunctie - 9) == 1) { lcd.print("AAN"); } } else if (KeuzeFunctie >= 13 && KeuzeFunctie <= 20) { lcd.print(KeuzeFunctie, DEC); lcd.print(" "); lcd.setCursor(9, 1); if (bitRead(FN13to20[ActieveLoc], KeuzeFunctie - 13) == 0) { lcd.print("UIT"); } else if (bitRead(FN13to20[ActieveLoc], KeuzeFunctie - 13) == 1) { lcd.print("AAN"); } } else if (KeuzeFunctie >= 21 && KeuzeFunctie <= 28) { lcd.print(KeuzeFunctie, DEC); lcd.print(" "); lcd.setCursor(9, 1); if (bitRead(FN21to28[ActieveLoc], KeuzeFunctie - 21) == 0) { lcd.print("UIT"); } else if (bitRead(FN21to28[ActieveLoc], KeuzeFunctie - 21) == 1) { lcd.print("AAN"); } } if (KeuzeFunctie >= 0 && KeuzeFunctie <= 4) { Serial.print("<f "); Serial.print(LocAD[ActieveLoc] ); Serial.print(" "); int fx = FN0to4[ActieveLoc] + 128; Serial.print(fx); Serial.write(" >"); Serial.println(); } if (KeuzeFunctie >= 5 && KeuzeFunctie <= 8) { Serial.print("<f "); Serial.print(LocAD[ActieveLoc] ); Serial.print(" "); int fx = FN5to8[ActieveLoc] + 176; Serial.print(fx); Serial.write(" >"); Serial.println(); } if (KeuzeFunctie >= 9 && KeuzeFunctie <= 12) { Serial.print("<f "); Serial.print(LocAD[ActieveLoc] ); Serial.print(" "); int fx = FN9to12[ActieveLoc] + 160; Serial.print(fx); Serial.write(" >"); Serial.println(); } if (KeuzeFunctie >= 13 && KeuzeFunctie <= 20) { Serial.print("<f "); Serial.print(LocAD[ActieveLoc] ); Serial.print(" "); Serial.print("222"); Serial.print(" "); int fx = FN13to20[ActieveLoc]; Serial.print(fx); Serial.write(" >"); Serial.println(); } if (KeuzeFunctie >= 21 && KeuzeFunctie <= 28) { Serial.print("<f "); Serial.print(LocAD[ActieveLoc] ); Serial.print(" "); Serial.print("223"); Serial.print(" "); int fx = FN21to28[ActieveLoc]; Serial.print(fx); Serial.write(" >"); Serial.println(); }}void SetMultiTractie() { if ((KeuzeMultiTractie == 1 && Bezet1 == 1) || (KeuzeMultiTractie == 2 && Bezet2 == 1) || (KeuzeMultiTractie == 3 && Bezet3 == 1) || (KeuzeMultiTractie == 4 && Bezet4 == 1)) { LockMT = 1; } else LockMT = 0; if (Knop2 == 1 && LockMT == 0) { if (Parameter[ActieveLoc] == 1) { Geheugen[1] = ActieveLoc + 1; bitWrite(Geheugen[5], 0, Rijrichting[ActieveLoc]); } else if (Parameter[ActieveLoc] == 2) { Geheugen[2] = ActieveLoc + 1; bitWrite(Geheugen[5], 1, Rijrichting[ActieveLoc]); } else if (Parameter[ActieveLoc] == 3) { Geheugen[3] = ActieveLoc + 1; bitWrite(Geheugen[6], 0, Rijrichting[ActieveLoc]); } else if (Parameter[ActieveLoc] == 4) { Geheugen[4] = ActieveLoc + 1; bitWrite(Geheugen[6], 1, Rijrichting[ActieveLoc]); } if (Geheugen[1] - 1 == ActieveLoc) { if (Parameter[ActieveLoc] != 1) { Geheugen[1] = 0; } } else if (Geheugen[2] - 1 == ActieveLoc) { if (Parameter[ActieveLoc] != 2) { Geheugen[2] = 0; } } else if (Geheugen[3] - 1 == ActieveLoc) { if (Parameter[ActieveLoc] != 3) { Geheugen[3] = 0; } } else if (Geheugen[4] - 1 == ActieveLoc) { if (Parameter[ActieveLoc] != 4) { Geheugen[4] = 0; } } MultiTractie = 0; } lcd.setCursor(0, 0); lcd.print("Set Multitractie"); lcd.setCursor(0, 1); lcd.print("#"); lcd.print(ActieveLoc + 1, DEC); lcd.print(" "); lcd.setCursor(3, 1); lcd.print("="); if (Parameter[ActieveLoc] == 0) { lcd.setCursor(4, 1); lcd.print("Geen "); } else if (Parameter[ActieveLoc] == 1) { lcd.setCursor(4, 1); lcd.print("Master1"); lcd.setCursor(11, 1); if (Bezet1 == 1) { lcd.print("Bezet"); } else lcd.print("Vrij "); } else if (Parameter[ActieveLoc] == 2) { lcd.setCursor(4, 1); lcd.print("Slave1 "); lcd.setCursor(11, 1); if (Bezet2 == 1) { lcd.print("Bezet"); } else lcd.print("Vrij "); } else if (Parameter[ActieveLoc] == 3) { lcd.setCursor(4, 1); lcd.print("Master2"); lcd.setCursor(11, 1); if (Bezet3 == 1) { lcd.print("Bezet"); } else lcd.print("Vrij "); } else if (Parameter[ActieveLoc] == 4) { lcd.setCursor(4, 1); lcd.print("Slave2 "); lcd.setCursor(11, 1); if (Bezet4 == 1) { lcd.print("Bezet"); } else lcd.print("Vrij "); }}
void Rijden() { ActieveLoc = Geheugen[0] - 1; LocAD[ActieveLoc]; if (TempActieveLoc != ActieveLoc) { RotaryStand1 = Snelheid[ActieveLoc]; } TempActieveLoc = ActieveLoc; if (TempActieveLoc == ActieveLoc) { Snelheid[ActieveLoc] = Rijstappen; } SnelheidDCC[ActieveLoc] = map(Snelheid[ActieveLoc], 0, RegelaarRijStappen, 0, 126); if (RotaryStand1 == 0 && Reset2 >= 20) { // Rijrichting if (Rijrichting[ActieveLoc] == 1 && Knop1 == 1) { Rijrichting[ActieveLoc] = 0; } if (Rijrichting[ActieveLoc] == 0 && Knop2 == 1) { Rijrichting[ActieveLoc] = 1; } } if (Geheugen[1] > 0 && Geheugen[2] > 0) { if (Geheugen[5] == 0 || Geheugen[5] == 3) { Geheugen[7] = 1; } else if (Geheugen[5] == 1 || Geheugen[5] == 2) { Geheugen[7] = 0; } } if (Geheugen[3] > 0 && Geheugen[4] > 0) { if (Geheugen[6] == 0 || Geheugen[6] == 3) { Geheugen[8] = 1; } else if (Geheugen[6] == 1 || Geheugen[6] == 2) { Geheugen[8] = 0; } } if ((Geheugen[2] - 1 == ActieveLoc) || (Geheugen[4] - 1 == ActieveLoc)) { Lock = 1; } else Lock = 0; lcd.setCursor(0, 0); // LCD Rijden lcd.print("L="); lcd.print(LocAD[ActieveLoc], DEC); lcd.print(" "); if (MultiTractie == 0) { if (Parameter[ActieveLoc] == 0) { lcd.setCursor(6, 0); lcd.print(" "); } else if (Parameter[ActieveLoc] == 1 && Bezet1 == 1) { lcd.setCursor(6, 0); lcd.print("Master1"); } else if (Parameter[ActieveLoc] == 2 && Bezet2 == 1) { lcd.setCursor(6, 0); lcd.print("Slave1 "); } else if (Parameter[ActieveLoc] == 3 && Bezet3 == 1) { lcd.setCursor(6, 0); lcd.print("Master2"); } else if (Parameter[ActieveLoc] == 4 && Bezet4 == 1) { lcd.setCursor(6, 0); lcd.print("Slave2 "); } } lcd.setCursor(13, 0); lcd.print("#"); lcd.print(ActieveLoc + 1, DEC); lcd.print(" "); lcd.setCursor(0, 1); lcd.print("S="); if (Lock == 0) { lcd.print(Snelheid[ActieveLoc], DEC); lcd.print(" "); } else if (Lock == 1) { lcd.print("Lock"); } if (Rijrichting[ActieveLoc] == 1) { lcd.print(" >>> "); } else lcd.print(" <<< "); Serial.print("<t1 "); Serial.print(LocAD[ActieveLoc]); Serial.print(" "); Serial.print(SnelheidDCC[ActieveLoc]); Serial.print(" "); Serial.print(Rijrichting[ActieveLoc] ); Serial.write(">"); Serial.println(); if (Geheugen[1] > 0 && Geheugen[2] > 0) { if (Geheugen[1] - 1 == ActieveLoc) { Serial.print("<t1 "); Serial.print(LocAD[Geheugen[2] - 1] ); Serial.print(" "); Serial.print(SnelheidDCC[ActieveLoc] ); Serial.print(" "); if (Geheugen[7] == 1) { Serial.print(Rijrichting[ActieveLoc] ); } else if (Geheugen[7] == 0) { Serial.print(!Rijrichting[ActieveLoc] ); } Serial.write(">"); Serial.println(); } } if (Geheugen[3] > 0 && Geheugen[4] > 0) { if (Geheugen[3] - 1 == ActieveLoc) { Serial.print("<t1 "); Serial.print(LocAD[Geheugen[4] - 1] ); Serial.print(" "); Serial.print(SnelheidDCC[ActieveLoc] ); Serial.print(" "); if (Geheugen[8] == 1) { Serial.print(Rijrichting[ActieveLoc] ); } else if (Geheugen[8] == 0) { Serial.print(!Rijrichting[ActieveLoc] ); } Serial.write(">"); Serial.println(); } }}void Main() { if (Knop1 == 1) { SetOpslaan = 1 ; } if (SetOpslaan == 1) { lcd.setCursor(0, 0); lcd.print(" Om op te slaan "); lcd.setCursor(0, 1); lcd.print(" Druk op Enter "); } if (SetOpslaan == 1 && Knop2 == 1) { Opslaan(); } if (SetOpslaan == 0) { lcd.setCursor(0, 0); lcd.print("Stop (Noodstop)"); lcd.setCursor(0, 1); lcd.print(" "); } if (SetStart == 1) { Serial.print("<0>"); Serial.println(); }}void Opslaan() { for (int i = 0; i < AantalGeheugenPlaatsen; i++) { EEPROM.write(i, Geheugen[i]); } for (int i = 0; i < Aantal; i++) { int A = ((i + 1) * 10); EEPROM.write(0 + A, Parameter[i]); EEPROM.write(1 + A, Rijrichting[i]); EEPROM.write(2 + A, FN0to4[i]); EEPROM.write(3 + A, FN5to8[i]); EEPROM.write(4 + A, FN9to12[i]); EEPROM.write(5 + A, FN13to20[i]); EEPROM.write(6 + A, FN21to28[i]); } SetOpslaan = 0;}
Ik kan er bijvoorbeeld geen multitracties meemaken of treinen mee programmeren
verder ben ik bezig met DCC naar I2C, AccDecoderPacket naar twee bytes via i2c bus naar de twee bedienings panelen.
mcpWrite(pin, state);mcpRead(pin);
ik snapte deze zin niet helemaal:Als ik het goed begrijp wil je met arduino DCC signalen voor accessories uitlezen om wissels en dergelijken te schakelen, maar je wilt ook op deze I2C bus een schakelpaneel hebben zodat je ipv DCC signalen een knopje kan gebruiken om ook deze dingen te schakelen. Dat scheelt natuurlijk draadjes trekken.