Error MeDCMotor code in script


#1

I am new to Mblock and used some coding with Arduino IDE before
Now when I create an mBot or Arduino program the code is shown includes several other things besides the simple LED assignment.

One of them is the MeDCMotor code, why is this added when I start to create a program ?
I am starting with only using a few led’s and don’t understand why this code is added.

It blocks me uploading the code. I receive the following messages:

project_Test211_0.ino:6:1: error: ‘MeDCMotor’ does not name a type
project_Test211_0.ino:7:1: error: ‘MeDCMotor’ does not name a type
project_Test211_0.ino: In function ‘void move(int, int)’:
project_Test211_0.ino:26:7: error: ‘motor_9’ was not declared in this scope
project_Test211_0.ino:26:24: error: ‘M1’ was not declared in this scope
project_Test211_0.ino:27:7: error: ‘motor_10’ was not declared in this scope
’MeDCMotor’ does not name a type

Can’t I just add the Motor code whenever I am doing something with a motor ?


#2

Hi Piet200,

It is normal that there is always MeDCMotor added to the Arduino code under mBlock.
I am not sure the particular reason, it may make the mBlock to call function easier or some other reason.

Anyway, it shouldn’t cause any problem while uploading the program.
You may totally uninstall the previous mBlock, then download the latest version mBlock 3.4.3 and install it have a try.


#3

Hello Piet200,

I spent some time solving this problem. If you use any other HW than mbot (the default one), go to main menu > Boards and check your board first. Then the interpreter stops including this “Motor” block of code to your final cpp code.

Cheers,
Dodo


#4