LOCODUINO

Aide
Forum de discussion
Dépôt GIT Locoduino
Flux RSS

jeudi 28 mars 2024

Visiteurs connectés : 87

Bibliothèque DCCpp

Encore un DCC++ ? Mais à quoi ça sert ?

. Par : Thierry

Pourquoi une bibliothèque ? Nous sommes devant le cas typique d’un projet dont une bonne partie du code doit pouvoir être ré-utilisée dans d’autres projets. C’est le but d’une bibliothèque, et c’est ce que j’ai décidé de faire après avoir vu tout le monde ici s’en servir, et l’avoir moi-même utilisé dans au moins deux projets différents : (...)

Retourner à l'article

Vous répondez à :

Bibliothèque DCCpp 25 février 2020 18:17, par CLB89

Bonjour,
Je reviens vers vous car j’ai toujours problème pour faire fonctionner JMRI avec mon sketch !
Mon sketch est le suivant :
« /*************************************************************
project :
author :
description :
*************************************************************/

#include "DCCpp.h"

#if !defined(USE_TEXTCOMMAND) || !defined(USE_ETHERNET)
#error To be able to compile this sample,the lines #define USE_TEXTCOMMAND and #define USE_ETHERNET must be uncommented in DCCpp.h
#endif

// the media access control (ethernet hardware) address for the shield :
uint8_t mac[] = 0xA8, 0x61, 0x0A, 0xAE, 0x76, 0xB6  ;
//the IP address for the shield :
// uint8_t ip[] = 192, 168, 1, 200  ;

EthernetServer DCCPP_INTERFACE(2560) ; // Create and instance of an EthernetServer

void setup()

// Set pins 53 & 4 as required with last Arduino Ethernet library + Ethernet V2 shield on Mega 2560
pinMode(53, OUTPUT) ;
digitalWrite(53, HIGH) ;
pinMode(4, OUTPUT) ;
digitalWrite(4, HIGH) ;

Serial.begin(115200) ;

DCCpp::begin() ;
// Configuration for my "void Main". See the page ’Configuration lines’ in the documentation for other samples.
DCCpp::beginMain(UNDEFINED_PIN, UNDEFINED_PIN, UNDEFINED_PIN, UNDEFINED_PIN) ;
DCCpp::beginEthernet(mac, NULL, EthernetProtocol::TCP) ;
// Print the local IP address :
Serial.print("My IP address : ") ;
for (byte thisByte = 0 ; thisByte < 4 ; thisByte++)
// print the value of each byte of the IP address :
Serial.print(Ethernet.localIP()[thisByte], DEC) ;
Serial.print(".") ;

Serial.println() ;
Serial.println("DCCpp démarre et Ethernet est supposé opérationnel !") ;

void loop()

DCCpp::loop() ;
 »

DHCP fonctionne et mon router voit bien Arduino et son Shield Ethernet V2. Après mise en route de JMRI et le chargement d’un panel très simple avec un circuit et 2 aiguillages, je retrouve dans le log session de JMRI l’information suivante :

