Using mblock to define leds with loop


#1

Hi there,
Let me explain my question. In arduino mode of mblock, I would like define 4 leds to make led animation which lights fist led to last one. I’m trying define by using loop in mblock to teach my son but there is a problem.

In Arduino Ide here is my code;

int ledPin[]={2,3,4,5};
void setup(){
for(i=0; i<5; i++){
pinMode(ledPin[i], HIGH);
}

void loop(){
for(j=0; j<5; j++){
digitalWrite(ledPin[j],HIGH);
}

As you can see, the code is simple. But when I want to make same work by mblock, thats another story… Please, help to make it happend…


#2

Hi itopaktas,

Which robot do you use? Is it mBot?
And which LED module do you use? Is it Me RGB LED or LED RGB Strip.

Regarding to the arduino program, is it generated automatically after you edit the mBlock program? If yes, could you paste your mBlock graphical program here.


#3