Code Help needed for Robotics I CAPSTONE Project

Hey everyone, my group needs help on our code for our capstone project in a class. It’s a Phone Checker that uses distance sensors to detect whether there is a phone or not,

What I want the program to do is to go systematically to each pocket and record whether there is a phone in there using the first distance sensors with the use of lists in a grid pattern. It will use three lists in total, a x coordinate list for the second distance sensors, a y coordinate list for the third sensor, and a name list to correspond to each pocket so that it sends out a list of names to the Brain’s screen and controller’s screen to tell the teacher who has their phone and who doesn’t.

The only problem is that the distance sensors aren’t working, like they are detecting distances that are absurdly further than they should be. I have images of our code, the project, and a view of what is the problem.

This image bellow this shows you what the problem is, the first row on the brain’s screen is the distance between machine and pockets,

The second row is the distance between the left distance sensor on the large gear box to the distance sensor that reads the distance between the machine and pockets,

and the third row is the distance between the middle row that moves up and down to the paper on the bottom

it reads 938mm, 478mm, and 336mm

The first and third are absurdly wrong because the distance between the machine and pockets is around 120mm, and the distance between the movable row to the paper is much less than 336, like 100mm.

Like I said in the beginning, the distance sensors aren’t working, they are detecting distances that are absurdly further than they should be and when i was testing it but once I restart the Brain it fixes some of the distance senors to the measure the correct distances one BUT the third one which after it’s close to the paper, it jumps from 100mm to >800mm.

Any help is appreciated for me and my group!

Ok lets start.

1: use any phone holder any calculate and mark the distance when there’s a phone and when there is not.

example #1

I move the phonechecker sensor to the first phone holder and I run this code:

it returns 20

Then I put a phone in the holder then record the distance again. it returns 10

so

But what about the position? and how do I get it to check each slot?

same process don’t move it and run this

in this example x is 40 and y is 80.

while keeping it there run this

Screenshot 2026-04-23 6.39.26 PM

then move it to each phone holder and record the data

That’s all I’m going to do

Im going to write this verys simply in psedocode rather than make a project to help you understand my thought process.

When started

Print rectangle on brain
Print Start on Brian
Wait until pressed

Repeat X amount(
Spin Left Right (what everyway) (X turns)
If Distance greater than (X) Then
Print Phone Missing
+1 (variable1)
Print (Variable1 on screen)
Else if Distance Less than (X)
Print Phone Found
+1 (variable2_
Print Variable2 on screen

Spin Left Right (what everyway) (X turns)

Move Up/down then repeat this process again.

Sorry its a little long but this should give a rought idea on how this could be written and used in the classroom enviorment.