Hello,
I'm an educator/grad student working on developing curriculum for data acquisition and control using Arduino Uno. I am attempting to create a similar curriculum to some that has already been developed for use with a National Instruments device using LabView. I am quite new to Arduino and C/C++, so forgive my extensive ignorance.
My question is how to use case structures with Arduino. Specifically, I want to use two switches as inputs to control a traffic signal sequence. For example, if Switch 1 is High and Switch 2 is Low, Sequence A happens (case structure). If Switch 1 is High and Switch 2 is High, Sequence B happens. If Switch 1 is Low and Switch 2 is High, Sequence C happens, and so on for all possible combinations of the two switches. I think the most logical way to do this appears to be the switch case function.
In LabView, this is done using a DAQ Assistant for the inputs, which goes to an index array which then goes to a case structure with a separate case for each condition. I'm just not quite sure how this all translates to Arduino, whether I even need the array at all or how to properly define it, etc. I've read Arduino's documentation on the switch case command, arrays, etc, but I just can't quite put it all together. I do know I could do this using a rather convoluted series of if/else functions, but I want to teach the best/most efficient way to do this as equivalently as is reasonable to the LabView method just described.
Any help in getting me started would be much appreciated.
If anyone knows LabView, I've attached a diagram of what I'm attempting to do in Arduino below.
