You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, every button of this program work except for the play button
#include <Arduino.h>
#include <BleKeyboard.h>
BleKeyboard bleKeyboard;
const int volup = 26 ;
const int voldown = 27;
const int play = 12;
const int next = 14;
const int prev = 13;
const int ledPin = 15;
int luce = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(volup, INPUT_PULLDOWN);
pinMode(voldown, INPUT_PULLDOWN);
pinMode(play, INPUT_PULLDOWN);
pinMode(next, INPUT_PULLDOWN);
pinMode(prev, INPUT_PULLDOWN);
Serial.begin(115200);
Serial.println("Starting BLE work!");
bleKeyboard.begin();
}
void loop() {
luce = analogRead(4);
if(luce < 1000){
digitalWrite(ledPin, HIGH);
}
else{
digitalWrite(ledPin, LOW);
}
if(bleKeyboard.isConnected()) {
if(digitalRead(volup)== HIGH){
Serial.println("VOLUME UP");
bleKeyboard.write(KEY_MEDIA_VOLUME_UP);
delay(500);
}
else if(digitalRead(voldown)== HIGH){
Serial.println("VOLUME DOWN");
bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN);
delay(500);
}
else if(digitalRead(play)== HIGH){
Serial.println("PLAY or PAUSE the music");
bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE);
delay(500);
}
else if(digitalRead(next)== HIGH){
Serial.println("Next track");
bleKeyboard.write(KEY_MEDIA_NEXT_TRACK);
delay(500);
}
else if(digitalRead(prev)== HIGH){
Serial.println("previous track ");
bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK);
delay(500);
}
}
}
I tried it on my phone and on my pc (WINDOWS 11) but the play button is the only one which isn't working on both. It doesn't even get written in the serial monitor.
The text was updated successfully, but these errors were encountered:
Hi, every button of this program work except for the play button
I tried it on my phone and on my pc (WINDOWS 11) but the play button is the only one which isn't working on both. It doesn't even get written in the serial monitor.
The text was updated successfully, but these errors were encountered: