In playme back Infrared sensor can be used as parking sensor. This will help us to park robot safely without colliding with obstacle.
Goto mblock software and open it.
Goto edit menu and select Arduino mode.
Playme Robot Program is a Header file for Robot programming. It makes programming simple. By using this we can access all blocks easily and smoothly. If we are not using this then it may give us errors in program. So put this at start of program.
Figure 8: Loop Selection
Here we are using loop. Loop is area which will be repeated for certain times depending upon its type. If we write anything inside loop then it will be repeated along with loop. Forever loop means program will run continuously. For example if we write a program to run motor in forward direction with forever loop then it will run until we remove power applied to it.
Select block Send to Computer and drag it in programming window.
Put it in forever loop. Here we are writing Hello for message printing. You can write any message instead of Hello.
To get Left sensor value take Right Obstacle Block
Connect that block to Send to computer.
Connect wait statement of 1second below this.
Now save program.
Give name to program.
Select COM port
Click on Upload Arduino option
After uploading is done you will get this message.
Click on close option.
Again go to Serial port and select COM port
And see output of your program
To get proper message select Char mode for both send encode mode, recv encode mode.
And see sensorvalue on your screen. It will be displayed on screen after every one second.