Using the mBlock version 2.1.5.06.16.001, I created a simple mBot visual program starting with the icon mBot, followed by a ‘repeat’ icon with a ‘run forward’ and ‘wait’ icons inside the repeat. It uploads to the arduino successfully but the code is uploads is below. The execution part of the code, i.e. for, motor and delay, should be in the loop function and not the setup.
#include “mBot.h”
#include "MePort.h"
MeBoard myBoard(mBot);
#include “MeDCMotor.h”
double angle_rad = PI/180.0;
double angle_deg = 180.0/PI;
MeDCMotor motor(0);
void setup(){
for(int i=0;i<10;i++)
{
motor.move(1,100);
delay(1000*1);
}
}
void loop(){
}