Problème et questions tm1637

Bonjour
je voudrai motoriser un objectif pour la photo astro
sauf que le logiciel arduino n'accepte pas la fonction

TM1637 tm(CLK,DIO);

voici mon code (il n'est encore pas terminé)

#include<AccelStepper.h>
#include<MultiStepper.h>
#include<TM1637.h>

int CLK = 2;
int DIO = 3;

TM1637 tm(CLK,DIO);

AccelStepper focale(AccelStepper::FULL4WIRE, 4, 6, 5, 7);
AccelStepper miseaupoint(AccelStepper::HALF4WIRE, 8, 9, 10, 11);



void setup() {

  Serial.begin(9600);
  
  focale.setMaxSpeed(2000);
  focale.setSpeed(0);
  miseaupoint.setMaxSpeed(2000);
  miseaupoint.setSpeed(0);

  tm.init();
  tm.set(1);

  while (!Serial);
  Serial.println("INITIALIZED,READY#");
  
}

void loop() {

  if (Serial.available() > 0) {
    //Received something
    String opcode = Serial.readStringUntil('#');
    boolean validOpcode=true;
    //Parse opcode
    if(opcode=="70mm"){
      tm.display(2,7);
      tm.display(3,0);
      
    }
    else if (opcode=="135mm"){
      tm.display(1,1);
      tm.display(2,3);
      tm.display(3,5);
      
    }
    else if(opcode=="200mm"){
      tm.display(1,2);
      tm.display(2,0);
      tm.display(3,0);
      
    }
    else if(opcode=="300mm"){
      tm.display(1,3);
      tm.display(2,0);
      tm.display(3,0);
    }
    else{
      validOpcode=false;
    }
    if(validOpcode){
      //Acknowledge valid command
      Serial.println("OK#");
    }
  } 

}

je me suis basé sur ce projet dans arduinocreate
https://create.arduino.cc/projecthub/ryanchan/tm1637-digit-display-arduino-quick-tutorial-ca8a93
une idée ???
merci :slightly_smiling_face: :wink:
cdt

quelle bibliothèque TM1637 avez vous installée ?

pouvez vous donner l'erreur exacte du compilateur?

essayez avec cette bibliothèque https://github.com/Seeed-Studio/Grove_4Digital_Display et

const int CLK = 6;
const int DIO = 7;
TM1637 tm1637(CLK, DIO);

je les ai installées toutes
voici le messaged'erreur

Arduino : 1.8.13 (Windows 10), Carte : "Arduino Micro"

arduino_sigma_70-300mm:8:18: error: no matching function for call to 'TM1637::TM1637(int&, int&)'

 TM1637 tm(CLK,DIO);

                  ^

In file included from C:\Users\XXXXXXX\Documents\Arduino\arduino_sigma_70-300mm\arduino_sigma_70-300mm.ino:3:0:

C:\Users\XXXXXXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:22:5: note: candidate: TM1637::TM1637()

     TM1637();

     ^~~~~~

C:\Users\XXXXXXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:22:5: note:   candidate expects 0 arguments, 2 provided

C:\Users\XXXXXXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:19:7: note: candidate: constexpr TM1637::TM1637(const TM1637&)

 class TM1637

       ^~~~~~

C:\Users\XXXXXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:19:7: note:   candidate expects 1 argument, 2 provided

C:\Users\XXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:19:7: note: candidate: constexpr TM1637::TM1637(TM1637&&)

C:\Users\XXXXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:19:7: note:   candidate expects 1 argument, 2 provided

C:\Users\XXXXX\Documents\Arduino\arduino_sigma_70-300mm\arduino_sigma_70-300mm.ino: In function 'void setup()':

arduino_sigma_70-300mm:24:11: error: no matching function for call to 'TM1637::init()'

   tm.init();

           ^

In file included from C:\Users\XXX\Documents\Arduino\arduino_sigma_70-300mm\arduino_sigma_70-300mm.ino:3:0:

C:\Users\XXXXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:24:10: note: candidate: void TM1637::init(uint8_t, uint8_t, uint8_t)

     void init(uint8_t clockPin, uint8_t dataPin, uint8_t digits = 6);

          ^~~~

C:\Users\XXXX\Documents\Arduino\libraries\TM1637_RT/TM1637.h:24:10: note:   candidate expects 3 arguments, 0 provided

arduino_sigma_70-300mm:25:6: error: 'class TM1637' has no member named 'set'

   tm.set(1);

      ^~~

C:\Users\XXXXX\Documents\Arduino\arduino_sigma_70-300mm\arduino_sigma_70-300mm.ino: In function 'void loop()':

arduino_sigma_70-300mm:40:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(2,7);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:41:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(3,0);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:45:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(1,1);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:46:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(2,3);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:47:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(3,5);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:51:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(1,2);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:52:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(2,0);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:53:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(3,0);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:57:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(1,3);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:58:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(2,0);

          ^~~~~~~

          displayRaw

arduino_sigma_70-300mm:59:10: error: 'class TM1637' has no member named 'display'; did you mean 'displayRaw'?

       tm.display(3,0);

          ^~~~~~~

          displayRaw

Plusieurs bibliothèque trouvées pour "TM1637.h"

Utilisé : C:\Users\XXXXX\Documents\Arduino\libraries\TM1637_RT

Non utilisé : C:\Users\XXXX\Documents\Arduino\libraries\Grove_4-Digit_Display

Non utilisé : C:\Users\XXXX\Documents\Arduino\libraries\TM1637_Driver

exit status 1

no matching function for call to 'TM1637::TM1637(int&, int&)'



Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.

cdt

je les ai installées toutes

virez les toutes et installez uniquement celle ci

ok je vais essayer

ça marche
merci beaucoup

aussi tant qu'on parle des ecrans oled
comment puis-je afficher quelque chose en permanence
je m'explique :wink: :slight_smile:
quant je dis à l'arduino de déplacer la focale de l'objectif sur 135mm par exemple
comment laisser 135 affiché sur l'écran ???
merci
cdt

en n'appelant rien qui affiche sur l'écran ? :slight_smile:

Si, mais les 135 ne restent pas affichés
comment faire pour que 135 reste affiché
merci
cdt

postez le code

#include<AccelStepper.h>
#include<MultiStepper.h>
#include<TM1637.h>

const int CLK = 6;
const int DIO = 7;

TM1637 tm(CLK, DIO);

AccelStepper focale(AccelStepper::FULL4WIRE, 2, 3, 4, 5);
AccelStepper miseaupoint(AccelStepper::HALF4WIRE, 8, 9, 10, 11);



void setup() {

  Serial.begin(9600);
  
  focale.setMaxSpeed(2000);
  focale.setSpeed(0);
  miseaupoint.setMaxSpeed(2000);
  miseaupoint.setSpeed(0);

  tm.init();
  tm.set(1);

  while (!Serial);
  Serial.println("INITIALIZED,READY#");
  
}

void loop() {

  if (Serial.available() > 0) {
    //Received something
    String opcode = Serial.readStringUntil('#');
    boolean validOpcode=true;
    //Parse opcode
    if(opcode=="70mm"){
      tm.display(2,7);
      tm.display(3,0);
      
    }
    else if (opcode=="135mm"){
      tm.display(1,1);
      tm.display(2,3);
      tm.display(3,5);
      
    }
    else if(opcode=="200mm"){
      tm.display(1,2);
      tm.display(2,0);
      tm.display(3,0);
      
    }
    else if(opcode=="300mm"){
      tm.display(1,3);
      tm.display(2,0);
      tm.display(3,0);
      
    }
    else{
      validOpcode=false;
    }
    if(validOpcode){
      //Acknowledge valid command
      Serial.println("OK#");
    }
  } 

}

cdt

vous avez un lien vers votre afficheur ?

qu'est-ce que vous voyez si vous chargez ce code

#include<TM1637.h>

const int CLK = 6;
const int DIO = 7;

TM1637 tm(CLK, DIO);

void setup() {
  tm.init();
  tm.set(1);
  tm.display(1, 1);
  tm.display(2, 3);
  tm.display(3, 5);
}

void loop() {}