Auteur Sujet: Bibliothèque NmraDcc-simple DCC Multifunction (Locomotive) decoder  (Lu 22146 fois)

Benoit92

  • Full Member
  • ***
  • Messages: 201
    • Voir le profil
Bonjour,
Pour ceux que cela peut intéresser, un"simple DCC Multifunction (Locomotive) decoder" a été ajouté (il y a un mois) sur Github :
https://github.com/mrrwa/NmraDcc
https://github.com/mrrwa/NmraDcc/blob/master/examples/NmraDccMultiFunctionMotorDecoder/NmraDccMultiFunctionMotorDecoder.ino

Il permet le pilotage de la traction, des feux et de l'éclairage.
Pour le son, c'est une autre paire de manche !

Ce logiciel peut être installé sur :
 - Arduino UNO
 - ATTiny85

Il faut ajouter :
- Un adaptateur de signal DCC (optocoupleur) rails -> Arduino,
- Un pont en H (Arduino -> Moteur CC),
- Un 7805 -> 5V pour le VCC de l'optocoupleur,
- Un pont de diode + gros condensateur pour la puissance du pont en H,
- Des Leds pour les feux et l'éclairage (en utilisant des leds bicolore jaune/rouge, on peut simplifier le câblage)
En utilisant un ATTiny85, je pense que ce décodeur peut être intégré sur des locomotives au minimum à l'échelle O.
Je doute cependant que ce décodeur puisse être installé sur des locomotives à l'échelle HO ou peut-être sur des vapeurs avec tender.
 


« Modifié: mai 23, 2019, 12:30:26 am par Benoit92 »

fcot2002

  • Full Member
  • ***
  • Messages: 118
    • Voir le profil
Re : Bibliothèque NmraDcc-simple DCC Multifunction (Locomotive) decoder
« Réponse #1 le: mai 23, 2019, 11:45:23 am »
Bonjour @ tous,

Merci Benoit92   :) :) :)

Benoit92

  • Full Member
  • ***
  • Messages: 201
    • Voir le profil
Re : Bibliothèque NmraDcc-simple DCC Multifunction (Locomotive) decoder
« Réponse #2 le: mai 24, 2019, 09:49:25 pm »
Bonjour, en attendant de recevoir mon ATtiny85, j'ai essayé de "vérifier/compiler" le programme "simple DCC Multifunction (Locomotive) decoder" :
// NMRA Dcc Multifunction Motor Decoder Demo
//
// Author: Alex Shepherd 2019-03-30
//
// This example requires these Arduino Libraries:
//
// 1) The NmraDcc Library from: http://mrrwa.org/download/
//
// These libraries can be found and installed via the Arduino IDE Library Manager
//
// This is a simple demo of how to drive and motor speed and direction using PWM and a motor H-Bridge
// It uses vStart and vHigh CV values to customise the PWM values to the motor response
// It also uses the Headling Function to drive 2 LEDs for Directional Headlights
// Apart from that there's nothing fancy like Lighting Effects or a function matrix or Speed Tables - its just the basics...
//

#include <NmraDcc.h>

// Uncomment any of the lines below to enable debug messages for different parts of the code
//#define DEBUG_FUNCTIONS
//#define DEBUG_SPEED
//#define DEBUG_PWM
//#define DEBUG_DCC_ACK
//#define DEBUG_DCC_MSG

#if defined(DEBUG_FUNCTIONS) or defined(DEBUG_SPEED) or defined(DEBUG_PWM) or defined(DEBUG_DCC_ACK) or defined(DEBUG_DCC_MSG)
#define DEBUG_PRINT
#endif

// This is the default DCC Address
#define DEFAULT_DECODER_ADDRESS 3

#define DCC_PIN     2

#define LED_PIN_FWD 0
#define LED_PIN_REV 1
#define MOTOR_DIR_PIN 3
#define MOTOR_PWM_PIN 4

// Some global state variables
uint8_t newLedState = 0;
uint8_t lastLedState = 0;

uint8_t newDirection = 0;
uint8_t lastDirection = 0;

uint8_t newSpeed = 0;
uint8_t lastSpeed = 0;
uint8_t numSpeedSteps = SPEED_STEP_128;

uint8_t vStart;
uint8_t vHigh;

// Structure for CV Values Table
struct CVPair
{
  uint16_t  CV;
  uint8_t   Value;
};

// CV Addresses we will be using
#define CV_VSTART  2
#define CV_VHIGH   5

