Magnifique démonstation sur les réglages







C'est prévu !ramasoft a écrit : 21 oct. 2025, 13:39
Pour ne mettre le courant que sur la voie active on peut utiliser des relais, mais là aussi c'est au logiciel de commander ça.
Et comme il y a beaucoup de voies il faudra prévoir un multiplexage.
Donc petite modif à prévoir sur le logiciel de commande
Au boulot Hervé ...![]()



Ohhhh, il n'y avait pas besoin de ça ! ! ! ! !


Avec les pointures de ce forum, sur le sujet, on va apprendre, et c'est très intéressant pour moi.herwat a écrit : 21 oct. 2025, 13:55 Pour les logiciels, j'ignore totalement leur fonctionnement . Il m'est donc impossible d'étudier quoi que ce soit . . . .
Mais je suis ouvert à tout !



Je pourrais m'inspirer de l'article de Patrick (Patlum) sur l'éclairage de voitures .ramasoft a écrit : 21 oct. 2025, 14:02 Il faut que chaque voie ait une adresse.
Avec une bibliothèque genre DCC Decoder l'Arduino écoute le DCC et quand il repère une commande sur une adresse des voies de l'APT il se positionne dessus.
Et quand la position est verrouillée il renvoie un code de confirmation ou mettre une simple temporisation dans le logiciel de commande du réseau.
Il faut voir effectivement comment ce logiciel fonctionne, par exemple quand il doit commander une plaque tournante.





Code : Tout sélectionner
void Coupure() {
Serial.println("ESP2:C0"); delay (100) ;
Serial.println("ESP2:C-1"); delay (100) ;
Serial.println("ESP2:C-2"); delay (100) ;
Serial.println("ESP2:C-3"); delay (100) ;
Serial.println("ESP2:C-4"); delay (100) ;
Serial.println("ESP2:C-5"); delay (100) ;
Serial.println("ESP2:CP"); delay (100) ;
Serial.println("ESP2:CR"); delay (100) ;
Serial.println("ESP3:C0"); delay (100) ;
Serial.println("ESP3:C-1"); delay (100) ;
Serial.println("ESP3:C-2"); delay (100) ;
Serial.println("ESP3:C-3"); delay (100) ;
Serial.println("ESP3:C-4"); delay (100) ;
Serial.println("ESP3:C-5"); delay (100) ;
Serial.println("ESP3:CP"); delay (100) ;
Serial.println("ESP3:CR"); delay (100) ;
}Code : Tout sélectionner
if (msg == "0") { Aller = Pos0SS; Position = 0; Deplacement(); Serial.println("ESP2:0"); delay(100) ; Serial.println("ESP3:0"); } // Action si choix RC
else if (msg == "-1") { Aller = Pos1SS; Position = -1; Deplacement(); Serial.println("ESP2:-1"); delay(100) ; } // Action si choix -1
else if (msg == "-2") { Aller = Pos2SS; Position = -2; Deplacement(); Serial.println("ESP2:-2"); delay(100) ; } // Action si choix -2
else if (msg == "-3") { Aller = Pos3SS; Position = -3; Deplacement(); Serial.println("ESP2:-3"); delay(100) ; } // Action si choix -3
else if (msg == "-4") { Aller = Pos4SS; Position = -4; Deplacement(); Serial.println("ESP2:-4"); delay(100) ; } // Action si choix -4
else if (msg == "-5") { Aller = Pos5SS; Position = -5; Deplacement(); Serial.println("ESP2:-5"); delay(100) ; } // Action si choix -5
else if (msg == "-6") { Aller = Pos6SS; Position = -6; Deplacement(); Serial.println("ESP3:-1"); delay(100) ; } // Action si choix -1
else if (msg == "-7") { Aller = Pos7SS; Position = -7; Deplacement(); Serial.println("ESP3:-2"); delay(100) ; } // Action si choix -2
else if (msg == "-8") { Aller = Pos8SS; Position = -8; Deplacement(); Serial.println("ESP3:-3"); delay(100) ; } // Action si choix -3
else if (msg == "-9") { Aller = Pos9SS; Position = -9; Deplacement(); Serial.println("ESP3:-4"); delay(100) ; } // Action si choix -4
else if (msg == "-10") { Aller = Pos10SS; Position = -10; Deplacement(); Serial.println("ESP3:-5"); delay(100) ; } // Action si choix -5
// else if (msg == "P") { Serial.println("ESP2:P"); } // Utilisation non encre défini
Code : Tout sélectionner
if (Serial.available()) {
String cmd = Serial.readStringUntil('\n');
cmd.trim();
if (cmd.indexOf("ESP2:") == 0) { // renvois ordre vers la carte relais ESP2
String sub = cmd.substring(5);
esp_now_send(macESP2, (uint8_t*)sub.c_str(), sub.length() + 1);
}
else if (cmd.indexOf("ESP3:") == 0) { // renvois ordre vers la carte relais ESP2
String sub = cmd.substring(5);
esp_now_send(macESP3, (uint8_t*)sub.c_str(), sub.length() + 1);
}
}
Code : Tout sélectionner
oid OnDataRecv(const esp_now_recv_info * info, const uint8_t *incomingData, int len) {
String msg = String((char*)incomingData);
msg.trim();
if (msg == "0") { activerRelais(PIN_0); }
if (msg == "-1") { activerRelais(PIN_M1); }
if (msg == "-2") { activerRelais(PIN_M2); }
if (msg == "-3") { activerRelais(PIN_M3); }
if (msg == "-4") { activerRelais(PIN_M4); }
if (msg == "-5") { activerRelais(PIN_M5); }
if (msg == "P") { activerRelais(PIN_P); }
if (msg == "R") { activerRelais(PIN_R); }
if (msg == "C0") { desactiverRelais(PIN_0); }
if (msg == "C-1") { desactiverRelais(PIN_M1); }
if (msg == "C-2") { desactiverRelais(PIN_M2); }
if (msg == "C-3") { desactiverRelais(PIN_M3); }
if (msg == "C-4") { desactiverRelais(PIN_M4); }
if (msg == "C-5") { desactiverRelais(PIN_M5); }
if (msg == "CP") { desactiverRelais(PIN_P); }
if (msg == "CR") { desactiverRelais(PIN_R); }
}






Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité