90 likes | 185 Views
Programming - Buttons. Ch 5-8. Joysticks work by moving the stick along an axis and thus any value between 127 & -127 can be sent. With the buttons they are either pushed or not pushed. So only SPECIFIC values can be sent. Pressed or NOT pressed.
E N D
Ch 5-8 Joysticks work by moving the stick along an axis and thus any value between 127 & -127 can be sent. With the buttons they are either pushed or not pushed. So only SPECIFIC values can be sent.
Pressed or NOT pressed A pressed value will send a value of “1”, while returning “0” when NOT pressed.
Mine Field Challenge – Time Periods The challenge itself is 2 minutes or 120 seconds. There are 3 periods of time. • Period 1 = 30 sec Autonomous Period • Period 2 = Idle Period (gives the judges a chance to tally up the points made during period 1) • Period 3 = 90 sec User Control Period
Fear of Disqualification? You added the wait1Msec( ) command in the beginning of the code to give you a chance to move out of the way before commands are given. But what happens if you accidentally touch the joystick in between Period 2 and 3? Or what happens if the signal is given BEFORE your timer runs out?
Idle Loop So that you can sit and wait for a judge’s signal and NOT use up the 90 sec for the User control period we create what is called an IDLE LOOP. What this says is that as long as the Channel 8 “UP” registers zero (meaning it is NOT pressed), then DO NOTHING).
Your program should look like this Make sure you SAVE this file in you’re MY DOCUMENTS folder as MINE CONTROL.
Partnering You have the ability to add a SECOND user by simply connecting 2 Cortex controllers with a phone cord cable. Names for the second remote control are appended by “Xmtr2”. For example, to access the Ch 8 “up” button on the second remote control, the command would be: vexRT[Btn8UXmtr2]