Knuckleheads Controller
Carlos Silva & Rebecca Catterton
The original concept for our design was to use a servo motor to determine how far the controller is opened or closed, but we quickly realized using a makeshift switch would be far more time and energy effective- plus less buggy to design. We ended up with a simple controller where we use the Adafruit accelerometer to determine tile motions and the aforementioned switch to determine the stretching vs squashing motion in the Knuckleheads game. The switch consists of two metal pieces, one standing in place deeper within the controller and one positioned on the end of the rightmost handle that touch when the player has squished the controller completely and signifies to the device to press the ‘down’ button, otherwise the ‘up’ button is automatically pressed down. The visual design of our original concept had a broader color palette and an image design that directly correlated to the game which we sadly didn’t have time to implement, but overall, our design remained relatively steadfast- the shape and movement are the same as when we first pitched it. We found the coding process relatively painless all things considered, running into only a few rough patches and bumps along the road while attempting to make our circuit behave as we imagined- but the building of the actual controller was a more frustrating process. We had to have multiple print jobs done in order to make the pieces the size and shapes we wanted, needing to edit everything along the way, and we struggled quite a bit with the more mechanical aspects of how our controller was meant to fit together- but in the end we got everything situated respectably. We would like feedback on ways we could make our design and internal wiring more efficient to our purposes, and we would welcome any opinions on the design of our controller.
Carlos handled the majority of the code, Rebecca handled the majority of the modeling, and we physically created the final controller together.
Circuit Schematic
#include <Adafruit_CircuitPlayground.h>#include <Adafruit_Circuit_Playground.h>#include <Keyboard.h>#define CURRENT_PIN 1const int inputPin = A3;void setup() {// put your setup code here, to run once://after we create the setup functionSerial.begin(9600);CircuitPlayground.begin();pinMode(CURRENT_PIN, INPUT);delay(500);//pinMode input for our electrical current (used for the stretch and squash)pinMode(inputPin, INPUT_PULLUP);}void loop() {// put your main code here, to run repeatedly:if (digitalRead(inputPin) == LOW) {Serial.println("Current detected! Pressing DOWN Key");Keyboard.press(KEY_DOWN_ARROW);Keyboard.release(KEY_UP_ARROW);} else {Serial.println("No current detected. Pressing UP Key");Keyboard.press(KEY_UP_ARROW);Keyboard.release(KEY_DOWN_ARROW);}float z = CircuitPlayground.motionZ();if (z<-8) {Serial.println("GOING DOWN! Pressing LEFT key");Keyboard.press(KEY_LEFT_ARROW);Keyboard.release(KEY_RIGHT_ARROW);}else {Serial.println("GOING UP! Pressing RIGHT key");Keyboard.press(KEY_RIGHT_ARROW);Keyboard.release(KEY_LEFT_ARROW);}delay(100);}
Video
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.