|
Re: Connecting an FRC Dashboard project to an FRC cRio project
I don't know if this is the most elegant solution out there, but it should work. I also don't know how much you or the people from the future reading this know about programming, so I'll go ahead and explain it. What this will do is look at the analog input 1 slider. It divides it up into four sections (0-1, 1-2, 2-3, 3-5) and will build an array consisting of the Boolean values of if the slider falls in each of these sections. For example, a value of 1.5 would be read as [False, True, False, False]. It then searches for which value in the array is true (at any given point there will only be one true value) and takes the index (0, 1, 2, or 3) of it. This index is then plugged into a case structure (expanded for your viewing pleasure). If it's 0-1, case 0 will run. If it's 1-2, case 1 will run, etc.
__________________
"This must be what going insane feels like."-Simon Tam, Firefly
|