RGB Filter
Koby Benefiel from United States  [2 posts]
4 years
Is there a way to turn one RGB filter on and turn another off?
Steven Gentner from United States  [1365 posts] 4 years

Yes, surround both with the If_Statement module and use a variable to activate one and skip the other. The two If_Statement modules would be opposite of each other in terms of what they test. I.e.

if rgb_mode (my custom variable) =  1 then
  RGB_Filter Red
end if

if rgb_mode <> 1 then
  RGB_Filter Green
end if

Koby Benefiel from United States  [2 posts] 4 years

Thanks for the reply.  How would I activate the rgb_mode?  Do I include it in a vbscript.  What I am trying to accomplish is to have a turret (controlled by servos) scan for a red hoop and then scan for a purple hoop.  Also any suggestion in how to get the turret to scan for the hoop?

Steven Gentner from United States  [1365 posts] 4 years

You'd change the variable based on some trigger (time, sensor, etc) which would then activate that module within the If_Statement module. Note that the vbscript or cscript, etc. would ONLY change the variable ... it does NOT call the actual module but sets up the values such that back in the pipeline the If_statement module (note this is in the pipeline and not in script) would now activate and execute its contents.

I'd focus on getting the scanning working on one of the colors before worrying about the next color. That will be easier to see how to switch colors once you get the scanning working.

See the attached robofile. It looks for a green ball and if not found will start scanning. Note this is done for Vex so ignore the complaints about looking for the Vex controller. You'll need to replace that module with something you are using.



This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index