Dear OCCRA Students,
I have created a simple test program for you to perform a basic checkout of your VEXnet system and show you how to use digital input 5 as a Start Switch and digital input 6 as a Stop Switch. You will also need to plug a servo module into motor/servo port 8.
Here’s how the program works, after downloading the program with EasyC into the VEX microcontroller, switch to the VEXnet Competition Switch Simulator screen inside EasyC, adjacent to the terminal window.
Next, select the radio buttons to activate the Autonomous mode inside of the VEXnet Competition Switch Simulator screen. The Start and Stop button now control cycling of the servo module plugged into port 8. After hitting the Start button, the servo will move back and forth every 1/2 second until the Stop button is pressed. It will restart if you hit the Start button.
Operator Control is similiar. Switch the VEXnet Competition Switch Simulator radio buttons to Operator Control. Next, Switch back to Terminal Window to see a print statement come up every 1 second. The servo does not operate in this mode – just the print statement. It seemed like it took about 10 seconds to show up the first time. You may have to play with the terminal window refresh, clear, stop and start buttons to have the print message show up. Sometimes I had to power cycle (turn off, turn on) the VEX microcontroller before the print statement showed up. The print statements will continue until the Stop Switch is pressed. This kills the print statements until the VEX controller is power cycled. The Start Switch has no functionality in Operator Control mode (it does not restart like Autonomous).
This VEXnet test program builds on the first.
During autonomous, Motor/Servo in position 1 , formerly position 8, cycles every one-half second and a print statement happens every one half second until the stop button is pressed. The system can be restarted if the start button in digital input port 5 is pressed.
During operator Control, Motors in position 1 and 2 are set up in tank mode and respond to the transmitter CH4 and CH1. A print statement also is issued every one second. The system can be stopped by pressing a switch that is connected to position 6, but not restarted until VEX controller is power cycled.
Autonomous print statement cannot be seen using EasyC Competition Software Switch from in EasyC - Vex Robotics knows about the issue.
The autonomous print statement works with the field controller system
I have from OCCRA.
Here’s even a better test program. It prints out statements in Auton and Operator Control.
It prints out if Start/Stop switch is pressed in Auton and Stop Switch in Operator Control.
After Stop Switch is pressed, it prints out a halt statement every second in either operating mode.
(Start Switch = 5. Stop = 6)
In Auton, motors 1 and 2 cycle back and forth every half-second.
In Operator Control, Motors 1 and 2 are programmed for tank mode, using Channels 4 (left) and Channel 1 (right).
I tested the program with the VEXnet field controller and the VEX home brew competition switch.
It is important to know how to see the print commands in the terminal window for debugging in autonomous (VEXlabs knows about VEXnet competition switch not operating inside of EasyC V18.104.22.168).
So, after downloading the code, power cycle (off/on) the VEX controller,and VEX transmitter.
After green lights show up on VEXnet and Game, Turn on VEX transmitter front switch.
Then go to EasyC terminal window and hit refresh (bottom of screen). Sometimes a clear, stop, and then start
are necessary. You should see something like WIFI competition project words show up in terminal window.
Now hit Start Switch plugged in port 5 to start Auton. Stop Switch in port 6 will stop Auton and Switch 5 will restart.
In operator control only Switch 6 operates as a kill switch (no restarting). Take a look.