Home>

https://github.com/aerialist/webconf_onair_mute/blob/master/webconf_onair_mute/webconf_onair_mute.ino
I want to write this file to M5stickC, but I get an error and cannot write it.

sketch/webconf_onair_mute.ino.cpp.o: (.literal._Z5setupv + 0x10): undefined reference to `BleKeyboard :: begin ()'
sketch/webconf_onair_mute.ino.cpp.o: (.literal._Z14send_mute_zoomv + 0x4): undefined reference to `BleKeyboard :: press (unsigned char)'
sketch/webconf_onair_mute.ino.cpp.o: (.literal._Z14send_mute_zoomv + 0x8): undefined reference to `BleKeyboard :: releaseAll ()'
sketch/webconf_onair_mute.ino.cpp.o: (.literal._Z4loopv + 0x1c): undefined reference to `BleKeyboard :: isConnected ()'
sketch/webconf_onair_mute.ino.cpp.o: (.literal.startup._GLOBAL__sub_I_bleKeyboard + 0x10): undefined reference to `BleKeyboard :: BleKeyboard (std :: __ cxx11 :: basic_string<char, std :: char_traits<char>, std: : allocator<char >>, std :: __cxx11 :: basic_string<char, std :: char_traits<char>, std :: allocator<char >>, unsigned char)'
sketch/webconf_onair_mute.ino.cpp.o: (.literal.exit._GLOBAL__sub_D_bleKeyboard + 0x0): undefined reference to `vtable for BleKeyboard'
sketch/webconf_onair_mute.ino.cpp.o: In function `setup ()':
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:28: undefined reference to `BleKeyboard :: begin ()'
sketch/webconf_onair_mute.ino.cpp.o: In function `send_mute_zoom ()':
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:121: undefined reference to `BleKeyboard :: press (unsigned char)'
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:122: undefined reference to `BleKeyboard :: press (unsigned char)'
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:123: undefined reference to `BleKeyboard :: press (unsigned char)'
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:124: undefined reference to `BleKeyboard :: releaseAll ()'
sketch/webconf_onair_mute.ino.cpp.o: In function `send_mute_webex ()':
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:133: undefined reference to `BleKeyboard :: press (unsigned char)'
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:135: undefined reference to `BleKeyboard :: press (unsigned char)'
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:136: undefined reference to `BleKeyboard :: releaseAll ()'
sketch/webconf_onair_mute.ino.cpp.o: In function `loop ()':
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:45: undefined reference to `BleKeyboard :: isConnected ()'
sketch/webconf_onair_mute.ino.cpp.o: In function `_GLOBAL__sub_I_bleKeyboard':
/home/kalon/Arduino/webconf_onair_mute/webconf_onair_mute.ino:17: undefined reference to `BleKeyboard :: BleKeyboard (std :: __ cxx11 :: basic_string<char, std :: char_traits<char>, std :: allocator<char >>, std :: __ cxx11 :: basic_string<char, std :: char_traits<char>, std :: allocator<char >>, unsigned char)'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board M5Stick-C.
Corresponding source code

https://github.com/aerialist/webconf_onair_mute/blob/master/webconf_onair_mute/webconf_onair_mute.ino

#include<M5StickC.h>#include "BleKeyboard.h"
BleKeyboard bleKeyboard;
enum ConfSystem {
  zoom = 0,
  webex
} conf;
int n_conf = 2;
bool on_air;
void setup () {
  M5.begin ();
  bleKeyboard.begin ();
  Serial.println ("Webconf Mute button");
  Serial.println ("Push Button A (M5) to toggle MUTE");
  Serial.println ("Push Button B to switch Zoom or WebEx");
  M5.Lcd.setRotation (3);// BtnA is left side to LCD
  // default
  conf = zoom;
  on_air = true;update_display ();
}
void loop () {
  M5.update ();
  if (M5.BtnA.wasPressed ()) {
    Serial.println ("BtnA was pressed");
    if (bleKeyboard.isConnected ()) {
      on_air =! on_air;
      if (conf == zoom) {
        send_mute_zoom ();
      }
      else if (conf == webex) {
        send_mute_webex ();
      }
    }
    else {
      Serial.println ("BLE is not connected");
    }
    update_display ();
  }
  if (M5.BtnB.wasPressed ()) {
    Serial.println ("BtnB was pressed");
    conf = ConfSystem ((conf + 1)% n_conf);
    Serial.print ("New ConfSystem:");
    Serial.println (conf);
    update_display ();
  }
  delay (10);
}
void update_display () {
  Serial.println ("update_display");
  Serial.print ("On air ?:");
  Serial.println (on_air);
  if (on_air) {
    show_onair ();
  }
  else {
    show_inmute ();
  }
}
void show_onair () {
  M5.Lcd.fillScreen (TFT_RED);
  M5.Lcd.setTextColor (TFT_WHITE, TFT_RED);
  M5.Lcd.setTextSize (3);
  M5.Lcd.setTextDatum (MC_DATUM);
  M5.Lcd.drawString ("ON AIR", 80,40);
  M5.Lcd.setTextSize (2);
  M5.Lcd.setTextDatum (BR_DATUM);
  if (conf == zoom) {M5.Lcd.drawString ("ZOOM", 158,78);
  }
  else if (conf == webex) {
    M5.Lcd.drawString ("WebEx", 158,78);
  }
}
void show_inmute () {
  M5.Lcd.fillScreen (TFT_DARKGREY);
  M5.Lcd.setTextColor (TFT_WHITE, TFT_DARKGREY);
  M5.Lcd.setTextSize (3);
  M5.Lcd.setTextDatum (MC_DATUM);
  M5.Lcd.drawString ("Muted ...", 80,40);
  M5.Lcd.setTextSize (2);
  M5.Lcd.setTextDatum (BR_DATUM);
  if (conf == zoom) {
    M5.Lcd.drawString ("ZOOM", 158,78);
  }
  else if (conf == webex) {
    M5.Lcd.drawString ("WebEx", 158,78);
  }
}
void send_mute_zoom () {
  // https://support.zoom.us/hc/en-us/articles/205683899-Hot-Keys-and-Keyboard-Shortcuts-for-Zoom
  // Command (⌘) + Shift + A: Mute/unmute audio
  Serial.println ("Toggle mute on zoom");
  bleKeyboard.press (KEY_LEFT_GUI);
  bleKeyboard.press (KEY_LEFT_SHIFT);
  bleKeyboard.press (65);// "A"
  delay (100);
  bleKeyboard.releaseAll ();
}
void send_mute_webex () {
  // https://www.cisco.com/c/en/us/td/docs/collaboration/CWMS/2_5/b_manage_meetings/b_manage_meetings_chapter_0100.html
  // Ctrl + M Mute or unmute yourself
  Serial.println ("Toggle mute on WebEx");
  //bleKeyboard.press (KEY_LEFT_CTRL);
  bleKeyboard.press (KEY_LEFT_GUI);
  //bleKeyboard.press (KEY_LEFT_SHIFT);
  bleKeyboard.press (77);// "M"
  delay (100);
  bleKeyboard.releaseAll ();
}
What I tried

I put BleKeyboard.h and BleConnectionStatus.h in the same directory as webconf_onair_mute.ino.
We have included ESP32-BLE-Keyboard.zip according to the Instalattion of https://github.com/T-vK/ESP32-BLE-Keyboard.

Supplementary information (FW/tool version, etc.)

Lubuntu 20.04
Arduino IDE 1.8.13