#esp32做PPT翻页器
顾名思义就是一个PPT的翻页器,其中按键为低电平触发,最好给引脚做一个上拉
相关库的链接:https://gitcode.net/mirrors/T-vK/ESP32-BLE-Keyboard?utm_source=csdn_github_accelerator
#include<BleKeyboard.h>
BleKeyboard bleKeyboard("panpan","espressif",95);
//panpan是蓝牙的名字
void setup(){
Serial.begin(115200);
Serial.println("the demo begin");
pinMode(18,INPUT);
pinMode(19,INPUT);
bleKeyboard.begin();
}
void loop(){
if(bleKeyboard.isConnected()){
if(!digitalRead(18)) {
while(!digitalRead(18));
Serial.println("翻下页");
bleKeyboard.write(KEY_RIGHT_ARROW);
}
//翻页按键分别是18和19
if(!digitalRead(19)) {
while(!digitalRead(19));
Serial.println("翻上页");
bleKeyboard.write(KEY_LEFT_ARROW);
}
}
}