Using MiniBloq to solve a maze

This was one of the first things I worked on with Sparki.

I used MiniBloq which is a graphical programming tool which helps n00bs like me get used to programming and thinking like a programmer before we start with arduino.

The first thing I realised was how much I would need to tell Sparki to help him navigate and how much we as humans rely on our senses to understand our environment.

This is what the MiniBloq software looks like and I found that it is simple to use and easy to grasp.

minibloq

As you can see, the generated code is present on the right hand side so it is easy to make the leap from graphical programming to cc++

This is the generated code from this program:

#include

void setup()
{
while(true)
{
sparki.servo(0);
sparki.RGB(0,255,0);
sparki.moveForward(10);
if((sparki.ping()<10))
{
sparki.servo(90);
delay(1000);
if((sparki.ping()<10))
{
sparki.servo(-(90));
delay(1000);
if((sparki.ping()<10))
{
sparki.servo(90);
delay(1000);
sparki.moveRight(180);
}
else
{
sparki.servo(-(90));
sparki.RGB(0,0,255);
delay(1000);
sparki.moveLeft(90);
}
}
else
{
sparki.servo(-(90));
delay(1000);
if((sparki.ping()<10))
{
sparki.servo(90);
sparki.RGB(0,0,255);
delay(1000);
sparki.moveRight(90);
}
else
{
sparki.servo(90);
sparki.RGB(0,0,255);
delay(1000);
sparki.moveRight(90);
}
}
}
else
{
sparki.servo(-(90));
delay(1000);
if((sparki.ping()<10))
{
sparki.servo(90);
delay(1000);
if((sparki.ping()<10))
{
sparki.servo(0);
delay(1000);
}
else
{
sparki.servo(0);
delay(1000);
}
}
else
{
sparki.servo(90);
delay(1000);
if((sparki.ping()<10))
{
sparki.servo(0);
delay(1000);
}
else
{
sparki.servo(0);
delay(2000);
}
}
}
}
}

void loop()
{
}

In this program Sparki relies on his ultrasonic range sensor to detect if his path is clear and the direction he should travel.

Here is a video of the program in action:

https://drive.google.com/file/d/0B6y9ITteBcqLYlU2aXpPaDJkTUk/view?usp=sharing

check it out and let me know what you think 🙂 🙂

Advertisements

One thought on “Using MiniBloq to solve a maze

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s