problems with the limit switch

ya iam having problems with the limit switch iam trying to connect and program two of them to work with a ultrasonic sensor and the second limit switch is not working my vex kit is kinda old i have a starter kit for the ver. 5 logic and kit and a new easy c soft ware can you tell me the way to fix my code i have from scratch a while loop (1) to the assigned sensors then a if limit > 0 statement op control then else statement so plz help i need this for a senior product . ty by

I’d highly recommend looking at the limit switch sample program in the help file and using the online window to look at the returned sensor values.

I’d also recommend changing your if statement to:

if ( limit == 0 ) { //if limit is equal to 0
//code here