// Default CV Values Table
CVPair FactoryDefaultCVs [] =
{
  // The CV Below defines the Short DCC Address
  {CV_MULTIFUNCTION_PRIMARY_ADDRESS, DEFAULT_DECODER_ADDRESS},

  // Three Step Speed Table
  {CV_VSTART, 120},
  {CV_VHIGH, 255},

  // These two CVs define the Long DCC Address
  {CV_MULTIFUNCTION_EXTENDED_ADDRESS_MSB, 0},
  {CV_MULTIFUNCTION_EXTENDED_ADDRESS_LSB, DEFAULT_DECODER_ADDRESS},

// ONLY uncomment 1 CV_29_CONFIG line below as approprate
//  {CV_29_CONFIG,                                      0}, // Short Address 14 Speed Steps
  {CV_29_CONFIG,                       CV29_F0_LOCATION}, // Short Address 28/128 Speed Steps
//  {CV_29_CONFIG, CV29_EXT_ADDRESSING | CV29_F0_LOCATION}, // Long  Address 28/128 Speed Steps 
};

NmraDcc  Dcc ;

uint8_t FactoryDefaultCVIndex = 0;

// This call-back function is called when a CV Value changes so we can update CVs we're using
void notifyCVChange( uint16_t CV, uint8_t Value)
{
  switch(CV)
  {
    case CV_VSTART:
      vStart = Value;
      break;
     
    case CV_VHIGH:
      vHigh = Value;
      break;
  }
}

void notifyCVResetFactoryDefault()
{
  // Make FactoryDefaultCVIndex non-zero and equal to num CV's to be reset
  // to flag to the loop() function that a reset to Factory Defaults needs to be done
  FactoryDefaultCVIndex = sizeof(FactoryDefaultCVs)/sizeof(CVPair);
};

// This call-back function is called whenever we receive a DCC Speed packet for our address
void notifyDccSpeed( uint16_t Addr, DCC_ADDR_TYPE AddrType, uint8_t Speed, DCC_DIRECTION Dir, DCC_SPEED_STEPS SpeedSteps )
{
  #ifdef DEBUG_SPEED
  Serial.print("notifyDccSpeed: Addr: ");
  Serial.print(Addr,DEC);
  Serial.print( (AddrType == DCC_ADDR_SHORT) ? "-S" : "-L" );
  Serial.print(" Speed: ");
  Serial.print(Speed,DEC);
  Serial.print(" Steps: ");
  Serial.print(SpeedSteps,DEC);
  Serial.print(" Dir: ");
  Serial.println( (Dir == DCC_DIR_FWD) ? "Forward" : "Reverse" );
  #endif

  newDirection = Dir;
  newSpeed = Speed;
  numSpeedSteps = SpeedSteps;
};

// This call-back function is called whenever we receive a DCC Function packet for our address
void notifyDccFunc(uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState)
{
  #ifdef DEBUG_FUNCTIONS
  Serial.print("notifyDccFunc: Addr: ");
  Serial.print(Addr,DEC);
  Serial.print( (AddrType == DCC_ADDR_SHORT) ? 'S' : 'L' );
  Serial.print("  Function Group: ");
  Serial.print(FuncGrp,DEC);
  #endif

  if(FuncGrp == FN_0_4)
  {
    newLedState = (FuncState & FN_BIT_00) ? 1 : 0;
    #ifdef DEBUG_FUNCTIONS
    Serial.print(" FN 0: ");
    Serial.print(newLedState);
    #endif
  }
  #ifdef DEBUG_FUNCTIONS
  Serial.println();
  #endif
}

// This call-back function is called whenever we receive a DCC Packet
#ifdef  DEBUG_DCC_MSG
void notifyDccMsg( DCC_MSG * Msg)
{
  Serial.print("notifyDccMsg: ") ;
  for(uint8_t i = 0; i < Msg->Size; i++)
  {
    Serial.print(Msg->Data[i], HEX);
    Serial.write(' ');
  }
  Serial.println();
}
#endif

// This call-back function is called by the NmraDcc library when a DCC ACK needs to be sent
// Calling this function should cause an increased 60ma current drain on the power supply for 6ms to ACK a CV Read
// So we will just turn the motor on for 8ms and then turn it off again.

void notifyCVAck(void)
{
  #ifdef DEBUG_DCC_ACK
  Serial.println("notifyCVAck") ;
  #endif

  digitalWrite(MOTOR_DIR_PIN, HIGH);
  digitalWrite(MOTOR_PWM_PIN, HIGH);

  delay( 8 ); 

  digitalWrite(MOTOR_DIR_PIN, LOW);
  digitalWrite(MOTOR_PWM_PIN, LOW);
}

