Auteur Sujet: Une alimentation analogique de base et une proposition de structure de classes  (Lu 8471 fois)

Matou

  • Newbie
  • *
  • Messages: 9
    • Voir le profil
Bonjour,

Je suis débutant en Arduino avec une vie professionnelle -terminée- en informatique (pas en électronique).
Pour commencer, je me suis lancé dans la réalisation d'une alimentation analogique pilotée par un Uno.
J'ai écrit une structure de classes pour les entrées-sorties dans le but de simplifier les boucles loop (et setup).
Une classe mère virtuelle pure EntreeSortie impose trois méthodes à toutes ses dérivées : print_config(), setup() et update().
La classe EntreesSorties (au pluriel) n'est qu'une liste chaînée d'EntreeSortie et ses méthodes ne servcent qu'à appeller la méthode correspondante de chacun
des objets de la liste.
La méthode print_config() permet d'afficher la configuration de chaque objet de la liste. Cela sert à avoir un affichage de l'usage des broches par un programme.
Il est pratique de l'invoquer au démarrage du programme. L'usage me dira si c'est réellement utile ou pas...
Les méthodes setup() et update() sont plus classiques. Avec cette structure, le programme principal devient plus simple.
Je joins les documentations et programmes dans leur état actuel. N'hésitez pas à les utiliser si vous pensez que cela peut vous servir.

Mon alimentation fonctionne actuellement en montage "volant sur table", je l'utilise pour faire rouler une locomotive sur un bout de voie de 2 mètres et demi de long. C'est encore très embrionaire, mais il faut un -second- début à tout.

Dominique

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 2889
  • 100% Arduino et N
    • Voir le profil
Bonjour,

C’est très intéressant pour faire rouler des trains analogiques.

J’ai vu les classes, mais, sauf erreur, je n’ai pas trouvé le programme complet qui les utilise.

Bon week-end.
Cordialement,
Dominique

bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
Oui, il manque un main ou un .ino ???

Matou

  • Newbie
  • *
  • Messages: 9
    • Voir le profil
Effectivement, le programme principal n'est ni un cpp, ni un h, j'avais zappé cela. Je répare mon oubli et je mets aussi le schéma en format PDF, car tout le monde n'a pas Kicad.
Et je demande humblement à être excusé.

bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
J'ai pas mal d'erreurs de complilation !!!

Arduino : 1.8.13 (Mac OS X), Carte : "Arduino Uno"
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/christophe/Library/Arduino15/packages -hardware /Users/christophe/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/christophe/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/christophe/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676 -warnings=default -build-cache /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_cache_675639 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/christophe/Downloads/Alimentation_CC (1)/Alim_analogique/Alim_analogique.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/christophe/Library/Arduino15/packages -hardware /Users/christophe/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/christophe/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/christophe/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676 -warnings=default -build-cache /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_cache_675639 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/christophe/Downloads/Alimentation_CC (1)/Alim_analogique/Alim_analogique.ino
Using board 'uno' from platform in folder: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr
Using core 'arduino' from platform in folder: /Applications/Arduino.app/Contents/Java/hardware/arduino/avr
Detecting libraries used...
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Alim_analogique.ino.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for LinkedList.h: [LinkedList@1.2.3]
ResolveLibrary(LinkedList.h)
  -> candidates: [LinkedList@1.2.3]
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Alim_analogique.ino.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE


bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
Suite car dépasse la taille :

/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/EntreeAnalog.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/EntreeDiscretisee.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/EntreeNumerique.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/EntreeSortie.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/EntreesSorties.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/InterpoLin.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/LCD_MG.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Led_MG_256.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Led_MG_256_Cligno.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Led_MG_Bin.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -


Matou

  • Newbie
  • *
  • Messages: 9
    • Voir le profil
J'ai l'impression qu'il faut ajouter la librairie LinkedList. Effectivement, je l'avais fait, sans la mettre d
ans mes sources.

bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/LiquidCrystal.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/MoteurCC_L298N.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Servo_MG.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for Servo.h: [ESP32_Arduino_Servo_Library@1.0.1 ServoESP32@1.0.3 Servo@1.1.6 Servo@1.1.7]
ResolveLibrary(Servo.h)
  -> candidates: [ESP32_Arduino_Servo_Library@1.0.1 ServoESP32@1.0.3 Servo@1.1.6 Servo@1.1.7]
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Servo_MG.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/VMA323.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /Users/christophe/Documents/Arduino/libraries/Servo/src/avr/Servo.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /Users/christophe/Documents/Arduino/libraries/Servo/src/mbed/Servo.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /Users/christophe/Documents/Arduino/libraries/Servo/src/megaavr/Servo.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src

bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
J'ai l'impression qu'il faut ajouter la librairie LinkedList. Effectivement, je l'avais fait, sans la mettre d
ans mes sources.

Non je l'ai bien téléchargée !

bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
/Users/christophe/Documents/Arduino/libraries/Servo/src/nrf52/Servo.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /Users/christophe/Documents/Arduino/libraries/Servo/src/sam/Servo.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /Users/christophe/Documents/Arduino/libraries/Servo/src/samd/Servo.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /Users/christophe/Documents/Arduino/libraries/Servo/src/stm32f4/Servo.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
/Applications/Arduino.app/Contents/Java/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=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/christophe/Documents/Arduino/libraries/LinkedList -I/Users/christophe/Documents/Arduino/libraries/Servo/src /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/sketch/Alim_analogique.ino.cpp -o /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/preproc/ctags_target_for_gcc_minus_e.cpp -DARDUINO_LIB_DISCOVERY_PHASE
/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/wr/n541lv754tnb27lc3_w3pr7r0000gn/T/arduino_build_122676/preproc/ctags_target_for_gcc_minus_e.cpp
Compilation du croquis...

Erreur de compilation pour la carte Arduino Uno

Matou

  • Newbie
  • *
  • Messages: 9
    • Voir le profil
J'ai aussi Servo_MG qui utilise Servo. Servo_MG n'est pas utilisé dans ce projet, mais est présent dans les sources. Serait-ce la raison ?

bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
J'ai bien un problème avec LinkedList. L'exemple donné avec la biblio ne compile pas non plus !


In file included from /Users/christophe/Documents/Arduino/libraries/LinkedList/examples/ClassList/ClassList.pde:12:0:
/Users/christophe/Documents/Arduino/libraries/LinkedList/LinkedList.h: In instantiation of 'ListNode<T>* LinkedList<T>::getNode(int) [with T = Animal*]':
/Users/christophe/Documents/Arduino/libraries/LinkedList/LinkedList.h:314:28:   required from 'T LinkedList<T>::get(int) [with T = Animal*]'
/Users/christophe/Documents/Arduino/libraries/LinkedList/examples/ClassList/ClassList.pde:65:30:   required from here
/Users/christophe/Documents/Arduino/libraries/LinkedList/LinkedList.h:160:9: error: cannot convert 'bool' to 'ListNode<Animal*>*' in return
  return false;
         ^~~~~
Utilisation de la bibliothèque LinkedList version 1.2.3 dans le dossier: /Users/christophe/Documents/Arduino/libraries/LinkedList
exit status 1
Erreur de compilation pour la carte Arduino Uno

bobyAndCo

  • Global Moderator
  • Hero Member
  • *****
  • Messages: 904
  • HO avec DCC++
    • Voir le profil
Cette librairie n'a eu aucun update depuis 2 ans ! le problème a été reporté sur le Git en février 2020 mais aucun correctif depuis !

Matou

  • Newbie
  • *
  • Messages: 9
    • Voir le profil
Effectivement, j'ai une note dans un fichier :
LinkedList modification : remplacement de false par NULL en ligne 160 de LinkedList.h
J'ai donc dû avoir cette erreur au tout début, te je l'ai contournée avec ce changement.

AmadeusHF

  • Full Member
  • ***
  • Messages: 204
    • Voir le profil
Le code compile en corrigeant l'erreur de la lib : return NULL; au lieu de return false;
Il y a une autre erreur dans votre code :

Votre fonction setup() appelle DebutEtatInit() à la dernière ligne.

Or dans votre source, la fonction DebutEtatInit() est définie APRES le code de setup()

Au moment de compiler setup() le compilateur ne connait pas le symbole DebutEtatInit() et ça pose probleme.
L'ordre d'écriture des fonctions dans un source, en compilation stricte, a une importance, aussi je vous invite à corriger cette erreur.

Une fois ces deux points réglés j'arrive à compiler de mon coté (mais il reste beaucoup de warnings inquiétants....)

5:43:06 Build Finished. 0 errors, 32 warnings. (took 2s.519ms)
Au délà de ces remarques, prenez en compte que l'utilisation dynamique de la mémoire n'est pas spécialement une bonne idée sur un "petit arduino". Avec ses 2 Ko de RAM, un NANO / UNO ne dispose que de très peu d'espace, qu'il doit consacrer à la pile et au "heap".

La fragmentation de ce dernier intervient rapidement et sans un peu d'air, le heap manager n'est pas capable de gérer.

L'utilisation de structures complexes utilisant beaucoup de pointeurs amène à une consommation de mémoire supplémentaire pour les liaisons inter-objets qui vient rapidement à bout de ce faible espace mémoire.

J'ai moi-même éprouvé cette limite récemment : une partie de code que j'avais écrite, qui utilisait des structures très dynamiques, fonctionnait bien sur MEGA (8 Ko de RAM) mais venait rapidement à bout d'un UNO, non parce que je consommais trop de données, mais parce que les allocations / suppression d'objets aboutissaient rapidement à un heap fragmenté saturé. Je n'avais pas ce problème sur le MEGA, et pourtant mon usage global de la RAM restait sous la barre des 1.5 Ko.

A voir si l'usage de structures telles que des listes chaînées est opportune pour votre code...S'il s'agit de stocker peu d'objets, un tableau a peu près bien dimensionné est peut-être préférable.
Sébastien.
La perfection est un chemin, non un but...