So I made a little macro pad that has 6 keys on it an Arduino pro micro and an OLED screen, its essentially a mini stream deck. it works flawlessly as a music controller setup for Spotify on my pc using the F13-F18 keys. currently, it's connected with USB to my pc but I was wondering what the best way to make it wireless is and how? I'm guessing there has to be a master/slave thing going on between the Arduino and have one in the pad with a battery and wireless module and have the other Arduino with a wireless module to receive the inputs and then tell the pc through USB. I'm also curious to know what the best course of action would be because my pc also has wifi and Bluetooth built-in so is there a way to use this as a Bluetooth HID device without another Arduino plugged into the pc? If I could get any help figuring this out that would be awesome!
Thanks!
here's my code, it works I just don't know what to do to make it work wirelessly
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Mouse.h>
#include <Keyboard.h>
#include <SPI.h>
#include <Wire.h>
#define LUp 4
#define Up 5
#define RUp 6
#define Left 7
#define Down 8
#define Right 9
#define LedData 10
#define Switch 18
#define OLED_RESET 4
#define NUMFALKES 10
#define XPOS 0
#define YPOS 1
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
boolean OledClear = true;
boolean pause_play = 0;
Adafruit_SSD1306 display(OLED_RESET);
void setup() {
pinMode (LUp, INPUT_PULLUP);
pinMode (Up, INPUT_PULLUP);
pinMode (RUp, INPUT_PULLUP);
pinMode (Left, INPUT_PULLUP);
pinMode (Down, INPUT_PULLUP);
pinMode (Right, INPUT_PULLUP);
pinMode (Switch, INPUT_PULLUP);
Keyboard.begin();
Mouse.begin();
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
}
void loop() {
if (digitalRead(Switch) == HIGH)
{
//Bottom Left
if (digitalRead(Up) == LOW)
{
Keyboard.press(KEY_F13);
VolDown();
}
if (digitalRead(Up) == HIGH)
{
Keyboard.release(KEY_F13);
}
//Top Right
if (digitalRead(Down) == LOW)
{
Keyboard.press(KEY_F14);
Next();
}
if (digitalRead(Down) == HIGH)
{
Keyboard.release(KEY_F14);
}
//Bottom Right
if (digitalRead(Right) == LOW)
{
Keyboard.press(KEY_F15);
VolUp();
}
if (digitalRead(Right) == HIGH)
{
Keyboard.release(KEY_F15);
}
//Bottom Mid
if (digitalRead(Left) == LOW)
{
Keyboard.press(KEY_F16);
Mute();
}
if (digitalRead(Left) == HIGH)
{
Keyboard.release(KEY_F16);
}
//Top Mid
if (digitalRead(RUp) == LOW)
{
Keyboard.press(KEY_F17);
pause_play = !pause_play;
Pause();
delay(100);
}
if (digitalRead(RUp)==HIGH)
{
Keyboard.release(KEY_F17);
}
//Top Left
if (digitalRead(LUp) == LOW)
{
Keyboard.press(KEY_F18);
Prev();
}
if (digitalRead(LUp) == HIGH)
{
Keyboard.release(KEY_F18);
}
}
}
void Next()
{
display.clearDisplay();
display.setCursor(0, 0);
display.println("---------------------");
display.println(" |Next|");
display.println(" |Song|");
display.println("---------------------");
display.display();
if (pause_play == 1)
{
pause_play = !pause_play;
}
else
{
Keyboard.press(KEY_F14);
}
}
void Prev()
{
display.clearDisplay();
display.setCursor(0, 0);
display.println("---------------------");
display.println(" |Prev|");
display.println(" |Song|");
display.println("---------------------");
display.display();
if (pause_play == 1)
{
pause_play = !pause_play;
}
else
{
Keyboard.press(KEY_F18);
}
}
void Pause()
{
if(pause_play == 0)
{
display.clearDisplay();
display.setCursor(0, 0);
display.println("---------------------");
display.println(" |Play|");
display.println(" |Song|");
display.println("---------------------");
display.display();
}
else
{
display.clearDisplay();
display.setCursor(0, 0);
display.println("---------------------");
display.println(" |Pause|");
display.println(" |Song |");
display.println("---------------------");
display.display();
delay(500);
}
}
void VolUp()
{
display.clearDisplay();
display.setCursor(0, 0);
display.println("---------------------");
display.println(" |Volume|");
display.println(" |Up |");
display.println("---------------------");
display.display();
}
void VolDown()
{
display.clearDisplay();
display.setCursor(0, 0);
display.println("---------------------");
display.println(" |Volume|");
display.println(" |Down |");
display.println("---------------------");
display.display();
}
void Mute()
{
display.clearDisplay();
display.setCursor(0, 0);
display.println("---------------------");
display.println(" |Music|");
display.println(" |Muted|");
display.println("---------------------");
display.display();
}