コード例 #1
0
 public override void robotstart()
 {
     mySpark1 = new Spark(0, portname);
     mySpark2 = new Spark(1, portname);
     mySpark3 = new Spark(2, portname);
     mySpark4 = new Spark(3, portname);
 }
コード例 #2
0
        public override void teleopPeriodic()
        {
            myDecoder1 = new Decoder(this.data, 0);
            myDecoder2 = new Decoder(this.data, 1);
            mySpark1   = new Spark(0);
            mySpark2   = new Spark(1);
            bool printleft  = false;
            bool printright = false;

            if (myDecoder1.getRawButtons(3))
            {
                printleft = true;
            }
            else if (myDecoder1.getRawButtons(4))
            {
                printleft = false;
            }
            if (myDecoder2.getRawButtons(3))
            {
                printright = true;
            }
            else if (myDecoder2.getRawButtons(4))
            {
                printright = false;
            }
            if (printleft)
            {
                Console.WriteLine(myDecoder1.getY());
            }
            if (printright)
            {
                Console.WriteLine(myDecoder2.getY());
            }
            mySpark1.set(myDecoder1.getY());
            mySpark2.set(myDecoder2.getY());
            if (myDecoder2.getRawButtons(0))
            {
                Console.WriteLine("Trigger Pressed");
            }
            if (myDecoder2.getRawButtons(1))
            {
                Console.WriteLine("button 1 pressed");
            }
        }