Pros Optical Sensor Declaration Issues

When declaring an optical sensor I keep getting the same error: “no type named ‘Optical’ in namespace ‘pros’”. I’ve Copied straight from the pros V5 C++ documentation. Can anyone help? (OPTICAL_SENSOR_PORT is defined as 6)

image

It is possible that your project does not have the latest version of the kernel (3.3.1). Only the latest version of the kernel supports the optical sensor. Could you run prosv5 conductor info-project and paste the output here? You should see something like this:

Name      Version    Origin
--------  ---------  -------------
kernel    3.3.1      pros-mainline
okapilib  4.2.0      pros-mainline
1 Like

I also had this problem before. Try creating a new project and paste your original code into the new project.

This is likely because the new project chooses the latest kernel by default

2 Likes