problème de compilation

#include "HID-Project.h"

//#define VOLUME
//#define KYBDLEDS
#define ZOOMBTNS


// Define Arduino pin numbers for buttons and LEDs
#define led 13

#ifdef VOLUME
#define ROTARY_A 5
#define ROTARY_B 6
#define ROTARY_C 7
#endif

#ifdef KYBDLEDS
#define CAPSLOCKLED 2
#define SCRLLOCKLED 3
#define NUMLOCKLED 4
#endif

#ifdef ZOOMBTNS
#define BTN1 8
#define BTN2 9
#define BTN3 10
#define BTN4 A0
#define BTN5 A1
#define BTN6 A2
#define NUMBUTTONS 6
int buttons[NUMBUTTONS] = {BTN1, BTN2, BTN3, BTN4, BTN5, BTN6};
unsigned long btntime[NUMBUTTONS];
boolean btnpress[NUMBUTTONS];
#endif

#ifdef VOLUME
boolean A, a, B, b, C, c;
#endif

char line[80];
unsigned long t;
int n;

void setup() {
//  Serial.begin(38400);
//  Serial.write("Starting...\n");
//  Serial.end();
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
#ifdef VOLUME
  pinMode(ROTARY_A, INPUT_PULLUP);
  pinMode(ROTARY_B, INPUT_PULLUP);
  pinMode(ROTARY_C, INPUT_PULLUP);
#endif
#ifdef KYBDLEDS
  pinMode(CAPSLOCKLED, OUTPUT);
  pinMode(SCRLLOCKLED, OUTPUT);
  pinMode(NUMLOCKLED, OUTPUT);

  // Flash the LEDs just to show we're in business
  digitalWrite(CAPSLOCKLED, HIGH); delay(200);
  digitalWrite(SCRLLOCKLED, HIGH); delay(200);
  digitalWrite(NUMLOCKLED, HIGH); delay(200);
  digitalWrite(CAPSLOCKLED, LOW); delay(200);
  digitalWrite(SCRLLOCKLED, LOW); delay(200);
  digitalWrite(NUMLOCKLED, LOW); delay(200);
#else
  for (int i=0; i < 3; i++) {
  digitalWrite(led, HIGH); delay(20);
  digitalWrite(led, LOW); delay(200);
  digitalWrite(led, HIGH); delay(20);
  digitalWrite(led, LOW); delay(200);
  digitalWrite(led, HIGH); delay(20);
  digitalWrite(led, LOW); delay(500);
  }
#endif

#ifdef ZOOMBTNS
  for (int i = 0; i < NUMBUTTONS; i++) {
    pinMode(buttons[i], INPUT_PULLUP);
    btntime[i] = 0;
    btnpress[i] = false;
  }
#endif
  
#ifdef VOLUME
  a = b = c = false;
#endif

#ifdef KYBDLEDS
  t = 0;
  n = 0;
#endif
#if defined(KYBDLEDS) || defined(ZOOMBTNS)
  BootKeyboard.begin();
#endif

#ifdef VOLUME
  Consumer.begin();
#endif

//  System.begin(); // For System functions
//  Gamepad.begin(); // For gamepad functions
//  Mouse.begin(); // For mouse functions
//  AbsoluteMouse.begin(); // For the Absolute Mouse

}

