Voir les contributions

Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.


Sujets - frederic

Pages: [1]
1
Aide / Un gestionnaire en C++ pour votre réseau (1)
« le: février 23, 2024, 02:52:12 pm »
Bonjour,

J' essaie de faire un TCO en utilisant les articles "processing" et "Un gestionnaire en C++ pour votre réseau " qui sont super bien expliqué, je ne trouve pas comment créer ou déclarer une "zone" j' aimerais exemple :

z0 3 pavés  (zone de roulement)
z1 un pavé "signal"(zone d' arrêt)
ainsi de suite
se qui me ferais un "canton"

amicalement
frederic

2
Vos projets / TCO bp + ordi
« le: février 10, 2024, 06:00:21 pm »
bonjour,
Je suis en train de construire un TCO physique (écran, bouton poussoir, horloge)qui viendra en complément de la gestion complète par ordinateur et Arduino
actuellement le programme joint fonctionne,  mais quand j' active la communication (en gris ou /**/), entre ordi et Arduino (USB) plus aucun bouton fonctionne mais les ordres donné depuis l' ordi fonctionne, je voudrais les 2 lol
 pouvez vous m' aider SVP.

#include <PCA9685.h> //platine servomoteur
PCA9685 pwmController;
PCA9685_ServoEval pwmAngleValue;



#include <LiquidCrystal_I2C.h> // ecran LCD 20x4
LiquidCrystal_I2C lcd(0x27, 20, 4);

#include <virtuabotixRTC.h> //module horloge
virtuabotixRTC myRTC(6, 7, 8);



// vitesse servomoteur
int Attente = 25; // vitesse servomoteur

// position aiguillage
int AIG1 = 0;     // position aiguillage
int AIG2M1 = 0;
int AIG2M2 = 0;
int AIG3 = 0;
int AIG4 = 0;
int AIG5 = 0;
int AIG6 = 0;
int AIG7 = 0;

// variable anti retour
int etat0 = 0;   // variable anti retour
int etat1 = 0;
int etat2 = 0;
int etat3 = 0;
int etat4 = 0;
int etat5 = 0;
int etat6 = 0;
int etat7 = 0;

// Déclaration des entrées pour les boutons poussoir
const int BvoieA = 27;
const int BvoieB = 26;
const int BvoieC = 25;
const int BvoieD = 24;
const int BvoieE = 28;
const int Bentrernord = 22;
const int Bsortienord = 23;
const int Bentrersud = 30;
const int Bsortiesud = 29;

// Variable de stockage de l'instruction reçu
String reception = "";

void setup()  {
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();

// Etat des entrées pour les boutons poussoir

pinMode(BvoieA, INPUT);
pinMode(BvoieB, INPUT);
pinMode(BvoieC, INPUT);
pinMode(BvoieD, INPUT);
pinMode(BvoieE, INPUT);
pinMode(Bentrernord, INPUT);
pinMode(Bsortienord, INPUT);
pinMode(Bentrersud, INPUT);
pinMode(Bsortiesud,INPUT);
 
  //myRTC.setDS1302Time(18, 39, 15, 7, 25, 12, 2023);// activé pour régler l' horloge
     Wire.begin(); // Initialisation de l'interface I2C
    // Ré-initialisation des PCA9685 sur la ligne I2C
    pwmController.resetDevices();   
    pwmController.init(); // Initilisation du module
    // Définit une fréquence f=5OHz soit T=20ms
    // pour les Servomoteurs standard             
    pwmController.setPWMFreqServo();
   
}
void loop()  {
  // identificatition des éléments
  myRTC.updateTime();
 
  Serial.print("Current Date / Time: ");
  Serial.print(myRTC.dayofmonth);
  Serial.print("/");
  Serial.print(myRTC.month);
  Serial.print("/");
  Serial.print(myRTC.year);
  Serial.print("  ");
  Serial.print(myRTC.hours);
  Serial.print(":");
  Serial.print(myRTC.minutes);
  Serial.print(":");
  Serial.println(myRTC.seconds);
 
// organisation écran LCD

  lcd.setCursor(0, 0);
  lcd.print("**BLAUSEE--MITHOLZ**");
  lcd.setCursor(0, 1);
  lcd.print(myRTC.hours);
  lcd.print(":");
  lcd.print(myRTC.minutes);
  lcd.print("     ");
  lcd.print(myRTC.dayofmonth);
  lcd.print("/");
  lcd.print(myRTC.month);
  lcd.print("/");
  lcd.print(myRTC.year);

  // Attente des instructions du uno
 
  /*while(true){
    if (Serial.available()){
      //reception = Serial.readStringUntil('\n');
      //break;// Sortie de la boucle
    }
  }
 
*/
// "1"  aiguillage en position droite
// "2"  aiguillage en position dévier

//ordre donnée par bouton poussoir

 if(digitalRead(Bentrernord) == HIGH)  {if(digitalRead(BvoieB) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Nord sur voie B");
    AIG2M1 = 1;
    AIG2M2 = 2;
    }
 }

  if(digitalRead(Bentrernord) == HIGH)  {if(digitalRead(BvoieC) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Nord sur voie C");
    AIG2M1 = 1;
    AIG2M2 = 1;
    AIG3 = 1;
    }
 }

  if(digitalRead(Bentrernord) == HIGH)  {if(digitalRead(BvoieD) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Nord sur voie D");
    AIG2M1 = 1;
    AIG2M2 = 1;
    AIG3 = 2;
    }
 }
 
  if(digitalRead(Bsortienord) == HIGH)  {if(digitalRead(BvoieB) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie B sur Nord");
    AIG2M1 = 1;
    AIG2M2 = 2;
    AIG1 = 2;
    }
 }

 if(digitalRead(Bsortienord) == HIGH)  {if(digitalRead(BvoieC) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie C sur Nord");
    AIG2M1 = 1;
    AIG2M2 = 2;
    AIG1 = 2;
    }
 }

 if(digitalRead(Bsortienord) == HIGH)  {if(digitalRead(BvoieD) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie D sur Nord");
    AIG2M1 = 1;
    AIG2M2 = 2;
    AIG1 = 2;
    }
 }

 if(digitalRead(Bsortienord) == HIGH)  {if(digitalRead(BvoieA) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie A sur Nord");
    AIG1 = 1;
    }
 }
 
  if(digitalRead(BvoieD) == HIGH)  {if(digitalRead(BvoieE) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie D sur Voie E");
    AIG4 = 2;
    AIG5 = 2;
    }
 }

 if(digitalRead(BvoieC) == HIGH)  {if(digitalRead(BvoieE) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie C sur Voie E");
    AIG4 = 1;
    AIG5 = 2;
    }
 }

 if(digitalRead(BvoieB) == HIGH)  {if(digitalRead(BvoieE) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie B sur Voie E");
    AIG5 = 1;
    }
 }

if(digitalRead(BvoieE) == HIGH)  {if(digitalRead(Bentrersud) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("sud sur Voie E     ");
    AIG6 = 2;
    AIG7 = 2;
    }
 }

if(digitalRead(BvoieE) == HIGH)  {if(digitalRead(Bsortiesud) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie E sortie Sud");
    AIG6 = 1;
   
    }
 }

if(digitalRead(BvoieA) == HIGH)  {if(digitalRead(Bentrersud) == HIGH)
   {
    lcd.setCursor(0, 2);
    lcd.print("Voie A sortie Sud");
    AIG7 = 1;
   
    }
 }

 // ordre donné de l' ordi
/*if (Serial.available()){
    AIG1-1 = Serial.read();
    AIG1 = 1;
     lcd.setCursor(0, 2);
    lcd.print("!!PILOTE PAR ORDI!!");
     lcd.setCursor(0, 3);
    lcd.print("!!PILOTE PAR ORDI!!");
     }

 if (reception == "AIG1-2"){
    AIG1 = 2;
     lcd.setCursor(0, 2);
    lcd.print("!!PILOTE PAR ORDI!!");
     lcd.setCursor(0, 3);
    lcd.print("!!PILOTE PAR ORDI!!");
     }

  if (reception == "AIG2M1-1"){
    AIG2M1 = 1;
     } 

 if (reception == "AIG2M1-2"){
    AIG2M1 = 2;
     }

 if (reception == "AIG2M2-1"){
    AIG2M2 = 1;
     }

  if (reception == "AIG2M2-2"){
    AIG2M2 = 2;
     }

 if (reception == "AIG3-1"){
    AIG3 = 1;
     }

 if (reception == "AIG3-2"){
    AIG3 = 2;
     }

   if (reception == "AIG4-1"){
    AIG4 = 1;
     }

 if (reception == "AIG4-2"){
    AIG4 = 2;
     }

 if (reception == "AIG5-1"){
    AIG5 = 1;
     }

 if (reception == "AIG5-2"){
    AIG5 = 2;
     }

if (reception == "AIG6-1"){
    AIG6 = 1;
     }

if (reception == "AIG6-2"){
    AIG6 = 2;
     } 

if (reception == "AIG7-1"){
    AIG7 = 1;
     }

if (reception == "AIG7-2"){
    AIG7 = 2;
     } 
     */                                           
//commande des moteur d' aiguillage

if (AIG1 == 1){ if (etat0 == 0){
 
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(0, pwmAngleValue.pwmForAngle(angle1));// aig 1 Droite
    delay(Attente);
}
}
 etat0 = 1;
}

if (AIG1 == 2){ if (etat0 == 1){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(0, pwmAngleValue.pwmForAngle(angle1));// aig 1 Dévier
    delay(Attente);
}
}
etat0 = 0;
}
 
if (AIG2M1 == 1){if (etat1 == 0){
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(1, pwmAngleValue.pwmForAngle(angle1));// aig 2 moteur 1 Droite
    delay(Attente);
}
}
etat1 = 1;
}
if (AIG2M1 == 2){if (etat1 == 1){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(1, pwmAngleValue.pwmForAngle(angle1));// aig 2 moteur 1 Dévier
    delay(Attente);
}
}
etat1 = 0;
}

if (AIG2M2 == 1){ if(etat2 == 0){
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(2, pwmAngleValue.pwmForAngle(angle1));// aig 2 moteur 2 Droite
    delay(Attente);
}
}
etat2 = 1;
}
if (AIG2M2 == 2){if(etat2 == 1){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(2, pwmAngleValue.pwmForAngle(angle1));// aig 2 moteur 2 Dévier
    delay(Attente);
}
}
etat2 = 0;
}
if (AIG3 == 1){if (etat3 == 0){
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(3, pwmAngleValue.pwmForAngle(angle1));// aig 1 Droite
    delay(Attente);
}
}
etat3 = 1;
}
if (AIG3 == 2){if (etat3 == 1){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(3, pwmAngleValue.pwmForAngle(angle1));// aig 1 Dévier
    delay(Attente);
}
}
etat3 = 0;
}
if (AIG4 == 1){if (etat4 == 0){
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(4, pwmAngleValue.pwmForAngle(angle1));// aig 1 Droite
    delay(Attente);
}
}
etat4 = 1;
}
if (AIG4 == 2){if(etat4 == 1){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(4, pwmAngleValue.pwmForAngle(angle1));// aig 1 Dévier
    delay(Attente);
}
}
etat4 = 0;
}
if (AIG5 == 1){if(etat5 == 0){
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(5, pwmAngleValue.pwmForAngle(angle1));// aig 1 Droite
    delay(Attente);
}

}etat5 = 1;
}
if (AIG5 == 2){if(etat5 == 1){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(5, pwmAngleValue.pwmForAngle(angle1));// aig 1 Dévier
    delay(Attente);
}

etat5 = 0;
}
}
if (AIG6 == 1){ if(etat6 == 1){
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(6, pwmAngleValue.pwmForAngle(angle1));// aig 1 Droite
    delay(Attente);
}
etat6 = 0;
}
}
if (AIG6 == 2){ if(etat6 == 0){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(6, pwmAngleValue.pwmForAngle(angle1));// aig 1 Dévier
    delay(Attente);
}
}
etat6 = 1;
}
if (AIG7 == 1){if (etat7 == 0){
  for (int angle1 = +20; angle1 >= -20 ; --angle1){
    pwmController.setChannelPWM(7, pwmAngleValue.pwmForAngle(angle1));// aig 1 Droite
    delay(Attente);
}
}
etat7 = 1;
}
if (AIG7 == 2){if (etat7 == 1){
  for (int angle1 = -20; angle1 <= +20 ; ++angle1){
    pwmController.setChannelPWM(7, pwmAngleValue.pwmForAngle(angle1));// aig 1 Dévier
    delay(Attente);
}
}
etat7 = 0;
}

}
   

3
Les réseaux / bonjour à tous
« le: avril 02, 2021, 03:29:06 pm »
bonjour

voici mon petit projet pour mon musée

j'ai une voie de démonstration en HO DC (pas de digital)
sur la quelle j'aimerais faire des navettes automatique
je vous symbolise la voie ---------<=========>------- (excuser moi pour le schéma rudimentaire en rouge)
pour se faire je voudrais utiliser mon Arduino uno avec des contacts ILS
 https://www.ebay.fr/itm/Module-ILS-Interrupteur-lame-souple-3-3V-5V-Arduino-reed-switch-MKA14103-/123653306363
de chaque coté
1 relais pour piloté le module de freinage et de démarrage progressif
1 relais inverseur de polarité
le temp d arrêt est gérer par l' Arduino
il me faut aussi un bouton "start" et un arrêt après 2 allé retour
pouvez-vous m'aider svp 

Pages: [1]