I want my starter kit robot to travel in a certain pattern (e.g. a rectangle, circle, heart shape etc) without using a remote.
I can control the speeds for those two motors easily because it is supported by the built-in mblock module. However, I can’t tell the motor to change speed (make turn) programmatically b/c there is no timer supported. Is there a way to work around it? Thanks.
What is the easiest way to set a timer using starter kit?
tiecongli
#1
danjger
#2
In the Robots Scripts for mBot or Arduino groups you have the timer blocks
Using (timer) it reads the number of seconds since the last [reset timer] operation
You can also use the Control block.
The trade off is that your program stops completely with the wait but you can do other things while the time check occurs. for short pauses the wait is ok.
Also be aware that you can use decimals in there to make things short like .1 for a tenth of a second.
tiecongli
#3
Thanks for your answer. I don’t know how to use the “timer” control block. But from the code it can see the magic actually comes from millis() function that returns num of seconds since the program starts. I ended up writing code on arduino IDE using millis(), and everything works great.