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 Capacitive Touch Macro Keypad por Kevin no Printables

Descrição

This is a multi-material print that uses a conductive filament and an insulating filament. All you need is an Adafruit circuit playground and 8 screws. I have also included some basic code to help you get started (adapted from Carter Nelson's code, link below).
[https://www.arduino.cc/en/Reference/MouseKeyboard](https://www.arduino.cc/en/Reference/MouseKeyboard)

It won't let me upload the .ino file so here is a copy of my code:

////////////////////////////////////////////////////////////////////////////
// Circuit Playground Capacitive Touch Tones
//
// Send keyboard and mouse events for each touch pad.
// [https://www.arduino.cc/en/Reference/MouseKeyboard](https://www.arduino.cc/en/Reference/MouseKeyboard)
//
// Author: Carter Nelson
// MIT License ([https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT))

include <Adafruit_CircuitPlayground.h>

include <Keyboard.h>

define CAP_THRESHOLD 100

define DEBOUNCE 250

uint8_t pads[] = {3, 2, 0, 1, 12, 6, 9, 10};
uint8_t numberOfPads = sizeof(pads)/sizeof(uint8_t);

boolean emulatorActive = false;

uint32_t colors[] = {
0xFF0000,
0xff9900,
0xccff00,
0x33ff00,
0x00ff66,
0x00ffff,
0x0066ff,
0x3300ff,
0xff0099,
0x000000
};

int colorIndex;
int startIndex;

void action1(){
ctrlalt('q');
}
void action2(){
ctrlalt('w');
}
void action3(){
ctrlalt('e');
}
void action4(){
ctrlalt('r');
}
void action5(){
ctrlalt('t');
}
void action6(){
ctrlalt('y');
}
void action7(){
ctrlalt('u');
}
void action8(){
ctrlalt(8);
}

void ctrlalt(int x){
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(char(x));
delay(100);
Keyboard.releaseAll();
}

////////////////////////////////////////////////////////////////////////////
void takeAction(uint8_t pad) {
Serial.print("PAD "); Serial.println(pad);
switch (pad) {
case 3:
action1();
break;
case 2:
action2();
break;
case 0:
action3();
break;
case 1:
action4();
break;
case 12:
action5();
break;
case 6:
action6();
break;
case 9:
action7();
break;
case 10:
action8();
break;
default:
Serial.println("Error");
}
}

////////////////////////////////////////////////////////////////////////////
boolean capButton(uint8_t pad) {
// Check if capacitive touch exceeds threshold.
if (CircuitPlayground.readCap(pad) > CAP_THRESHOLD) {
return true;
} else {
return false;
}
}

////////////////////////////////////////////////////////////////////////////
void sendKey(char key) {
Keyboard.press(key);
Keyboard.releaseAll();
}

////////////////////////////////////////////////////////////////////////////
void setup() {
CircuitPlayground.begin();

// Make it bright!
CircuitPlayground.setBrightness(255);

// Start at the beginning
startIndex = 0;

// Initialize serial.
Serial.begin(9600);

// Initialize Circuit Playground library.
CircuitPlayground.begin();
}

////////////////////////////////////////////////////////////////////////////
void loop() {
// Indicate emulator status on red LED.
CircuitPlayground.redLED(emulatorActive);
CircuitPlayground.clearPixels();

// Loop through each pixel, setting their colors
colorIndex = startIndex;
for (int pixel=0; pixel<10; pixel++) {
CircuitPlayground.setPixelColor(pixel, colors[colorIndex]);
colorIndex++;
if (colorIndex > 9) colorIndex = 0;
}

// Increment start index into color array
startIndex++;

// Check value and reset if necessary
if (startIndex > 9) startIndex = 0;

//Checks the pads 20x for every Neopixel update
int tickRate = 20;
for (int i = 0; i < tickRate; i++){
// Check slide switch.
if (!CircuitPlayground.slideSwitch()) {

        //-----------| EMULATOR OFF |-------------
        if (emulatorActive) {
          Keyboard.end();
          emulatorActive = false;
        }

      } else {

        //-----------| EMULATOR ON |-------------
        if (!emulatorActive) {
          Keyboard.begin();
          emulatorActive = true;
        } 

        // Loop over every pad.
        for (int i=0; i<numberOfPads; i++) {

          // Check if pad is touched.
          if (capButton(pads[i])) {

            // Do something.
            takeAction(pads[i]);

            // But not too often.
            delay(DEBOUNCE);
          }
        }
      }
 

}
}

Printables

Capacitive Touch Macro Keypad

Publicado em 10 de dez de 2023

5
Curtidas
29
Downloads
Categoria Electronics
Tags
keyboard macropad circuitplayground
Licença Creative Commons — Attribution
Arquivos (2)
macrotouchpad3.sldprt 240.6 KB
macrotouchpad3_pads.sldprt 314.2 KB
Ver no Printables (abre em nova aba)