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
Vos projets / ASC 712 capteur à effet hall
« le: octobre 20, 2024, 03:10:54 pm »
Bonjour,

Je vous mets à disposition un sketch pour un va et viens analogique avec démarrage et arrêt progressif.
Matériels: 1 Arduino uno, 1 L298N, 3 ASC712 

Le code est pas de moi juste apporté quelque modification et ajout, il y a certainement mieux, mais sa fonctionne très bien,
J' espère que sa peut vous servir.
Si vous avez des modifications ou des améliorations à apporter pas de problème. 

#define VERSION "1.001.006"
#define SYS_ID "ACS712 Sensor Test"
const int pin = 1;
const int pin1 = 2;
const int pin2 = 3;
int pin8 = 8;
int ena = 9;
int in1 = 8;
int in2 = 7;
int vitesse ;
int direct ;


// Sampling Parameters
const unsigned long sampleTime = 58000UL; // 58 ms
const unsigned long numSamples = 300UL;
// sample interval is in microseconds
// must be greater than 100μs, the conversion time of the internal ADC
const unsigned long sampleInterval = sampleTime/numSamples;

#define SENSITIVITY 185 // per ACS712 5A data sheet, in mv/A
#define DETECTION_MULTIPLIER 1.095 // change as necessary to improve detection accuracy
#define CALIBRATION_READS 5000

// variables to hold sensor quiescent readings
int aqv;
int aqv1;
int aqv2; 
float aqc;
float aqc1;
float aqc2;

void setup()
{
  pinMode(ena, OUTPUT); 
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(pin8,HIGH);

  TCCR1B &= 0xF8;
TCCR1B |= B00000010;
 
  float sense;
  Serial.begin(9600);
  Serial.println(String(F(SYS_ID)) + String(F(" - SW:")) + String(F(VERSION)));
  Serial.print("\n\nCalibrating the sensor at pin ");
  Serial.println(pin);
  aqv = determineVQ(pin);
  Serial.print("AQV: ");
  Serial.print(aqv, 4);
  Serial.println(" mV");
  aqc = determineCQ(pin, aqv);
  Serial.print("AQC: ");
  Serial.print(aqc, 4);
  Serial.println(" mA");
  sense = (aqc * DETECTION_MULTIPLIER) - aqc;
  Serial.print("Detection Threshold: ");
  Serial.print(sense * 1000, 4);
  Serial.println(" mA\n\n");
 
  float sense1;
  Serial.print("\n\nCalibrating the sensor at pin ");
  Serial.println(pin1);
  aqv1 = determineVQ(pin1);
  Serial.print("AQV1: ");
  Serial.print(aqv1, 4);
  Serial.println(" mV");
  aqc1 = determineCQ(pin1, aqv1);
  Serial.print("AQC1: ");
  Serial.print(aqc, 4);
  Serial.println(" mA");
  sense1 = (aqc1 * DETECTION_MULTIPLIER) - aqc1;
  Serial.print("Detection Threshold: ");
  Serial.print(sense1 * 1000, 4);
  Serial.println(" mA\n\n");
 

  float sense2;
  Serial.print("\n\nCalibrating the sensor at pin ");
  Serial.println(pin2);
  aqv2 = determineVQ(pin2);
  Serial.print("AQV2: ");
  Serial.print(aqv2, 4);
  Serial.println(" mV");
  aqc2 = determineCQ(pin2, aqv2);
  Serial.print("AQC2: ");
  Serial.print(aqc, 4);
  Serial.println(" mA");
  sense2 = (aqc2 * DETECTION_MULTIPLIER) - aqc2;
  Serial.print("Detection Threshold: ");
  Serial.print(sense2 * 1000, 4);
  Serial.println(" mA\n\n");
  delay(5000);


}

void loop(){
   

  float current = readCurrent(pin, aqv);
  bool occupied = current > (aqc * DETECTION_MULTIPLIER);

 
 
  Serial.print("Current Sensed:");
  Serial.print(current * 1000,1);
  Serial.print(" mA\t\t");
  Serial.print("The block1 is ");
  if(occupied){ if (direct == 1){
   for (vitesse = 255; vitesse >=30; vitesse -=5)
    {analogWrite(ena,vitesse);
    delay(50);
    }
    digitalWrite(in1, 0); 
    digitalWrite(in2, 1);
    for (vitesse = 30; vitesse <=255; vitesse +=5)
    {analogWrite(ena,vitesse);
    delay(50);
    }
    //digitalWrite(in1, 1); 
    //digitalWrite(in2, 0);
    Serial.println("occupied");
   
  }
  direct = 2;
    Serial.println("occupied");
   
  } else {
    Serial.println("not occupied");
  }

float current1 = readCurrent1(pin1, aqv1);
  bool occupied1 = current1 > (aqc1 * DETECTION_MULTIPLIER);
 
  Serial.print("Current Sensed1:");
  Serial.print(current1 * 1000,1);
  Serial.print(" mA\t\t");
  Serial.print("The block2 is ");
  if(occupied1){
    Serial.println("occupied");
   
  } else {
    Serial.println("not occupied");
  }

  float current2 = readCurrent2(pin2, aqv2);
  bool occupied2 = current2 > (aqc2 * DETECTION_MULTIPLIER);

  Serial.print("Current Sensed2:");
  Serial.print(current2 * 1000,1);
  Serial.print(" mA\t\t");
  Serial.print("The block3 is ");
  if(occupied2){if (direct == 2){
   for (vitesse = 255; vitesse >=30; vitesse -=5)
    {analogWrite(ena,vitesse);
    delay(50);
    }
    digitalWrite(in1, 1); 
    digitalWrite(in2, 0);
    for (vitesse = 30; vitesse <=255; vitesse +=5)
    {analogWrite(ena,vitesse);
    delay(50);
    }
    //digitalWrite(in1, 1); 
    //digitalWrite(in2, 0);
    Serial.println("occupied");
   
  }
  direct = 1;
  } else {
    Serial.println("not occupied");
  }
 
 /*
if (essai == 1) {
    if (test == 1) {
      digitalWrite(0, HIGH);
*/
 
  delay(100);
 
}

//////////////////////////////////////////
// ACS712 Current Sensor Functions
//////////////////////////////////////////
float readCurrent(int PIN, float adc_zero)
{
  float currentAcc = 0;
  unsigned int count = 0;
  unsigned long prevMicros = micros() - sampleInterval ;
  while (count < numSamples)
  {
    if (micros() - prevMicros >= sampleInterval)
    {
      float adc_raw = (float) analogRead(PIN) - adc_zero;
      adc_raw /= SENSITIVITY; // convert to amperes
      currentAcc += (adc_raw * adc_raw);
      ++count;
      prevMicros += sampleInterval;
    }
  }
  //https://en.wikipedia.org/wiki/Root_mean_square
  float rms = sqrt((float)currentAcc / (float)numSamples);
  return rms;
}

float readCurrent1(int PIN, float adc_zero1)
{
  float currentAcc = 0;
  unsigned int count = 0;
  unsigned long prevMicros = micros() - sampleInterval ;
  while (count < numSamples)
  {
    if (micros() - prevMicros >= sampleInterval)
    {
      float adc_raw1 = (float) analogRead(PIN) - adc_zero1;
      adc_raw1 /= SENSITIVITY; // convert to amperes
      currentAcc += (adc_raw1 * adc_raw1);
      ++count;
      prevMicros += sampleInterval;
    }
  }
  //https://en.wikipedia.org/wiki/Root_mean_square
  float rms1 = sqrt((float)currentAcc / (float)numSamples);
  return rms1;
}

float readCurrent2(int PIN, float adc_zero2)
{
  float currentAcc = 0;
  unsigned int count = 0;
  unsigned long prevMicros = micros() - sampleInterval ;
  while (count < numSamples)
  {
    if (micros() - prevMicros >= sampleInterval)
    {
      float adc_raw2 = (float) analogRead(PIN) - adc_zero2;
      adc_raw2 /= SENSITIVITY; // convert to amperes
      currentAcc += (adc_raw2 * adc_raw2);
      ++count;
      prevMicros += sampleInterval;
    }
  }
  //https://en.wikipedia.org/wiki/Root_mean_square
  float rms2 = sqrt((float)currentAcc / (float)numSamples);
  return rms2;
}
//////////////////////////////////////////
// Calibration
// Track Power must be OFF during calibration
//////////////////////////////////////////

int determineVQ(int PIN) {
  float VQ = 0;
  //read a large number of samples to stabilize value
  for (int i = 0; i < CALIBRATION_READS; i++) {
    VQ += analogRead(PIN);
    delayMicroseconds(sampleInterval);
  }
  VQ /= CALIBRATION_READS;
  return int(VQ);
}

int determineVQ1(int PIN) {
  float VQ1 = 0;
  //read a large number of samples to stabilize value
  for (int i = 0; i < CALIBRATION_READS; i++) {
    VQ1 += analogRead(PIN);
    delayMicroseconds(sampleInterval);
  }
  VQ1 /= CALIBRATION_READS;
  return int(VQ1);
}

int determineVQ2(int PIN) {
  float VQ2 = 0;
  //read a large number of samples to stabilize value
  for (int i = 0; i < CALIBRATION_READS; i++) {
    VQ2 += analogRead(PIN);
    delayMicroseconds(sampleInterval);
  }
  VQ2 /= CALIBRATION_READS;
  return int(VQ2);
}

float determineCQ(int pin, float aqv) {
  float CQ = 0;
  // set reps so the total actual analog reads == CALIBRATION_READS
  int reps = (CALIBRATION_READS / numSamples);
  for (int i = 0; i < reps; i++) {
    CQ += readCurrent(pin, aqv);
  }
  CQ /= reps;
  return CQ;
}

float determineCQ1(int pin1, float aqv1) {
  float CQ1 = 0;
  // set reps so the total actual analog reads == CALIBRATION_READS
  int reps1 = (CALIBRATION_READS / numSamples);
  for (int i = 0; i < reps1; i++) {
    CQ1 += readCurrent(pin1, aqv1);
  }
  CQ1 /= reps1;
  return CQ1;
}

float determineCQ2(int pin2, float aqv2) {
  float CQ2 = 0;
  // set reps so the total actual analog reads == CALIBRATION_READS
  int reps2 = (CALIBRATION_READS / numSamples);
  for (int i = 0; i < reps2; i++) {
    CQ2 += readCurrent(pin2, aqv2);
  }
  CQ2 /= reps2;
  return CQ2;
}

2
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

3
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;
}

}
   

4
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]