Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include<iosteam>
- int Laxle_speed = 0;
- int Raxle_speed = 0;
- int Left_Bank_rpm = 0;
- int Right_Bank_rpm = 0;
- int Left_Bank_power = 0;
- int Right_Bank_power = 0;
- int gear = 1;
- bool PTOtoggle = false;
- int main() {
- // Initializing the VEX Brain and a solenoid instance
- vex::brain Brain;
- vex::solenoid Solenoid[] = {vex::solenoid(A), vex::solenoid(B), vex::solenoid(C), vex::solenoid(D), vex::solenoid(E), vex::solenoid(F)};
- // Variable to track the solenoid state
- bool solenoidStates[] = {false, false, false, false, false, false};
- void Gear1{
- bool solenoidStates[] = {true, true, false, false, false, false};
- gear = 1;
- }
- void Gear2{
- bool solenoidStates[] = {false, true, true, false, false, false};
- gear = 2;
- }
- void Gear3{
- bool solenoidStates[] = {false, false, true, true, false, false};
- gear = 3;
- }
- void Gear4{
- bool solenoidStates[] = {false, false, false, true, true, false};
- gear = 4;
- }
- void Aux1{
- bool solenoidStates[] = {false, false, false, false, true, true};
- gear = -1;
- }
- void Aux2{
- bool solenoidStates[] = {false, false, false, false, false, true};
- gear = -2;
- }
- void Aux3{
- bool solenoidStates[] = {false, false, false, false, false, false};
- gear = -3;
- }
- void UpShift{
- if(PTOtoggle = false){
- if(gear == 1){
- Gear2;
- }
- if(gear == 2){
- Gear3;
- }
- if(gear == 3){
- Gear4;
- }
- } else {
- if(gear == -3){
- Aux2;
- }
- if(gear == -2){
- Aux1;
- }
- }
- void DownShift{
- if(PTOtoggle = false){
- if(gear == 2){
- Gear1;
- }
- if(gear == 3){
- Gear2;
- }
- if(gear == 4){
- Gear3;
- }
- } else {
- if(gear == -2){
- Aux3;
- }
- if(gear == -1){
- Aux2;
- }
- }
- while (true){ //repeat indefinitely
- if (Brain.Controller1.ButtonR1.pressing()) {
- UpShift;
- }
- if (Brain.Controller1.ButtonR2.pressing()) {
- DownShift;
- }
- if (Brain.Controller1.ButtonB.pressing()) {
- PTOtoggle =! PTOtoggle;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement