Last year, in my first year of robotics, I used on program for one spot on the field. However in toss up, I need four different autonomous routines. I plan on using the LCD module to do this, but I have no idea how. I use Easy C V4 and the only programming experience I have is using motor module and wait blocks. Nothing with setting variable, sensors, or anything.
I am asking for help on how to program a system that has four slots I can insert my autonomous routines and use the LCD module to select one of them when I turn the robot on. I know that this is one of the harder things to do with the LCD, and not everyone has the time to write a tutorial just for me, but I have seen a lot of teams do this so can anyone help me please?
I cleaned up the code that we used last year in EasyC and set it to the 4 screens you asked for. I am 95% sure that this will work, but I don’t have a Cortex/LCD Screen to actually test on. The left and right buttons will scroll through the menu screens, and the center buttons selects the program displayed at the time. The comments should make it easy enough to understand why everything works, and allow you to change it if you wanted to add more programs.
EDIT: I have to make a small note here. There’s a .c file that’s included in there called “youshallnotpass.c” or something like that. It does nothing with the program, and is just something I forgot to delete when I reformatted our competition code from last year. Sorry.
I did the same menu system in PROS, too, if anyone was interested in that. They’re basically the same code, just formatted slightly differently. Again, that has the four screens you wanted and the same selection interface.
I can’t do one in RobotC right now; the guy on our team with the license is busy and can’t send it to me. Sorry if that was the language you were actually after. I’d recommend you take a look at PROS, if that was the case. We actually like it better, and at the very least you could easily figure out how to write the menu in RobotC from what I’ve got here.
If anyone sees/catches any critical errors, sorry. Go ahead and call me out on them and correct them, or I can when I get the chance.
EDIT 2: Don’t use these; see my post below. I can’t figure out how to delete the files, so just don’t download them and scroll a bit more. LCD Menu PROS.zip (1.05 MB) LCD Menu EasyC.zip (4.07 KB)
I just caught a small but critical error in both of the programs I uploaded last night. The LCD Screen wasn’t starting on screen 1, but instead on Screen 0. Which doesn’t have text. I’ve since corrected my error, and if you were to run these they should work. I’ve also removed the extraneous .c file from the EasyC Zip.
I downloaded the file onto a usb, and put the usb onto a computer. I tried opening the file(i wasnt even sure which one so I just clicked all of them) but they kept returning an error message.
Whoops, I must sound so dumb right now, which port does the LCD pins go into I know they are UART1 and 2 but they have 4 holes and when I plug them in they just display
“but 0 0 0
but 0 0 0”
Then 2 plugs go into the LCD and one into one of the UART ports.
Needing to purchase this is one of the “gotyas” of buying the LCD screen. I don’t understand why they don’t include it (and I don’t understand why it’s so expensive…)
I tried making an improvised version using two 2 wire extension cables, a 3 wire y cable, and one 4 wire extension cable, but I havent gotten it to work yet. I guess I’ll have to wait until the shipment of the serial y cable arrives. Too bad I got trolled eh.
Okay, so I soldered and heat shrunk a custom serial y-cable, but I need to clarify how to get your robot to be in autonomous mode. Last year I don’t remember how since the international student that did it left but when i linked the robot, it did nothing. When i press a button, it performed autonomous, then after a couple seconds, i could continue driver control.
How do you get it into autonomous mode? Also in driver mode the screen is green but blank, is that normal?
Yes, the screen will be blank during Driver Control unless you set something to display on the screen. It means you forgot to turn off the backlight. It’s fine; it will just drain your battery a tad bit faster.
To enter Autonomous Mode, open your program in EasyC, and press F7 to download the program. Do it wirelessly through the VEX Joystick Link, and when you’re finished a terminal window should be showing with four options. Disable/Enable on the left and Autonomous/Driver on the right. If not, find the thing called the Competition Switch Simulator and click it. I’ve circled the button in the image here, and the window in front is what you want.
Set the robot to Disable/Autonomous. This will make the code for the LCD Screen active, assuming it’s in the Initialize portion of the code. Which it should be. After you’ve picked an Autonomous Mode, click “Enable.” The robot should run the program you’ve selected, provided that you set up the conditionals correctly in the Autonomous section of the code.
Sorry to keep pestering, but programing is just not my forte.
The competition switch won’t let me press anything, like the buttons are not clickable, they just act like a picture. The thing is, aren’t you supposed to change autonomouns and operator in the main section of the program to 25 and 105 or something like that? Can’t I make it so that when I turn on the robot I can select autonomous without the competition switch? I have my autonomous routines figured out, just how to get them to be selected by LCD. I need to get it working. What do i do since the competition switch doesnt do anything(cant clik buttons). Thanks for the help and again sorry to bother you.