void setup()
{
  #ifdef DEBUG_PRINT
  Serial.begin(115200);
  Serial.println("NMRA Dcc Multifunction Motor Decoder Demo");
  #endif

  // Setup the Pins for the Fwd/Rev LED for Function 0 Headlight
  pinMode(LED_PIN_FWD, OUTPUT);
  pinMode(LED_PIN_REV, OUTPUT);

  // Setup the Pins for the Motor H-Bridge Driver
  pinMode(MOTOR_DIR_PIN, OUTPUT);
  pinMode(MOTOR_PWM_PIN, OUTPUT);

 
  // Setup which External Interrupt, the Pin it's associated with that we're using and enable the Pull-Up
  Dcc.pin(DCC_PIN, 0);
 
  Dcc.init( MAN_ID_DIY, 10, FLAGS_MY_ADDRESS_ONLY | FLAGS_AUTO_FACTORY_DEFAULT, 0 );

  // Uncomment to force CV Reset to Factory Defaults
//  notifyCVResetFactoryDefault();

  // Read the current CV values for vStart and vHigh
  vStart = Dcc.getCV(CV_VSTART);
  vHigh = Dcc.getCV(CV_VHIGH);
}

void loop()
{
  // You MUST call the NmraDcc.process() method frequently from the Arduino loop() function for correct library operation
  Dcc.process();

  // Handle Speed changes
  if(lastSpeed != newSpeed)
  {
    lastSpeed = newSpeed;

    // Stop if speed = 0 or 1
   
    if(newSpeed <= 1)
      digitalWrite(MOTOR_PWM_PIN, LOW);

    // Calculate PWM value in the range 1..255   
    else
    {
      uint8_t vScaleFactor;
     
      if((vHigh > 1) && (vHigh > vStart))
        vScaleFactor = vHigh - vStart;
      else
        vScaleFactor = 255 - vStart;

      uint8_t modSpeed = newSpeed - 1;
      uint8_t modSteps = numSpeedSteps - 1;
     
      uint8_t newPwm = (uint8_t) vStart + modSpeed * vScaleFactor / modSteps;

      #ifdef DEBUG_PWM
      Serial.print("New Speed: vStart: ");
      Serial.print(vStart);
      Serial.print(" vHigh: ");
      Serial.print(vHigh);
      Serial.print(" modSpeed: ");
      Serial.print(modSpeed);
      Serial.print(" vScaleFactor: ");
      Serial.print(vScaleFactor);
      Serial.print(" modSteps: ");
      Serial.print(modSteps);
      Serial.print(" newPwm: ");
      Serial.println(newPwm);
      #endif
           
      analogWrite(MOTOR_PWM_PIN, newPwm);
    }
  }
 
  // Handle Direction and Headlight changes
  if((lastDirection != newDirection) || (lastLedState != newLedState))
  {
    lastDirection = newDirection;
    lastLedState = newLedState;

    digitalWrite(MOTOR_DIR_PIN, newDirection);

    if(newLedState)
    {
      #ifdef DEBUG_FUNCTIONS
      Serial.println("LED On");
      #endif
      digitalWrite(LED_PIN_FWD, newDirection ? LOW : HIGH);
      digitalWrite(LED_PIN_REV, newDirection ? HIGH : LOW);
    }
    else
    {
      #ifdef DEBUG_FUNCTIONS
      Serial.println("LED Off");
      #endif
      digitalWrite(LED_PIN_FWD, LOW);
      digitalWrite(LED_PIN_REV, LOW);
    }
  }

  // Handle resetting CVs back to Factory Defaults
  if( FactoryDefaultCVIndex && Dcc.isSetCVReady())
  {
    FactoryDefaultCVIndex--; // Decrement first as initially it is the size of the array
    Dcc.setCV( FactoryDefaultCVs[FactoryDefaultCVIndex].CV, FactoryDefaultCVs[FactoryDefaultCVIndex].Value);
  }
}

