I am not sure how to have the mbot keep track of the total number of turns made using a variable
Coding help
Hi Whitney,
The mBot does not have a lot of sensors, let alone a GPS.
It’s possible but it depends on your track.
- What shape does the track have? (Square, round, oval, …)
- Does the track have the object ?
Here is a possible track (line tracking):
If not with Ultrasonic (easier):
You turn in circles and when the ultrasonic decreases below a value then the mBlot has made a turn.
You take a variable and you have your answer
If you are have the mbot performing a distinct turn command, you can create a variable and then add 1 to the variable every time the turn command is performed. My son is doing something similar with a program to search for an object in a grid but he is using the variable as a step to move from one function to another.
He created a variable and set it to 0 at the start of the program. After each distinct action he used the block Change “variable” by 1.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.