前提・実現したいこと
https://github.com/aerialist/webconf_onair_mute/blob/master/webconf_onair_mute/webconf_onair_mute.ino
こちらのファイルをM5stickCに書き込みたいのですが、エラーが出て書き込みできません。
発生している問題・エラーメッセージ
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.
該当のソースコード
Arduino
1#include <M5StickC.h> 2#include "BleKeyboard.h" 3 4BleKeyboard bleKeyboard; 5 6enum ConfSystem { 7 zoom = 0, 8 webex 9} conf; 10int n_conf = 2; 11bool on_air; 12 13void setup() { 14 M5.begin(); 15 bleKeyboard.begin(); 16 17 Serial.println("Webconf Mute button"); 18 Serial.println("Push Button A (M5) to toggle MUTE"); 19 Serial.println("Push Button B to switch Zoom or WebEx"); 20 M5.Lcd.setRotation(3); // BtnA is left side to LCD 21 22 // default 23 conf = zoom; 24 on_air = true; 25 update_display(); 26} 27 28void loop() { 29 M5.update(); 30 31 if(M5.BtnA.wasPressed()){ 32 Serial.println("BtnA was pressed"); 33 if(bleKeyboard.isConnected()){ 34 on_air = !on_air; 35 if(conf==zoom){ 36 send_mute_zoom(); 37 } 38 else if(conf==webex){ 39 send_mute_webex(); 40 } 41 } 42 else { 43 Serial.println("BLE is not connected"); 44 } 45 update_display(); 46 } 47 48 if(M5.BtnB.wasPressed()){ 49 Serial.println("BtnB was pressed"); 50 conf = ConfSystem((conf+1) % n_conf); 51 Serial.print("New ConfSystem: "); 52 Serial.println(conf); 53 update_display(); 54 } 55 delay(10); 56} 57 58void update_display(){ 59 Serial.println("update_display"); 60 Serial.print("On air?: "); 61 Serial.println(on_air); 62 if(on_air){ 63 show_onair(); 64 } 65 else { 66 show_inmute(); 67 } 68} 69 70void show_onair(){ 71 M5.Lcd.fillScreen(TFT_RED); 72 M5.Lcd.setTextColor(TFT_WHITE, TFT_RED); 73 M5.Lcd.setTextSize(3); 74 M5.Lcd.setTextDatum(MC_DATUM); 75 M5.Lcd.drawString("ON AIR",80,40); 76 77 M5.Lcd.setTextSize(2); 78 M5.Lcd.setTextDatum(BR_DATUM); 79 if(conf==zoom){ 80 M5.Lcd.drawString("ZOOM",158,78); 81 } 82 else if (conf==webex){ 83 M5.Lcd.drawString("WebEx", 158,78); 84 } 85} 86 87void show_inmute(){ 88 M5.Lcd.fillScreen(TFT_DARKGREY); 89 M5.Lcd.setTextColor(TFT_WHITE, TFT_DARKGREY); 90 M5.Lcd.setTextSize(3); 91 M5.Lcd.setTextDatum(MC_DATUM); 92 M5.Lcd.drawString("Muted...",80,40); 93 94 M5.Lcd.setTextSize(2); 95 M5.Lcd.setTextDatum(BR_DATUM); 96 if(conf==zoom){ 97 M5.Lcd.drawString("ZOOM",158,78); 98 } 99 else if (conf==webex){ 100 M5.Lcd.drawString("WebEx", 158,78); 101 } 102} 103 104void send_mute_zoom(){ 105 // https://support.zoom.us/hc/en-us/articles/205683899-Hot-Keys-and-Keyboard-Shortcuts-for-Zoom 106 // Command(⌘)+Shift+A: Mute/unmute audio 107 Serial.println("Toggle mute on zoom"); 108 bleKeyboard.press(KEY_LEFT_GUI); 109 bleKeyboard.press(KEY_LEFT_SHIFT); 110 bleKeyboard.press(65); // "A" 111 delay(100); 112 bleKeyboard.releaseAll(); 113} 114 115void send_mute_webex(){ 116 // https://www.cisco.com/c/en/us/td/docs/collaboration/CWMS/2_5/b_manage_meetings/b_manage_meetings_chapter_0100.html 117 // Ctrl+M Mute or unmute yourself 118 Serial.println("Toggle mute on WebEx"); 119 //bleKeyboard.press(KEY_LEFT_CTRL); 120 bleKeyboard.press(KEY_LEFT_GUI); 121 //bleKeyboard.press(KEY_LEFT_SHIFT); 122 bleKeyboard.press(77); // "M" 123 delay(100); 124 bleKeyboard.releaseAll(); 125}
試したこと
BleKeyboard.hとBleConnectionStatus.hをwebconf_onair_mute.inoと同じディレクトリに入れました。
https://github.com/T-vK/ESP32-BLE-KeyboardのInstalattionに従って、ESP32-BLE-Keyboard.zipをインクルードしました。
補足情報(FW/ツールのバージョンなど)
Lubuntu20.04
Arduino IDE 1.8.13
回答1件
あなたの回答
tips
プレビュー