We were thinking of using an LED to sense when the ball is in the arm to trigger the motor to fling the ball.
Would this work?
You may be able to use a color sensor, but the LED sensor just detects the touch of a person. For the color sensor to work you need to insure that the balls will always be in a position where the sensor can detect them, and that it will not accidentally detect something else that is orange in the background. You might be able to get it to work, but my intuition tells me it will be far from perfect.
What if we attached the colour sensor to the arm/grabber on our robot?
Give it a try! You will have to play with the settings of the color sensor to get it to grab at the right time. The sensor will probably start detecting the color of the ball before the claw is close enough to grab.
If you are using ROBOTC, you can use the proximity sensor within the colour sensor to detect the presence of the ball. The command is getColorProximity and the syntax would be something like:
if(getColorProximity(nameOfYourColourSensor) > 220)
{
code here to do something when ball detected
}
Use the debugger to find a good value to replace the 220.