programming - buttons. ch 5-8 joysticks work by moving the stick along an axis and thus any value...

9
Programming - Buttons

Upload: augustus-watson

Post on 04-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 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

Programming - Buttons

Page 2: 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

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.

Page 3: 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

Pressed or NOT pressed

A pressed value will send a value of “1”, while returning “0” when NOT pressed.

Page 4: 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

Programming the Button

Page 5: 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

Mine Field Challenge – Time PeriodsThe 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

Page 6: 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

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?

Page 7: 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

Idle LoopSo 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).

Page 8: 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

Your program should look like this

Make sure you SAVE this file in you’re MY DOCUMENTS folder as MINE CONTROL.

Page 9: 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

PartneringYou 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]