Help! Programming multiple Auto selected by LCD

  1. 5 years ago

    Stanley Shi(2R)

    6 Oct 2013 Vancouver, B.C., Canada 2R

    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?

  2. Ephemeral_Being

    6 Oct 2013 Gilbert, Arizona N/A

    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.

  3. Ephemeral_Being

    6 Oct 2013 Gilbert, Arizona N/A

    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.

    Download these instead.

  4. Stanley Shi(2R)

    7 Oct 2013 Vancouver, B.C., Canada 2R

    Thank you very much!
    I will try this out when I get back to school on Monday.

  5. Ephemeral_Being

    7 Oct 2013 Gilbert, Arizona N/A

    Awesome, sounds like a plan. If you have any questions, let me know.

  6. Stanley Shi(2R)

    7 Oct 2013 Vancouver, B.C., Canada 2R

    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.

    What am I supposed to do to open the file?

  7. edjubuh

    7 Oct 2013 V5 Beta Moderator West Lafayette, IN

    What was the error message?

  8. Ephemeral_Being

    7 Oct 2013 Gilbert, Arizona N/A

    @7793r 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.

    What am I supposed to do to open the file?

    Did you unzip the files first?

    If so, open the only one with the easyC icon.

  9. Stanley Shi(2R)

    8 Oct 2013 Vancouver, B.C., Canada 2R

    Thank you! I got it opened and I'm playing around with it right now.

  10. Ephemeral_Being

    8 Oct 2013 Gilbert, Arizona N/A

    Excellent. Anything you can find wrong with the code?

  11. Stanley Shi(2R)

    8 Oct 2013 Vancouver, B.C., Canada 2R

    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"

  12. drdanielfc

    8 Oct 2013 Orange, CT 4577

    @7793r 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"

    You need to purchase this cable: http://www.vexrobotics.com/276-1579.html

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

  13. Ephemeral_Being

    8 Oct 2013 Gilbert, Arizona N/A

    Plug the LCD Screen into UART1

    Turn off the Cortex

    Plug the Cortex into your laptop with the USB-USB cable

    Use the Competition Switch Simulator to put the robot into the Disabled/Autonomous mode

    That should get the menu system running.

    EDIT: Oh, yeah. Listen to the guy above me. You need the 3-->4 wire Y-Cable.

  14. Stanley Shi(2R)

    8 Oct 2013 Vancouver, B.C., Canada 2R

    I dont have the serial y cable :(, am i still able to get it to work?

  15. Ephemeral_Being

    8 Oct 2013 Gilbert, Arizona N/A

    @7793r I dont have the serial y cable :(, am i still able to get it to work?

    No, I don't think so. And I have no idea where to buy them outside of a VEX Supplier.

  16. Stanley Shi(2R)

    8 Oct 2013 Vancouver, B.C., Canada 2R

    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.

  17. drdanielfc

    8 Oct 2013 Orange, CT 4577

    @7793r 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.

    Make sure you have the right wires going to the right places. Reference the photo at http://www.vexrobotics.com/276-1579.html and follow the colors.

  18. Stanley Shi(2R)

    11 Oct 2013 Vancouver, B.C., Canada 2R

    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?

  19. Ephemeral_Being

    11 Oct 2013 Gilbert, Arizona N/A

    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.

  20. Stanley Shi(2R)

    15 Oct 2013 Vancouver, B.C., Canada 2R

    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.

  21. Newer ›
 

or Sign Up to reply!