Malheureusement, j'ai le message d'erreur suivant :
Arduino : 1.8.9 (Windows 10), TD: 1.46, Carte : "ATtiny25/45/85, ATtiny85, Internal 1 MHz"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\NexterECT\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\NexterECT\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\NexterECT\Documents\Arduino\libraries -fqbn=attiny:avr:ATtinyX5:cpu=attiny85,clock=internal1 -ide-version=10809 -build-path C:\Users\NEXTER~1\AppData\Local\Temp\arduino_build_416478 -warnings=all -build-cache C:\Users\NEXTER~1\AppData\Local\Temp\arduino_cache_844353 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\NexterECT\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\NexterECT\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\NexterECT\Documents\Arduino\libraries -fqbn=attiny:avr:ATtinyX5:cpu=attiny85,clock=internal1 -ide-version=10809 -build-path C:\Users\NEXTER~1\AppData\Local\Temp\arduino_build_416478 -warnings=all -build-cache C:\Users\NEXTER~1\AppData\Local\Temp\arduino_cache_844353 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino
Using board 'ATtinyX5' from platform in folder: C:\Users\NexterECT\AppData\Local\Arduino15\packages\attiny\hardware\avr\1.0.2
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=1000000L -DARDUINO=10809 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\NexterECT\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\sketch\\ATTyny85.ino.cpp" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=1000000L -DARDUINO=10809 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\NexterECT\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-IC:\\Program Files (x86)\\Arduino\\libraries\\NmraDcc-master" "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\sketch\\ATTyny85.ino.cpp" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=1000000L -DARDUINO=10809 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\NexterECT\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-IC:\\Program Files (x86)\\Arduino\\libraries\\NmraDcc-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\EEPROM\\src" "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\sketch\\ATTyny85.ino.cpp" -o nul
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=1000000L -DARDUINO=10809 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\NexterECT\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-IC:\\Program Files (x86)\\Arduino\\libraries\\NmraDcc-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\EEPROM\\src" "C:\\Program Files (x86)\\Arduino\\libraries\\NmraDcc-master\\NmraDcc.cpp" -o nul
Generating function prototypes...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=1000000L -DARDUINO=10809 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\NexterECT\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-IC:\\Program Files (x86)\\Arduino\\libraries\\NmraDcc-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\EEPROM\\src" "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\sketch\\ATTyny85.ino.cpp" -o "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compilation du croquis...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=attiny85 -DF_CPU=1000000L -DARDUINO=10809 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\NexterECT\\AppData\\Local\\Arduino15\\packages\\attiny\\hardware\\avr\\1.0.2\\variants\\tiny8" "-IC:\\Program Files (x86)\\Arduino\\libraries\\NmraDcc-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\EEPROM\\src" "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\sketch\\ATTyny85.ino.cpp" -o "C:\\Users\\NEXTER~1\\AppData\\Local\\Temp\\arduino_build_416478\\sketch\\ATTyny85.ino.cpp.o"
C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino:116:31: warning: unused parameter 'Addr' [-Wunused-parameter]

 void notifyDccSpeed( uint16_t Addr, DCC_ADDR_TYPE AddrType, uint8_t Speed, DCC_DIRECTION Dir, DCC_SPEED_STEPS SpeedSteps )

                               ^

C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino:116:51: warning: unused parameter 'AddrType' [-Wunused-parameter]

 void notifyDccSpeed( uint16_t Addr, DCC_ADDR_TYPE AddrType, uint8_t Speed, DCC_DIRECTION Dir, DCC_SPEED_STEPS SpeedSteps )

                                                   ^

C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino:136:29: warning: unused parameter 'Addr' [-Wunused-parameter]

 void notifyDccFunc(uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState)

                             ^

C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino:136:49: warning: unused parameter 'AddrType' [-Wunused-parameter]

 void notifyDccFunc(uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState)

                                                 ^

C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino: In function 'void setup()':

ATTyny85:209:21: error: no matching function for call to 'NmraDcc::pin(int, int)'

   Dcc.pin(DCC_PIN, 0);

                     ^

In file included from C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino:17:0:

C:\Program Files (x86)\Arduino\libraries\NmraDcc-master/NmraDcc.h:227:8: note: candidate: void NmraDcc::pin(uint8_t, uint8_t, uint8_t)

   void pin( uint8_t ExtIntNum, uint8_t ExtIntPinNum, uint8_t EnablePullup);

        ^

C:\Program Files (x86)\Arduino\libraries\NmraDcc-master/NmraDcc.h:227:8: note:   candidate expects 3 arguments, 2 provided

In file included from C:\Program Files (x86)\Arduino\libraries\NmraDcc-master/NmraDcc.h:47:0,

                 from C:\Users\Projet Loko\ATTyny85\ATTyny85\ATTyny85.ino:17:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src/EEPROM.h: At global scope:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src/EEPROM.h:145:20: warning: 'EEPROM' defined but not used [-Wunused-variable]

 static EEPROMClass EEPROM;

                    ^

Utilisation de la bibliothèque NmraDcc-master version 2.0.1 dans le dossier: C:\Program Files (x86)\Arduino\libraries\NmraDcc-master
Utilisation de la bibliothèque EEPROM version 2.0 dans le dossier: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM
exit status 1
no matching function for call to 'NmraDcc::pin(int, int)'

Benoit92

  • Full Member
  • ***
  • Messages: 201
    • Voir le profil
Re : Bibliothèque NmraDcc-simple DCC Multifunction (Locomotive) decoder
« Réponse #3 le: mai 24, 2019, 11:36:00 pm »
A priori, il y a une erreur dans le programme récupéré sur GITHUB.
Il faut remplacer :
Dcc.pin(DCC_PIN, 0); par
Dcc.pin(0, DCC_PIN, 0);