Knightmb bitcoin mineral
19 commentsTrade in liquidaters
The discussion on this web page is about using the HiTechnic sensor. HiTechnic offers a "Football Kit" that includes a ball, seeker V2 and compass sensor; click here to see the reduced price. If sensor is mounted on a robot with the sensor's mounting holes below the sensor, the direction numbers are as shown in the diagram below: This will be the same if the sensor is mounted "upside down", "right way up", or "sideways".
The circled command above will make motor C go backwards. Note that my HiTechnic Seeker V2 sensor is plugged into computer brick socket 2. If your robot has your seeker sensor plugged in to a different socket, you will have to change this code. The program above brings the HiTechnic Seeker V2 sensor into our program. In the code above, we have added a mathematics block. We have changed the sensor's command block to detect when the direction number "Equals 5". Note that we have connected the two blocks by a yellow wire.
This allows the direction number to go from the Seeker block through the yellow wire to the Mathematics block. If you forget to do this, the program will refuse to work!
To do this we need a loop. In the code above, the mathematics block is connected to the loop with a green wire. This code will allow your robot to leave the loop and obey the next command following the loop. We haven't put that next command in yet, but will soon. There are lots of things we can tell our robot to do after it finds the ball. However, just so we can test that our code works, let us tell our robot to go forward one rotation each time the ball is seen.
The code above causes motors A and C to turn one rotation, causing the robot to go a short way forwards. The loop in the code above causes the whole code to keep repeating forever, or until we turn our robot off. This complete program causes the Robot to keep finding the Soccer ball, and following it - which is what we wanted.
Download this program to your robot, and test it to see that your robot does what you want it to do. If there are problems, carefully check the diagrams above to make sure you have understood the method we have outlined above. When everything is good, go on to the next step to find out how to tell your robot which is your opponent's goal!
Soccer Tactics 2 - Find the Ball! The second thing we want our robot to do is to find the ball. The circled command above will make motor A go forwards.