Hello! I recently started programming in C and right now I am programming a robot using a PIC32 microcontroller. There are six input sensors and right now I have separate variables set to each of them. I would like help organizing the variables. Right now in order to test conditions I have to write a huge line like
I would like it organized to something like:Code:if (FarL==1 && MidL==1 && InsL==1 && InsR==0 && MidR==1 && FarR==1) { /* code to turn left or something here */ }
The application of this is irrelevant; all the standard rules of C apply. I would really like help, if this prototype I have set up is not possible or not optimal, I am open to suggestions I just would like to be a bit more organized. I am also open to using case statements, pointers, arrays, linked files, functions, and any other method to help organize.Code:if(sensorInput=="111000") { /* code to turn left or something here */ }