27 April 2026

Team 6 final contoller - Star Wars Squadrons

picture:
Description: Our controller is a blend with a Yolk and a tie fighter controller to give a driving sense to the player in Star Wars: Squadrons. This is a game that takes the space dog fighting to the absolute limit, giving everything to make you feel like you are in a cockpit. This controller is made to thoughtfully organize all those mechanics into a system not too dissimilar form flying the ships in the game. the exterior was 3D printed to slide and pop in and out its mechanisms to make its wiring easier. the basic translations are simple, steer left and right to spin, and pull and push to go up and down. we figured "yaw" going left and right could be pulled out in light of other mechanics, and to make the player adapt more flying habits form the controller itself. the other buttons are laid out in convenient areas where the player hsodl quickly get an understanding of how to use them, and some of those mechanics are fun to work with based on the buttons. the right light sensor on the handle is for firing, and the left handle is the toggle for targeting. turning it will spin the vehicle and pushing bakc and forth will effect the "pitch" allowing the ship to go up or down. on the right of the main section there is a switch to turn on sub-light, the highest speed to get out of a pinch, and in the left a thumbstick, to regulate the dynamic speed you surf with in your dogfighting the question what we woudl have is what ocudl we do for the physical design to improve the weight or feel of the movement the skimalite:
the code: //Final Group 6 //Marc Walker, Nicholas Smith #include #include #include #include #include #include #include #include #include #include #include #include //declare variables for analog read values const int LHSensorPin = A0; int LHSensorLight;//NEEDS TO BE INITIALIZED const int RHSensorPin = A1; const int LSensorPin = A4; const int RSensorPin = A5; //const int LPotPin = A4; //const int RPotPin = A5; const int throttlePin = A6; const int LSwitchPin = A7; const int distanceTrigPin = A2; const int distanceEchoPin = A3; void setup() { // start CircuitPlayground and Serial Monitor CircuitPlayground.begin(); Keyboard.begin(); pinMode(LSwitchPin, INPUT_PULLUP); pinMode(distanceTrigPin, OUTPUT); pinMode(distanceEchoPin, INPUT); Serial.begin(9600); delay(1000); } void loop() { if(CircuitPlayground.slideSwitch()) { int LHSensorInput = analogRead(LHSensorPin); int RHSensorInput = analogRead(RHSensorPin); int LSensorInput = analogRead(LSensorPin); int RSensorInput = analogRead(RSensorPin); int LSThreshhold = 200;//Threshhold to trigger left light sensor buttons int throttle = analogRead(throttlePin);//0 to 1023 int LSwitchInput = digitalRead(LSwitchPin); digitalWrite(distanceTrigPin, LOW); delayMicroseconds(2); digitalWrite(distanceTrigPin, HIGH); delayMicroseconds(10); digitalWrite(distanceTrigPin, LOW); long duration = pulseIn(distanceEchoPin, HIGH, 30000); static int lastDistance = 0; if (duration > 0) { lastDistance = duration * 0.034 / 2; } int distance = lastDistance; bool LSwitch; //float RPot = analogRead(RPotPin);//Right Potentiometer //float LPot = analogRead(LPotPin);//Left Potentiometer int shields;//Read value of shields mapped between 0 and 100 int speed;//Read value of speed mapped between 0 and 100 int laserStrength;//Read value of laserStrength mapped between 0 and 100 float vertical; float horizontal; //vertical = Get CPE accelerometer Y value; //horizontal = Get CPE accelerometer X value; //shields = LPot; //speed = RPot; //laserStrength = (shields + laserStrength) / 2; //bool LButton = true if Left button is pressed; //bool RButton = true if Right button is pressed; bool LHButton; bool RHButton; bool LButton; bool RButton; //bool LSwitch = true if Left switch is flipped; //bool RSwitch = true if Left switch is flipped; if (LHSensorInput <= LSThreshhold) { LHButton = true; } else { LHButton = false; } if (RHSensorInput <= LSThreshhold) { RHButton = true; } else { RHButton = false; } if (LSensorInput <= LSThreshhold) { LButton = true; } else { LButton = false; } if (RSensorInput <= LSThreshhold) { RButton = true; } else { RButton = false; } if (LSwitchInput == LOW) { LSwitch = true; } else { LSwitch = false; } Serial.print("Distance: "); Serial.println(distance); /*Serial.print("Distance Sensor: "); Serial.println(distance);*/ /*Serial.print("L Sensor: "); Serial.println(LSensorInput); Serial.print("LH Sensor: "); Serial.println(LHSensorInput); Serial.print("RH Sensor: "); Serial.println(RHSensorInput); Serial.print("R Sensor: "); Serial.println(RSensorInput);*/ if (throttle < 250)//INCREASE THRUST { Keyboard.press('W'); } else { Keyboard.release('W'); } if (throttle > 750)//DECREASE THRUST { Keyboard.press('S'); } else { Keyboard.release('S'); } float accelDeadzone = 2; float posX = CircuitPlayground.motionX(); //Serial.println(posX); if(posX > accelDeadzone)//TURN LEFT { Keyboard.press('A'); //Serial.println("WE GO LEFT"); Keyboard.release('D'); } else if(posX < -accelDeadzone)//TURN RIGHT { Keyboard.press('D'); //Serial.println("WE GO RIGHT"); Keyboard.release('A'); } if(RHButton)//Shoot { Keyboard.press('K');//Rebind shoot to K } else { Keyboard.release('K'); } if(LHButton)//Target { Keyboard.press('T'); } else { Keyboard.release('T'); } if(LButton)//Fire Left Aux { Keyboard.press('Q'); } else { Keyboard.release('Q'); } if(RButton)//Fire Right Aux { Keyboard.press('E');//Rebind shoot to K } else { Keyboard.release('E'); } if(LSwitch) { Keyboard.press(' '); } else { Keyboard.release(' '); } //Keyboard.releaseAll(); delay(100); } else { Keyboard.releaseAll(); } } the video:

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.