So I’m trying to write a GUI in pros C++ using LLEMU to switch programs in my auton selector, kind of like in this video. Only difference is that I want to use 1 limit switch instead of 2. However, I have no idea what functions or keywords to use in order to utilize the limit switch input. Roughly, i plan to do something along the lines of
if(limit is pressed){//I don’t know what the technical way to state this is
limitCount = limitCount++; followed by a switch statement corresponding to each of our programs
else {
switch(limitCount);//the same switch statement as above
and it’ll loop back to 1 after 5 increments. It would be really helpful if someone could let me know how this works. Thanks!
The important thing here is the buttonUnpressed variable which is used to detect when the button is first pressed, thus doing an action once and requiring the button to be unpressed to before doing that thing again.
To display text to the screen using LLEMU you first initialize it like this…
void initialize()
{
pros::c::lcd_initialize();
}
Then write to the screen with something like this…
Thank you for your answer! Considering this is an auton selector, would I need to put this in my initialize.cpp file, or would it be better to put it in a new file? Do I need to initialize the brain or do anything else before running the code? I seem to be getting error messages as it is now.
It is easiest to just put it into initialize.cpp. For “initialize the brain”, other than starting LLEMU (if that is what you are using) you don’t need to do anything else.
The error could be anything, so please post the error message for further assistance.
Also I forgot to mention that to access the variable autonState in autonomous.cpp add this line to the autonomous file…
extern int autonState;
This way the compiler knows that this file will be using and external variable called autonState.