MG400 programming


I have read MG400 Programming Guide. Okay, there is a DI command. But is there analogue of the WHILE command? The program waits for a DI signal (true or false it doesn’t matter) and does nothing.


Hi Vladimir, for Blockly, the function exists:
But for script, the API is not available. You can try with the following sentence:


Thanks for the answer. Blockly? Is this already a DobotStudio? I’m reading the DobotStudio manual right now. This tutorial uses DoboM1 as an example. I understand correctly that studio applies to MG400 too?
The second option is a little strange, but it needs to be tested.
I want to buy MG400, but interaction through the GPIO is very important for me.
Therefore, I study this topic.


Hi Vladimir, you can use DobotSCStudio for do it. The user guide for DobotSCStudio can be downloaded from Dobot official website:


There is a problem with this “wait digital input controler D1 on” function as it does not appear to be used in Blockly’s available functions with Dobot MG400.
As I can see some blockly functions are not available for the Dobot MG400. What are the ones that are not available?


For example, it is important for me that the vacuum gripper takes the workpiece. In order to be sure of this, I placed an optical sensor(TCRT5000) on the gripper. And if the sensor does not give a signal, then the MG400 does not move.


Sorry Victor, I noticed that the blockly is only available when you use CR. For MG400, you might need to use the script for this function


Hi Vladimir, I think the sample script in my screenshot can solve your problem:

while true do
if DI(1) == 1 then

Which means if the sensor detects no signal, the loop will be going on and on until the it detects an obstacle. And when it does, it will jump out of the circle and move to another part of your program.


A curiosity about and differentiates between the functions of Blockly using the DobotStudio2020 and the DobotSCStudio.
In the DobotSCStudio the “Wait x seconds” function does not appear while this Blockly function does appear in the DobotStudio2020.

Is this a mistake? Attached photo.


Hi Victor, it’s the problem of the version, and after the update in the future, there will be the same block in DobotSCStudio as well


Hi, I’m experimenting with a similar scenario to Vladimir.
Using the suggested script block ‘if DI(8) ==1 then break’, the MG400 successfully stops and waits at the intended point in the code until a push button I have connected between DI(8) and +24v is pressed.

So far so good, but I have noticed some strange behavior, if the button is pressed only briefly, say for around 0.5sec, the MG400 will stop and wait for a button press, but if the button is pressed and held for say 1 second, the MG400 will continue round the script for several times without stopping at the desired position, even though the button is no longer being pressed.
Its almost as if something inside the robot is being charged up the longer the button is pressed for and the robot thinks that the button is still being pressed when in fact it has been released some time ago.
While experimenting, this is ok, but in use the switch will be replaced with a sensor and the sensor will be sensing the presence of a part for longer than just 0.5 sec.

Thank you for any help.


Hello MykeC63, I suggest you add Sync() after MovJ(Pick_Up) for synchronization


Hi hans99
Thank you so much, this works perfectly!