The custom controller we settled on for the project was our treasure map design, which we made to expand upon the concept of the video game "Hidden Folks." Since the purpose of the is to explore the maps and find certain objects/people, we decided to use the classic "X" marks the spot treasure map. Since the game itself has quite a simple interface and controls, our team decided to create a visually immersive controller, using a similar art style to that of the game while also adding our own spin to it.
The control features two cylinders on each side, simultaneously representing a rolled-up scroll and providing sturdy handles for each hand. There is an "X" button in the center map portion of it, using a light sensor that maps to either "on" or "off" to select something within the game. There are two buttons for the "up" and "down" controls, and a touchpad that serves as the "left" and "right" controls as well.
Controller Sketch:
Schematic:
void setup() {// put your setup code here, to run once:Serial.begin(9600);}// --- Main loop ---void loop() {// --- 1. Read sensors ---int lightValue = analogRead(PIN_LIGHT_SENSOR); // 0-1023int zoomValue = analogRead(PIN_ZOOM); // 0-1023int frUpValue = analogRead(PIN_FSR_UP); // 0-1023int frownValue = analogRead(PIN_FSR_DOWN); // 0-1023// Read tilt from accelerometer (X/Y/Z)int tilt = readTiltX(); //pseudocode functint tilty = readTiltY(); //pseudocode funct// --- 2. Process zoom control ---int zoomLevel = map(zoom/alue, 0, 1023, ZOOM_MIN, ZOOM_MAX);// Optionally use tiltX/Y to modify zoom or cursor movement// --- 3. Check FSR pressure pads ---bool upPressed = fsrUpValue > FSR_THRESHOLD;bool downPressed = frownValue > FSR_THRESHOLD;// --- 4. Check light sensor to confirm action ---bool isDark = lightValue < LIGHT_THRESHOLD;// --- 5. Perform actions ---if (upPressed && isDark) {moveUp(); //user-defined function}if (downPressed && isDark) {moveDown(); // user-defined function}// Optional: use tilt to modify movementif (tiltX > TILT_THRESHOLD) {moveRight ();}else if (tilt ‹-TILT_THRESHOLD) {moveLeft();}// Optional: output values for debuggingSerial.print("Zoom: "); Serial.print1n(zoomLeve1);Serial-print("FSR Up: "); Senial.println(fsrUpValue);Serial-print("FSR Down: "); Serial-println(fsrDownValue);Serial.print("Light: "); Senial.println(lightValue);delay(50); // small delay for stability// --- Pseudocode functions ---int readTiltx) {// Read X-axis from accelerometerreturn accelerometer.getX(); // placeholder}int readTilty() {// Read Y-axis from accelerometerreturn accelerometer.getY(); // placeholder}void moveUp() {// Implement the up action}void moveDown() {// Implement the down action}void moveRight() {// Implement right action}void moveLeft() {// Implement left action}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.