Schematic:
Code:
{
#include <Keyboard.h>
#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>
const int debounce = 100;
const int threshold = 500;
void setup()
{
CircuitPlayground.begin();
pinMode(CPlay_SLIDESWITCHPIN, INPUT_PULLUP);
pinMode(CPLAY_LEFTBUTTON, INPUT_PULLDOWN);
pinMode(CPLAY_RIGHTBUTTON, INPUT_PULLDOWN);
Keyboard.begin();
}
void loop()
{
if(digitalRead(CPLAY_LEFTBUTTON))
{
Keyboard.write('A');
delay(debounce);
}
if(digitalRead(CPLAY_RIGHTBUTTON))
{
Keyboard.write('D');
delay(debounce);
}
if(CircuitPlayground.readCap(A3) > threshold && digitalRead(CPLAY_SLIDESWITCHPIN))
{
Keyboard.write(' ');
delay(debounce);
}
Serial.print(CircuitPlayground.readCap(A3));
Serial.print("\t");
Serial.println(analogRead(A2));
}
Questions:
1: How would you implement a mechanic like charge jumping into a controller like this?
1: How would you implement a mechanic like charge jumping into a controller like this?
2: What do you think of the box design with the dice buttons? Is it creative enough or should I go with another idea?
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.