Help! Programming multiple Auto selected by LCD

Hey while using the LCD screen during a match… i disconnected and could not reconnect because the only way we could is to press a button on the LCD screen, something we could not do due to the fact the robot had left the starting tile and it was mid match. So my question is, Is there anyway to fix this?

EasyC’s Competition Switch Simulator is glitchy. If it isn’t letting you click the buttons, download the program again through Vexnet (meaning you use the programming cable, not USB-USB) and try again.

As to the guy who disconnected and couldn’t get back into Driver Control, are you using my code? Because that just can’t happen with the code I wrote. It sounds like you have a loop that requiring LCD input to move on during Initialize, which is a bad idea. The Initialize period (assuming that’s where you have your LCD code) should have all of the commands within a loop that’s to the effect of “Run while the robot is disabled.” That prevents it from locking up your controls.

Post your code here, and I’ll take a look.

The team from our club that heavily uses easyC said that they have an escape sequence on their initialize. (Every other programming language offers the ability to detect what competition mode the Cortex is currently in, and if a joystick is linked) So, if you were to press any button on the joystick (before hitting a button on the LCD screen), it would abort the rest of the initialize sequence. A really rough psuedo code would be something like this:

Prompt LCD Selection;
while no buttons are pressed
query all buttons
if button is on LCD screen, run rest of lcd menu sequence
if button is on joystick, exit loop (and end the initialize function)

Alright, so I have the LCD working, when teh competition switch is enabled, the back light is off and says program 1, but when the competition switch is off, it says program 1 and the back light is on. Also the buttons don’t do anything.

Try flipping where you have the Rx and Tx ports on the LCD screen. The competition switch shouldn’t theoretically affect the LCD screen (especially the backlight), so I’m not sure what’s going on there. But try flipping those ports and seeing if that fixes anything. It could also be an issue with the custom serial cable, so you might want to double check that :), if flipping the ports doesn’t work.

Before you destroy something by just randomly swapping wires around, check the cable. This is what an official one looks like at both ends, notice how the two red and two black wires split out from the four wire connector on the cortex.



you also could have a timeout so it would default to something if a button was not pressed in x number of seconds. This could be easier.

I think it needs to be plugged into UART2 (at least for RobotC). Are you sure yours is?

well, in easyC it has options of uart1 and 2, so im not sure about that

So here’s the deal, if you are running the code from post #3, it doesn’t work.

Before reading buttons you have to start the LCD “button getter”.

The autonomous “program” was not saved in the Program variable.

Lots of text was being sent to LCD line 1, nothing to line 2.

Here is a functional version of that code, if I have time I will write you a better version sometime.

I know everyone is learning, but if you are going to post code and claim expertise, at least test it first.
LCD Menu (75.3 KB)

Oh my God. You’re right. I have no idea how I missed the LCD Button Watcher, or forgot to actually have the middle button do something. That’s was really stupid of me.

I am so sorry for wasting your time. Pearman’s code should absolutely work.

Well, the middle button did show the message that autonomous was selected, but it did not save that state. The code was 90% correct, I only added perhaps 7 lines and fixed the LCD display for line 2.

Thanks guys, lots of clarification :D. I need all the help I can get anyway. I’ll try it out right away tommorow.

Thanks everyone, particularily jpearman. Thanks for writing a program for me too Epemeral Being. It works as I’d like it to now. Just one question left before I wrap this up. As long as I do put my programs (the autonomous routines) in the autonomous section it will run it right? That is if it is attached to the competition switch as in a match?

Epemeral_Being left place holders for the four different autonomous routines. Your best bet would be to make these in four new functions and call the correct one, putting all the code in a single file can make it hard to read and modify. The code did not set a default value for “Program”, you probably want to set it to some value so it will always run something if you forget to hit the LCD button (or the robot is re-booted after you have done so).

The competition switch correctly controls the operation, if you don’t have a competition switch then it’s a good $20 investment, much easier than using the soft controls. Field control works in the same way as a competition switch.

hey guys, has anyone tried the code in PROS?

my team is using pros this year, and i haven’t used it before.

so i downloaded the code for pros and fiddled with it but i cant seem to get it to work.

any seggestions?

any help is great. thanks all!

It’s virtually the same as robotc with API diifernces. Jpearman has created a post for multiple autos. Use google search with his name for vex forums for it.

A new thread might be more appropriate, I think.

What is your problem? Do you get an error message? Can you post the troublesome code?


I tried google and I couldnt find anything. thanks though.

What are the API differences? What is API?

thanks, im a total noob to c coding.


so i am using the sample code from post #3.

in the auto.c function, it underlines “Program” and says it cannot be resolved. I tried to fix that by going above “void autonamous()” and typing “char program”. that seemed to fix it, but, when i downloaded it to my cortex it still just displayed the “but 0 0 0” message.

i know that jpearman mentioned that the code does not work, and he pointed out the errors, but i have no idea how to fix them.

thanks again all, for helping the noob! :slight_smile: