Vexgo Code

I am new to vexcode, and I am working through some problems with my students that we have been unable to solve.

  1. Is there any way to add an additional “When Started” command on a vexgo project. The project includes the Code Base.

  2. Here is the scenario/challenge that I put forth to my students. Imagine you were a Mars Rover Programmer. Using your eye forward sensor, you would like to program your rover to scan a 1 meter by 1 meter area for obstructions, stop at the obstacles, wait for obstacles to be removed and continue to search. We have been able to solve this for a line. They can find the object and wait for it to be removed and continue searching. We have included a forever comand so that it will keep finding obstacles. What we can not do is attach this to commands that make it search the whole square area. Any ideas? Thank you.

2 Likes

Hello!
My apologies as I am a IQ user and not a GO, so I need a bit of information, mainly these

  1. What are the dimensions of the robot?
  1. When you ask this do you mean the robot patrols the area until an object is found, or do you mean when an object is found you drive to it.

(Edit) 3. do you have the 1 Meter by 1 Meter Area Marked in tape? If so what color.

Thanks!

2 Likes

Here is some sample code if your outline is red,

Screenshot 2022-03-24 11.13.55 AM

I hope this Helps!

2 Likes

Thank you so much for replying. I mean " robot patrols the area until an object is found"

The dimensions are 4in by 6in

1 Like

I realized I did not answer this, from the time I took to look through the program I did not see anyway to add extra when started block, I usually combat this by adding a custom block and having it run when started, but I am not sure this program allows that. This might be something worth trying though.

From above does some of this code help? You can replace the red with the boundry if you are taping one on the ground, this is the simplest way although I might be able to code one without a physical boundary, but would take a lot of explaining to your kids as it would use a variable as the main way to stay in the lines. I am available to troubleshoot and give advice with coding, but I am not familiar with GO so this is a little bit out of my comfort zone, but that is how we all learn, isn’t it.

I hope this helps!

2 Likes

I marked it in red. I think I know where you are going. Great idea.

1 Like

Thank you so much for your help. I am getting closer. Here is my new code that used what you mentioned and some additions. Unfortunately, now when it gets to the red outside it turns right at turn A and B, then it turns left on next turn. I thought it was working, then it would turn the wrong way. Any thoughts. Again thanks for working with me.

1 Like

1 Like

I am so sorry it took this long to respond, but this is what I was talking about with variables. attached is code that should work.

2 Likes

Thank you so much. I think the variable piece is a bit over my students’ heads. I really appreciate all of your help. It was nice to collaborate on this. I guess there is a leaning curve. Thank you again.

1 Like

Your welcome! If you need anymore help just ask! there is also a way where you code it all without any loops could work, if you want me to give a screenshot I can, it might be a little delayed though, but I will get back to you!

1 Like

Here is more of a brute force way…

(the entire code is long so I will upload the file later, because of stupid Middle schoolers not being able to use Dropbox or share Google drive files outside of our organization.)

2 Likes