Light sensor

Is there any way that a 3 wire light sensor that was used with the old system would be able to be used with the v5 3 wire ports or not.

Yes. It is a standard analog sensor. It interfaces electrically with the Brain/Cortex the same way a potentiometer, line tracker, accelerometer, or gyroscope does.

Ok thanks, but on vex coding studio it doesnt show up on the sensor list, so how do we make it a sensor.

Create an instance of a light sensor, it’s probably not in the robot config as it’s not an often used sensor, it should be in the drawer when using C++ Pro

light Light( Brain.ThreeWirePort.A );

int main() {
  while(1) {
    int value = Light.value( analogUnits::range12bit );
    Brain.Screen.printAt( 10, 50, "Light Sensor %d", value);
    // Allow other tasks to run

K, we are using c++ not pro so would it basically be the same concept.

What are you going to use for a light source? It works well with an incandescent light but we could not make it work with the Vex Flashlight 276-2210 or other LED’s. I assume that earlier versions of the Vex Flashlight were incandescent?
We tried a pair of Vex Line Followers using one as a source and one as a sensor, but couldn’t make that work either.
We wanted to detect a field object broke the beam and was in position fort the claw grip it.

yea, same idea, just add the constructor for the light sensor at the top of main.cpp. Make sure you pick the correct port, this is, Brain.ThreeWirePort.A would be port A etc.

1 Like

We had the sensor and code working when we had a non Vex legal incandescent light. It just did not work with the Vex Flashlight or any LED. What is a legal light source, I assume a “Radio Shack” light bulb would not be legal.