Description:
Our controller design is created to work with the game Sort the Court on Itch.io, putting you very literally in the role of the King or Queen of the land by crowning you as royalty. Our design uses the BNO055 to track the motion of a player’s head to output yes and no inputs in-game depending on whether the player nods their head for yes or shakes their head for no. There’s also a knob on the side which can be turned to start and stop the controller to keep it from sending inputs while putting it on or taking it off. This controller is easy to identify as a head piece due to the design resembling that of a crown with a hollow underside for the head of any player to fit into. Sort the Court is played by using Y and N on your keyboard to control your character and tell your subjects yes or no in a very easy and simple to understand method. A headpiece for this game allows players to easily understand that the controller relates to the head, which would lead to the understanding that the controller tracks something to do with movements the head would make. With the added context of the game, making yes and no motions to say yes and no in-game is the most logical conclusion. We also have a plastic gemstone in the crown which allows players to know which direction the crown should be facing while on their head. Between the design of our controller being a physical crown and the motions required to send inputs to the game being yes and no motions with your head, our controller design allows Sort the Court’s simple gameplay to feel immersive by placing the player quite literally in the seat of royalty.
Schematic:
#include <Wire.h>#include <Adafruit_Sensor.h>#include <Adafruit_BNO055.h>#include <utility/imumaths.h>
#include <Keyboard.h>#include <KeyboardLayout.h>#include <Keyboard_da_DK.h>#include <Keyboard_de_DE.h>#include <Keyboard_es_ES.h>#include <Keyboard_fr_FR.h>#include <Keyboard_hu_HU.h>#include <Keyboard_it_IT.h>#include <Keyboard_pt_PT.h>#include <Keyboard_sv_SE.h>
#include <Adafruit_CircuitPlayground.h>#include <Adafruit_Circuit_Playground.h>
#define BNO055_SAMPLERATE_DELAY_MS (100)// Check I2C device address and correct line below (by default address is 0x29 or 0x28)// id, addressAdafruit_BNO055 bno = Adafruit_BNO055(55, 0x28, &Wire);
void setup() { // put your setup code here, to run once: CircuitPlayground.begin(); Serial.begin(9600); Keyboard.begin(); bno.begin(); bno.setExtCrystalUse(true); delay(1000);}
void loop() { // put your main code here, to run repeatedly:int potValue = analogRead(A1); // tracks the state of the potentiometer
if (potValue > 10) { // Used to tell if the controller is turned on or off sensors_event_t event; bno.getEvent(&event); float x = event.orientation.x; // Tracks side to side motion of head (nodding no) float y = event.orientation.y; // Tracks up and down motion of head (nodding yes)
// following 3 lines are for debugging purposes Serial.print(x); Serial.print(", "); Serial.print(y); if(y > 40 || y < -40) { // If the head tilts back or forth within these ranges, it presses and releases y once Keyboard.press('y'); Keyboard.release('y'); delay(800); // used to prevent keyboard from spamming inputs } if(x > 40 || x < -40) { // If the head tilts back or forth within these ranges, it presses and releases n once Keyboard.press('n'); Keyboard.release('n'); delay(800); // used to prevent keyboard from spamming inputs } }}
Contributions:
Isaiah Lopez: Constructed the physical circuit used in each stage of the controller, assembled each prototype including 3D modeling the print for our final prototype.


No comments:
Post a Comment
Note: Only a member of this blog may post a comment.