« 2020-02-25 17:48:50,050 util.Log4JUtil INFO - ****** JMRI log ******* [main]
2020-02-25 17:48:50,061 util.Log4JUtil INFO - This log is appended to file : C :\Users\claud\JMRI\log\messages.log [main]
2020-02-25 17:48:50,061 util.Log4JUtil INFO - This log is stored in file : C :\Users\claud\JMRI\log\session.log [main]
2020-02-25 17:48:50,068 apps.Apps INFO - PanelPro version 4.18+R37ad3d0 starts under Java 1.8.0_241 on Windows 10 x86 v10.0 at Tue Feb 25 17:48:50 CET 2020 [main]
2020-02-25 17:48:50,293 apps.Apps INFO - Starting with profile CMBNewProfile.3e2b4aad [main]
2020-02-25 17:48:50,477 node.NodeIdentity INFO - Using 22ba0102-4f78-4270-a19c-71ebe7f6cd6b as the JMRI storage identity for profile id 3e2b4aad [AWT-EventQueue-0]
2020-02-25 17:48:50,667 dccpp.DCCppReply ERROR - DCCppReply value index too big. idx = 1 msg = iDCCpp LIBRARY BASE STATION FOR ARDUINO : V-2.0.0 / Feb 25 2020 17:35:02 [AWT-EventQueue-0]
2020-02-25 17:48:50,668 dccpp.DCCppReply ERROR - DCCppReply value index too big. idx = 2 msg = iDCCpp LIBRARY BASE STATION FOR ARDUINO : V-2.0.0 / Feb 25 2020 17:35:02 [AWT-EventQueue-0]
2020-02-25 17:49:01,018 util.FileUtilSupport INFO - File path program : is C :\Program Files (x86)\JMRI\ [main]
2020-02-25 17:49:01,018 util.FileUtilSupport INFO - File path preference : is C :\Users\claud\JMRI\CMBNewProfile.jmri\ [main]
2020-02-25 17:49:01,018 util.FileUtilSupport INFO - File path profile : is C :\Users\claud\JMRI\CMBNewProfile.jmri\ [main]
2020-02-25 17:49:01,019 util.FileUtilSupport INFO - File path settings : is C :\Users\claud\JMRI\ [main]
2020-02-25 17:49:01,019 util.FileUtilSupport INFO - File path home : is C :\Users\claud\ [main]
2020-02-25 17:49:01,019 util.FileUtilSupport INFO - File path scripts : is C :\Program Files (x86)\JMRI\jython\ [main]
2020-02-25 17:49:01,618 PanelPro.PanelPro INFO - Main initialization done [main]
2020-02-25 17:49:51,464 audio.JoalAudioFactory INFO - Initialised JOAL using OpenAL : vendor - OpenAL Community version - 1.1 ALSOFT 1.15.1 [Listed Table Generation]
2020-02-25 17:59:07,074 audio.DefaultAudioManager INFO - Shutting down active AudioFactory [AWT-EventQueue-0]
2020-02-25 17:59:07,188 managers.DefaultShutDownManager INFO - Normal termination complete [AWT-EventQueue-0] »

Merci de votre aide,
Claude

Qui êtes-vous ?
Votre message

Pour créer des paragraphes, laissez simplement des lignes vides.

Lien hypertexte

(Si votre message se réfère à un article publié sur le Web, ou à une page fournissant plus d’informations, vous pouvez indiquer ci-après le titre de la page et son adresse.)

98 Messages

Rubrique Bibliothèques

Bibliothèque Accessories (1)

Bibliothèque Accessories (2)

Un décodeur d’accessoires universel (1)

Un décodeur d’accessoires universel (2)

Un décodeur d’accessoires universel (3)

Bibliothèque LcdUi (1)

Bibliothèque LcdUi (2)

La bibliothèque Servo

Bibliothèque SoftWare Serial

Bibliothèque Serial

Bibliothèque EEPROM

Bibliothèque Wire : I2C

Bibliothèque LCD

La bibliothèque ScheduleTable

Bibliothèque MemoryUsage

Bibliothèque EEPROMextent

La bibliothèque SlowMotionServo

Bibliothèque Commanders

Bibliothèque DCCpp

Bibliothèque DcDccNanoController

La bibliothèque ACAN (1)

La bibliothèque ACAN (2)

Bibliothèque LightEffect

Les derniers articles

Bibliothèque LightEffect


Christian

La bibliothèque ACAN (2)


Jean-Luc

La bibliothèque ACAN (1)


Jean-Luc

La bibliothèque SlowMotionServo


Jean-Luc

Bibliothèque DCCpp


Thierry

Bibliothèque DcDccNanoController


Thierry

Bibliothèque LcdUi (2)


Thierry

Bibliothèque LcdUi (1)


Thierry

Bibliothèque Accessories (2)


Thierry

Bibliothèque Accessories (1)


Thierry

Les articles les plus lus

Bibliothèque Wire : I2C

La bibliothèque Servo

Bibliothèque SoftWare Serial

Bibliothèque DCCpp

Bibliothèque EEPROM

Bibliothèque MemoryUsage

Bibliothèque LCD

Bibliothèque DcDccNanoController

Bibliothèque Commanders

La bibliothèque SlowMotionServo