Ir para conteúdo
3DFinder
Entrar

Você está no 3DFinder

Buscamos em Thingiverse, MakerWorld e Printables ao mesmo tempo para te dar o melhor de cada uma.

Buscar mais como este
Modelo 3D 4-Button Macro Box por Drakonis3d no Thingiverse

Descrição

Made this macro board for my wife to spam chat in Rocket League.

Parts used: KEYESTUDIO Pro Micro https://www.amazon.ca/dp/B07J55YWKZ/ref=cm_sw_em_r_mt_dp_U_6LTVEbVKYXZDF

16mm Automotive Switches https://www.amazon.ca/dp/B06XG9ZBY4/ref=cm_sw_em_r_mt_dp_U_tNTVEbS1HXMFV

4 x 10k resistors.


Printing / Assembly

Everything is sleeved to fit together, you won't need the nut on the switches and the body will pressure fit in. Make sure your electronics are solid before you tuck it in as it is difficult to take apart.

I did not include standoffs for the Arduino, when fitting I positioned the board and hot glued it in place with the cable. You'll want to permanently affix the cable to prevent it detaching.


Code / Usage

I have this set up to receive 4 lines to fill the string array separated by /n. I'm using CoolTerm to send text files over serial. Four lines will populate the array.

Ie. Macros.txt would have these lines:

GG Well Played Random harassment message Random congratulatory message

Code:


#include "Keyboard.h"
int button1 = 2;
int button2 = 4;
int button3 = 7;
int button4 = 8;
bool pushed1;
bool pushed2;
bool pushed3;
bool pushed4;
String userinput[4] = ("Macro1", "Macro2", "Macro3", "Macro4");
int currentMacro = 0;

void setup() {
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(button3, INPUT);
  pinMode(button4, INPUT);
  Serial.begin(9600);
  delay(2000);
}

void loop() 
{
  serialupdate();
  pushed1 = digitalRead(button1);
  pushed2 = digitalRead(button2);
  pushed3 = digitalRead(button3);
  pushed4 = digitalRead(button4);
  delay(100);
  
  if (pushed1 == HIGH){
    Serial.println("Button 1");
    currentMacro = 0;
    keyprint();
  }
    
  if (pushed2 == HIGH){
    Serial.println("Button 2");
    currentMacro = 1;
    keyprint();
  }
    
  if (pushed3 == HIGH){
    Serial.println("Button 3");
    currentMacro = 2;
    keyprint();
  }
    
  if (pushed4 == HIGH){
    Serial.println("Button 4");
    currentMacro = 3;
    keyprint();
  }
  
  else{
    Serial.println("Low");
    delay(100);  
}
}


void serialupdate(){               //Refresh macros if serial commands come in
    if(Serial.available()){
    userinput[0] = Serial.readStringUntil('\n');
    Serial.println("Macro changed to: " + userinput[0]); 
    userinput[1] = Serial.readStringUntil('\n');
    Serial.println("Macro2 changes to: " + userinput[1]);
    userinput[2] = Serial.readStringUntil('\n');
    Serial.println("Macro3 changed to: " + userinput[2]);
    userinput[3] = Serial.readStringUntil('\n');
    Serial.println("Macro4 changed to: " + userinput[3]);
    }
}

void keyprint(){
      Keyboard.begin();
      Keyboard.print("t");
      delay(100);
      Keyboard.print(userinput[currentMacro]);
 //     Serial.println("True");
      Serial.println("Received 1");
      delay(100);
      Keyboard.press(KEY_RETURN);
      delay(100);
      Keyboard.releaseAll();
      Keyboard.end();
      }
Thingiverse

4-Button Macro Box

18
Curtidas
0
Downloads
17
Coleções
Tags
arduino arduino micro arduino micro pro macro macropad usb
Licença Creative Commons - Attribution
Ver no Thingiverse (abre em nova aba)