void loop() {
  int leds;
#ifdef VOLUME
  A = digitalRead(ROTARY_A) == LOW;
  B = digitalRead(ROTARY_B) == LOW;
  C = digitalRead(ROTARY_C) == LOW;
  if (A && !a) {
    if (B) {
      n++; if (n > 100) n = 100;
      Consumer.write(MEDIA_VOL_UP);
    }
    else {
      n--; if (n < 0) n = 0;
      Consumer.write(MEDIA_VOL_DOWN);
    }
//      sprintf(line, "%d\n", n);
//      Serial.write(line);
  }
  a = A;
  
  if (C && ! c) {
    Consumer.write(MEDIA_VOL_MUTE);
//      sprintf(line, "!\n");
//      Serial.write(line);
  }
  c = C;
#endif

#ifdef KYBDLEDS
  if (millis() > t + 10) {
    t = millis();
    leds = BootKeyboard.getLeds();
    if (leds & LED_CAPS_LOCK)
      digitalWrite(CAPSLOCKLED, HIGH);
    else
      digitalWrite(CAPSLOCKLED, LOW);
    if (leds & LED_SCROLL_LOCK)
      digitalWrite(SCRLLOCKLED, HIGH);
    else
      digitalWrite(SCRLLOCKLED, LOW);
    if (leds & LED_NUM_LOCK)
      digitalWrite(NUMLOCKLED, HIGH);
    else
      digitalWrite(NUMLOCKLED, LOW); 
  }
#endif

#ifdef ZOOMBTNS
  for (int i = 0; i < NUMBUTTONS; i++) {
    if (!digitalRead(buttons[i])) {
      // Button pressed (negative logic)
      if (btntime[i] == 0) {
        // Button has just been pressed
        btntime[i] = millis();
      }
      else {
        // Button is still pressed
        if (millis() - btntime[i] > 20 && !btnpress[i]) {
          // This is not just a glitch          
          btnpress[i] = true;
          // Now do your stuff!
          digitalWrite(led, HIGH);
          switch (i) {
#if 1
          case 0: // Alt-F2: Gallery view
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_F2);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 1: // Alt-F1: Speaker view
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_F1);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 2: // Alt-M: Mute all
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_M);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 3: // Alt-A: Mute self
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_A);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 4: // Alt-F: Full screen
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_F);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 5: // Alt-S: Share screen
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_S);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
#else
          case 0:
            BootKeyboard.write(KEY_0);
            break;
          case 1:
            BootKeyboard.write(KEY_1);
            break;
          case 2:
            BootKeyboard.write(KEY_2);
            break;
          case 3:
            BootKeyboard.write(KEY_3);
            break;
          case 4:
            BootKeyboard.write(KEY_4);
            break;
          case 5:
            BootKeyboard.write(KEY_5);
            break;
#endif
          }  
        }
      }
    }
    else {
      // Button not pressed
      if (btntime[i] != 0) {
        // Looks like it's just been released
        digitalWrite(led, LOW);
        btntime[i] = 0;
        btnpress[i] = false;
      }
    }
  }
#endif

}

Bonjour à tous,
j'aurais besoin de votre aide car je suis actuellement sur un projet assez complexe.
Ce projet est de réaliser un Stream Deck (boitier avec des raccourcis clavier) j'utilise donc un arduino pro micro.
Le problème que je rencontre est que lorsque je compile j'ai une erreur "SingleReport/SingleAbsoluteMouse.h"
Je suppose donc que c'est une erreur de bibliothèque. Mais quand je recherche sur intenet je ne trouve rien dutout
a part une bibliothèque SingleReport.h
Je l'ai donc essayé mais toujours la même erreur.
Si quelqu'un à déja eu ce problème ou si quelqu'un pourrais m'aider ce serait cool.
Merci d'avance et bonne soirée.

In file included from C:\lucas\StreamDeck pousser\sketch_jan23a\sketch_jan23a.ino:1:0:
HID-Project.h:39:10: fatal error: SingleReport/SingleAbsoluteMouse.h: No such file or directory
 #include "SingleReport/SingleAbsoluteMouse.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
SingleReport/SingleAbsoluteMouse.h: No such file or directory

Bonsoir

C'est dans ton ordinateur qu'il faut chercher !!

La première ligne de "ton" programme appelle la librairie HID-project , a-t-elle été correctement et complètement installée ? (elle est installable par le gestionnaire de Librairies)

Référence ici : GitHub - NicoHood/HID: Bring enhanced HID functions to your Arduino!

Elle contient plusieurs dossiers dont un dossier nommé SingleReport qui lui même contient le fichier SingleAbsoluteMouse.h et beaucoup d'autres....

effectivement c'était bien ca mais pour chaque bibliothèque il n'arrive pas à trouver son chemin tout seul. Le fichier est pourtant bien placé.
J'ai déja essayer avec les préférences mais sa ne change rien...

Tu l'as mise où ta librairie?

dans le même dossier que mon ficher arduino.ino

Tu devrais regarder ça

Voilà installer etc mais nouvelle erreur

In file included from sketch\HID-Project.h:39:0,

                 from C:\lucas\StreamDeck pousser\sketch_jan23a\sketch_jan23b\sketch_jan23b.ino:5:

sketch\SingleReport/SingleAbsoluteMouse.h:29:26: fatal error: HID-Settings.h: No such file or directory

 #include "HID-Settings.h"

                          ^

compilation terminated.

exit status 1
Erreur lors de la compilation.

Je suppose que c'est la bibliothèque "HID-Settings.h"
Mais elle est bien présente je l'ai même prise séparément avec le fichier mais rien ne fonctionne.
Quelqu'un à déja eu ce problème ?

Mon code de base

//
// Zoom Buttons
//

#include "HID-Project.h"
#include "SingleReport/SingleAbsoluteMouse.h"

//#define VOLUME
//#define KYBDLEDS
#define ZOOMBTNS


// Define Arduino pin numbers for buttons and LEDs
#define led 13

#ifdef VOLUME
#define ROTARY_A 5
#define ROTARY_B 6
#define ROTARY_C 7
#endif

#ifdef KYBDLEDS
#define CAPSLOCKLED 2
#define SCRLLOCKLED 3
#define NUMLOCKLED 4
#endif

#ifdef ZOOMBTNS
#define BTN1 8
#define BTN2 9
#define BTN3 10
#define BTN4 A0
#define BTN5 A1
#define BTN6 A2
#define NUMBUTTONS 6
int buttons[NUMBUTTONS] = {BTN1, BTN2, BTN3, BTN4, BTN5, BTN6};
unsigned long btntime[NUMBUTTONS];
boolean btnpress[NUMBUTTONS];
#endif

#ifdef VOLUME
boolean A, a, B, b, C, c;
#endif

char line[80];
unsigned long t;
int n;

void setup() {
//  Serial.begin(38400);
//  Serial.write("Starting...\n");
//  Serial.end();
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
#ifdef VOLUME
  pinMode(ROTARY_A, INPUT_PULLUP);
  pinMode(ROTARY_B, INPUT_PULLUP);
  pinMode(ROTARY_C, INPUT_PULLUP);
#endif
#ifdef KYBDLEDS
  pinMode(CAPSLOCKLED, OUTPUT);
  pinMode(SCRLLOCKLED, OUTPUT);
  pinMode(NUMLOCKLED, OUTPUT);

  // Flash the LEDs just to show we're in business
  digitalWrite(CAPSLOCKLED, HIGH); delay(200);
  digitalWrite(SCRLLOCKLED, HIGH); delay(200);
  digitalWrite(NUMLOCKLED, HIGH); delay(200);
  digitalWrite(CAPSLOCKLED, LOW); delay(200);
  digitalWrite(SCRLLOCKLED, LOW); delay(200);
  digitalWrite(NUMLOCKLED, LOW); delay(200);
#else
  for (int i=0; i < 3; i++) {
  digitalWrite(led, HIGH); delay(20);
  digitalWrite(led, LOW); delay(200);
  digitalWrite(led, HIGH); delay(20);
  digitalWrite(led, LOW); delay(200);
  digitalWrite(led, HIGH); delay(20);
  digitalWrite(led, LOW); delay(500);
  }
#endif

#ifdef ZOOMBTNS
  for (int i = 0; i < NUMBUTTONS; i++) {
    pinMode(buttons[i], INPUT_PULLUP);
    btntime[i] = 0;
    btnpress[i] = false;
  }
#endif
  
#ifdef VOLUME
  a = b = c = false;
#endif

#ifdef KYBDLEDS
  t = 0;
  n = 0;
#endif
#if defined(KYBDLEDS) || defined(ZOOMBTNS)
  BootKeyboard.begin();
#endif

#ifdef VOLUME
  Consumer.begin();
#endif

//  System.begin(); // For System functions
//  Gamepad.begin(); // For gamepad functions
//  Mouse.begin(); // For mouse functions
//  AbsoluteMouse.begin(); // For the Absolute Mouse

}

void loop() {
  int leds;
#ifdef VOLUME
  A = digitalRead(ROTARY_A) == LOW;
  B = digitalRead(ROTARY_B) == LOW;
  C = digitalRead(ROTARY_C) == LOW;
  if (A && !a) {
    if (B) {
      n++; if (n > 100) n = 100;
      Consumer.write(MEDIA_VOL_UP);
    }
    else {
      n--; if (n < 0) n = 0;
      Consumer.write(MEDIA_VOL_DOWN);
    }
//      sprintf(line, "%d\n", n);
//      Serial.write(line);
  }
  a = A;
  
  if (C && ! c) {
    Consumer.write(MEDIA_VOL_MUTE);
//      sprintf(line, "!\n");
//      Serial.write(line);
  }
  c = C;
#endif

#ifdef KYBDLEDS
  if (millis() > t + 10) {
    t = millis();
    leds = BootKeyboard.getLeds();
    if (leds & LED_CAPS_LOCK)
      digitalWrite(CAPSLOCKLED, HIGH);
    else
      digitalWrite(CAPSLOCKLED, LOW);
    if (leds & LED_SCROLL_LOCK)
      digitalWrite(SCRLLOCKLED, HIGH);
    else
      digitalWrite(SCRLLOCKLED, LOW);
    if (leds & LED_NUM_LOCK)
      digitalWrite(NUMLOCKLED, HIGH);
    else
      digitalWrite(NUMLOCKLED, LOW); 
  }
#endif

#ifdef ZOOMBTNS
  for (int i = 0; i < NUMBUTTONS; i++) {
    if (!digitalRead(buttons[i])) {
      // Button pressed (negative logic)
      if (btntime[i] == 0) {
        // Button has just been pressed
        btntime[i] = millis();
      }
      else {
        // Button is still pressed
        if (millis() - btntime[i] > 20 && !btnpress[i]) {
          // This is not just a glitch          
          btnpress[i] = true;
          // Now do your stuff!
          digitalWrite(led, HIGH);
          switch (i) {
#if 1
          case 0: // Alt-F2: Gallery view
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_F2);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 1: // Alt-F1: Speaker view
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_F1);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 2: // Alt-M: Mute all
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_M);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 3: // Alt-A: Mute self
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_A);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 4: // Alt-F: Full screen
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_F);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
          case 5: // Alt-S: Share screen
            BootKeyboard.press(KEY_LEFT_ALT);
            BootKeyboard.write(KEY_S);
            BootKeyboard.release(KEY_LEFT_ALT);
            break;
#else
          case 0:
            BootKeyboard.write(KEY_0);
            break;
          case 1:
            BootKeyboard.write(KEY_1);
            break;
          case 2:
            BootKeyboard.write(KEY_2);
            break;
          case 3:
            BootKeyboard.write(KEY_3);
            break;
          case 4:
            BootKeyboard.write(KEY_4);
            break;
          case 5:
            BootKeyboard.write(KEY_5);
            break;
#endif
          }  
        }
      }
    }
    else {
      // Button not pressed
      if (btntime[i] != 0) {
        // Looks like it's just been released
        digitalWrite(led, LOW);
        btntime[i] = 0;
        btnpress[i] = false;
      }
    }
  }
#endif

}

As-tu relancé l'IDE après avoir installé la bibliothèque?

effectivement j'avais oublier de relancer mais maintenant j'ai une erreur qui me dit que la version ide n'est pas compatible (si j'a bien compris)

cc1.exe: error: -fno-fat-lto-objects are supported only with linker plugin.

exit status 1
Erreur lors de la compilation.

Quelle carte utilises tu?

une pro micro

OK, j'avais peur que ta carte ne soit pas compatible de la bibliothèque, mais ce n'est pas le cas.
Je n'ai jamais vu ce type d'erreur...

Essaye de désinstaller et réinstaller l'IDE, pas la dernière version mais la précédente.

quelle version est la meilleur ?

Je ne sais pas mais j'évite d'utiliser la dernière au cas où elle soit boguée.

voilà j'ai installer la version 1.8.0
mais nouvelle erreur qui fait un bon 200 lignes mais tout ne passe pas dans la case code ci dessous.

C:\lucas\StreamDeck\sketch_jan23a\libraries\HID-Project\src/MultiReport/../HID-APIs/NKROKeyboardAPI.hpp:79:8: error: redefinition of 'size_t NKROKeyboardAPI::removeAll()'

 size_t NKROKeyboardAPI::removeAll(void)

        ^

In file included from sketch\SingleReport/../HID-APIs/NKROKeyboardAPI.h:64:0,

                 from sketch\SingleReport/SingleNKROKeyboard.h:30,

                 from sketch\HID-Project.h:52,

                 from C:\lucas\ctrl volume\F6CJ9NZIY4Q9HRP\F6CJ9NZIY4Q9HRP.ino:5:

sketch\SingleReport/../HID-APIs/NKROKeyboardAPI.hpp:79:8: note: 'virtual size_t NKROKeyboardAPI::removeAll()' previously defined here

 size_t NKROKeyboardAPI::removeAll(void)

        ^

exit status 1
Erreur de compilation pour la carte SparkFun Pro Micro

Ca, c'est une erreur liée à la bibliothèque. C'est bizarre...
removeAll apparaît dans plusieurs endroits de cette bibliothèque, très complexe, mais je vois

inline virtual size_t removeAll(void) override;

je suppose que ça devrait empêcher les conflits.

Mais le 'override' n'apparait pas dans ton listing d'erreur, donc tu n'as peut-être pas installé la dernière version.
Efface toute la bibliothèque et ré-installe là dans le répertoire libraries de ton répertoire arduino.
Tu vas sur cette page et tu cliques sur le rectangle vert (code) puis 'download zip'. Et tu copies le contenu du zip dans ce répertoire (après avoir ôté la version précédente)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.