Hi
I am starting to program the starter robot
It uses the Ultasonic to stop in a forever loop
,and I wish to let it move in a different direction ,
How do I do that .
Thank ,Gabi
How to exit from forever loop
Hi Gabi,
The forever loop cannot be broken out of. What you might do is to set up custom blocks that dictate the way that you want to make the robot move based on some condition and that’s what your code appears to do. If you want to do multiple directions then you will need to use nested if-then blocks. Something like:
if (ultrasonic sensor) > 30 then
set motor m1 speed 100
set motor m2 speed 100
else
if (ultrasonic sensor) > 25 and (ultrasonic sensor) < 30 then
_next set of code to do what you want_
else
_completely different set of code_
It’s really just a matter of nesting using if-then-else blocks. You will need to pay attention to the order/values that you are testing when doing this sort of thing.
Another approach is to create a variable to hold the current state and make decisions based on the value of the variable.
currentState = something based on a sensor reading perhaps
if (currentState) = 0 then
do something
if (currentState) = 1 then
do something else
if (currentState) = 2 then
do another something
This type of coding is a little more complex at first, but winds up being easier to maintain and to add new features.
Thanks ,I now realize that the Orion card is probably defective ,
I am trying to load different programs some as you described ,but the robot keeps doing an earlier trial ,also I am not able to reset the robot to its initial state (Starter)
My system is of IR Type ,
I think that some actions like many times disconnecting the USB Cable caused the board to its current status ,
I am now in a process of ordering a new card and Bluetooth module .
The robot served me only short time of 2 days ,its problems are discouraging ,
I wish also to add that the IR kit instructions refer to the bluetooth module .
So I hope to be able to give it life again ,and see what the bluetooth module
can do ,
Hi gabi,
Sorry to hear that!
You may refer to this link to double test if the Me Orion board lose the bootloader.
If it is, you can re burn the bootloader for it with another Orion board.
Here I attach the learn website link where you can find the instructions for both IR version Starter and Bluetooth version Starter.