示例#1
0
        //END RC constants
        public static void Main()
        {
            //RC stuff

                // Setup steering servo
                steering = new Servo(Pins.GPIO_PIN_D9);

                // Setup ESC
                xl5 = new SpeedController(Pins.GPIO_PIN_D10, new TRAXXAS_XL5());
                xl5.DriveMode = SpeedController.DriveModes.Forward;

            //End RC stuff

            Listener webServer = new Listener(RequestReceived);

            OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
            while (true)
            {
                // Blink LED to show we're still responsive
                led.Write(!led.Read());
                Thread.Sleep(500);
            }
        }
示例#2
0
        public static void Main()
        {
            // Setup steering servo
            steering = new Servo(Pins.GPIO_PIN_D9);

            // Setup ESC
            xl5 = new SpeedController(Pins.GPIO_PIN_D10, new TRAXXAS_XL5());
            xl5.DriveMode = SpeedController.DriveModes.Forward;

            // Setup PPM decoder channels
            //throttleChannel = new PPM_Channel(Pins.GPIO_PIN_D7);
            //steeringChannel = new PPM_Channel(Pins.GPIO_PIN_D6);

            // Set the servo channel to proper output scaling
            //steeringChannel.calibrateOutput(0, 180);

            // Sweep the wheels from left to right
            for (int i = 0; i <= 30; i++)
            {
                steering.Degree = i * 6;
                Thread.Sleep(30);
            }

            // Center steering
            steering.Degree = 90.5;

            // Switch to RC control mode
            while (true)
            {
                // Set the steering servo to the PPM wave
                //steering.Degree = steeringChannel.Read;

                steering.Degree = 0;

                // Get the throttle input
                //int throttleIn = throttleChannel.Read;
                int throttleIn = 50;

                // Figure out which direction we are going
                if (throttleIn >= 0)
                    xl5.DriveMode = SpeedController.DriveModes.Forward;
                else
                {
                    // Set ESC to reverse
                    //xl5.DriveMode = SpeedController.DriveModes.Reverse;

                    // Flip the negative to a positive
                    //throttleIn = throttleIn * -1;

                    // For now, let's just pull the throttle all the way out
                    xl5.Throttle = 0;
                }

                // Are we going too fast?
                if (throttleIn > speedLimit)
                    throttleIn = speedLimit;

                // Set the throttle
                xl5.Throttle = throttleIn;

            }
        }
示例#3
0
 /// <summary>
 /// Construct, get the ESC handle
 /// </summary>
 /// <param name="escHandle"></param>
 public ESC_AutoSequencer(SpeedController escHandle)
 {
     this.esc = escHandle;
 }