Jumper programming

https://vexforum.com/t/multi-autonomous-using-jumpers/24913/1
I was recently sent here and it is helpful but the first ten or so lines I dont know where to put. Im using easyc Im not sure if that makes a difference. please help

That code was written in RobotC.

I don’t have Easy C so sorry can’t help there.

is there anyway to do this in easyc?

There is most certainly is a way. (many ways)
I will try to get some code up later today if no one beats me to it.

Okay here we go.

this program selects between 4 different codes based on input from two jumpers (right_jumper and left_jumper) and then gives each situation a number (what_code) then it uses that number to select which code you run.

#include "Main.h"

void Autonomous ( unsigned long ulTime )
{
      unsigned char left_jumper = 0; 
      unsigned char right_jumper = 0; 
      int what_code = 0; 

      // get your jumpers 

      left_jumper = GetDigitalInput ( 1 ) ;
      right_jumper = GetDigitalInput ( 2 ) ;
      // give each configuration a number 
      // (use the assignment block) 
      what_code = left_jumper + (2 * right_jumper) ;
      // select your code bassed on that number 

      switch ( what_code  )
      {
            case 0 : // no jumpers pluged in
            {
                  // insert first code 
                  break ;
            }
            case 1 : // left jumper inserted
            {
                  // insert second code 
                  break ;
            }
            case 2 : // right jumper inserted
            {
                  // insert third code 
                  break ;
            }
            case 3 : // both jumpers inserted
            {
                  // insert last code 
                  break ;
            }
      }
}

I would recommend that the case 0 (when no jumpers are inserted) be a code that won’t mess up your robot if placed on a tile that it was not intended for.
That way if you loose your jumpers you won’t destroy your bot.

Best of luck to you and have fun programing.

Phillip.

EDIT:

This is in essay C but is only the text so you will have to recompose it somewhat. (not just copy and paste it)

It just occurred to me that I could post screen shots of the code to make it clearer.