VexCode V5 Range Finder C++

Are their any suggestions to add an value to the Range Finder’s distance or to put a distance for Finding an object?

My code:

  while (true)

  if (RangeFinderG.distance(inches)>3)

     {          
                LeftMotor.spin(forward, 50, percent);
                Wait (3, seconds);
                LeftMotor.stop() 
      }

So like range finder distance in mm + 3 units? And If object is this distance away do this?

Yes but it is in inches. I am trying to find a way for it to work because it will not allow me to Download the file

def when_started1():
global myVariable
if range_finder_g.distance(MM) + 3 > 50:
motor_11.spin_to_position(90, DEGREES, wait=True)
motor_11.stop()

when_started1()

Does this work? Roughly.
For adding values

Which V5 platform are you using Python , Text or C++?

I personally use blocks( Yes I know Im lame so you dont have to make fun of me because of it) So im converting how I would do that code in blocks over to C++. Now looking back I think the code I posted here is the python version and not the C++ version.

The fact that you’re doing programming is not lame at all…I’ve seen too many competitions where robots just sit for the 15 second autonomous due to “no programming” at all. That’s what would be lame

9 Likes

I was just curious. We are trying to use C++.