Follow Hand Program

Now this idea stemmed from the Wowwee MiP robot.

I’m quite a fan of this little guy as a fun toy to mess around with. it’s advertised based on its two wheel self balancing tech and it’s gesture sense. In the following program I attempted to recreate the gesture sense tech with Sparki, which up to a point was fairly straightforward and successful. Here is a print screen of some of the blocks used in miniBloq to program this:

Untitled

I started off with a while loop, during which Sparki, while an object such as my hand was less than 10 cm away from his Ultrasonic range finder then he would move forward and continue until the object could no longer be detected.

Now this is great, but MiP can interpret gestures to turn around. This does not always go according to plan, but that adds to the fun of an entertaining toy robot that doesn’t need to always be accurate and precise. to mimic this with Sparki I used another while loop, during which while an object or hand is more than ten cm away he rotates on the spot. Once an object or a hand is again in range then Sparki beeps, changes led to blue and follows the object or hand again.

This is a really fun way to interact with Sparki especially for younger people who are maybe too young to code. Also, it’s a great way to experiment with the while loop which I often overlook when programming.

There is one problem with using MiniBloq to code this and that is the lack of an increment counter. When using a while loop the program will repeat infinitely and so most of the time we add an increment counter so that it only repeats to a certain point and doesn’t break the computer. This is quite easy through the languages similar to C++ including Javascript and Arduino, but is something missing from MiniBloq.

Here is the generated code:

#include

void setup()
{
while(true)
{
sparki.servo(0);
while((sparki.ping()<10)) { delay(2000); sparki.RGB(0,255,0); sparki.moveForward(0); sparki.beep(540, 1000); } sparki.servo(0); while((sparki.ping()>10))
{
delay(2000);
sparki.moveRight(0);
}
}
}

void loop()
{
}

Let me know what you think 🙂 🙂

Oh and a pic of the two bro-bots to finish :

 DSC_0003

EDIT:

As really helpfully suggested by franzcalvo, here is a link to a video showing sparki running the follow hand program.

 

https://drive.google.com/file/d/0B6y9ITteBcqLWmp5aTdPNURWUzg/edit?usp=docslist_api

 

Advertisements

4 thoughts on “Follow Hand Program

    • I do have a video of Sparki completing the code I could upload tomorrow if that’s what you mean? But otherwise I don’t think I could make a tutorial kind of movie at the moment 😦 although I wish I could!!

      Like

  1. A video would be useful. Even though images/video contain highly concentrated information, our brain process them faster than regular text. My initial confusion was this: from the title and the picture, I thought Sparki was going to follow hand gestures made by … the MiP robot.

    Like

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