Hello, I am trying to make a simple avoidance program however I am getting some unusual behavior.
I am using the Starter Robot Kit with Bluetooth.
I am able to successfully connect to Bluetooth.
I have made a simple progam that steers the robot with the arrow keys and it works just fine. In this case I use the arrow keys to set the motor speeds. This works perfectly. Space bar sets motor speeds to 0, and arrow keys do the appropriate thing.
HOWEVER, when I put the motor commands inside of if blocks/loops etc. The robot makes a humming noise and jerks a little bit but does not move. In this case I am using the ‘green flag’ to start the program with a forever loop around two if conditions. The little sprite has the correct text based on sensor reading, so when its too close it says “Turn” and when its clear it says “Go Straight” however the motors are not turning and there is the humming noise. I have tried using the sensor block directly instead of variables. Seems the variable is a pointer to the input stream as the ‘dist’ variable is continuously updating in the sprite window. Any suggestions or help would be appreciated.
See attached image:
MB-AvoidTurnRight.sb2 (74.3 KB)