Hello, thanks for sharing code. I think the first suggestion is to try each of the sensors independently, to ensure they are generating the correct values you expect. Try one of the example sketches for each sensor type, to see if it is working correctly. Also, ensure that the jumper pins are set correctly for the light sensor (2-3 and 4-5) and ultrasonic sensor (1-2 and 4-5).
You don’t have to unplug any motors or sensors to try out the individual example code. For example, here is a quick sketch to test light sensor values:
// Be sure to set your serial console to 115200 baud
// Initialize the Bricktronics Shield
With this code sketch you should test the light sensor is working correctly.