Promoting your Business with picoFlamingo

One of the easiest ways to promote your business is to add a screen showing some relevant information on your windows or even inside your premises. For instance, showing some offer or the latest products in the shop, making customer easily aware of the news.

This is quite common nowadays. An old computer and screen can work well. However using picoFlamingo and a BeagleBoard/Pandaboard would have some extra advantages; small form-factor, low power consumption, low price,...In addition picoFlamingo will add quite some interesting extras for your business promotion. Let's start simple with a basic slideshow of pre-formated images.

The most straightforward way to achieve this with picoFlamingo is producing a presentation were each slide contains a picture. Then launching picoFlamningo in slideshow mode. That will work, but updating content will be difficult. It would be a lot better to just produce automatically such a slideshow using all the pictures in a given directory.

Believe it or not. This is very easy with picoFlamingo.

First thing we need is a simple slide containing the image we will be updating periodically. We are including a white quad in the background as it is very convenient for the kind of images we will use. This is the slide1.pfs file we need.

ADD_QUAD 25.0 15.0
NAME ipanel
POSITION 0.0 0.0 -10.0
COLOR 1.0 1.0 1.0 1.0
; Images
ADD_CENTERED_IMAGE 4.0 pf.png
NAME img0
POSITION 0.0 0.0 -5.75
FX_START
SET_AUTO img0 1
FX_END
; EOF

Let's put it in some directory. We are using /usr/local/share/pf/pfslideshow, but you can use whichever other location you want. We also include a default image... in this case a nice logo :).

You can check everything is working. Just type

picoFlamingo --dir /usr/local/share/pf/pfslideshow

And you should see that cool logo.

Now we need something to tell picoFlamingo which pictures to show. The following Perl script will do the trick:

#!/usr/bin/perl -w

$d = $ARGV[0];
$delay = 5;
$current = 0;

use IO::Socket;
$remote = IO::Socket::INET->new(
    Proto => "tcp", PeerAddr => "localhost", PeerPort => "5000",)
    or die "cannot connect to daytime port at localhost";
$remote->autoflush(1);

@list = <$d/*png>;
while (1)
{
    $remote->send ("SET_IMAGE img0 $list[$current]\n");
    sleep $delay;
    $current++;
    $current = 0 if ($current > $#list);
}

Just read the images on the provided directory, connect to picoFlamingo and start changing the pictures every $delay seconds. Pretty easy.

We need to provide the script and absolute path. That is the way picoFlamingo knows it does not have to look for the image within the presentation directory. Something like this:

simple.pl /usr/local/share/pfslideshow/images

And all pictures will start to roll on the picoFlamingo window.

That's OK, but nowadays just changing a picture is pretty much under everybody's standards. Let's do, at least, a simple cross-fading effect. For that we need to add a second image to effectively fade in and out current and next picture. Something like this:

ADD_QUAD 25.0 15.0
NAME ipanel
POSITION 0.0 0.0 -10.0
COLOR 1.0 1.0 1.0 1.0
; Images
ADD_CENTERED_IMAGE 4.0 pf.png
NAME img0
POSITION 0.0 0.0 -5.75
ADD_CENTERED_IMAGE 4.0 pf.png
DEPTH_TEST 0
NAME img1
POSITION 0.0 0.0 -5.7
COLOR 1.0 1.0 1.0 0.0
DEPTH_TEST 0
FX_START
SET_AUTO img0 1
SET_AUTO img1 1
FX_END
; EOF

A very small change on our Perl script and we are done.

#!/usr/bin/perl -w

$d = $ARGV[0];
$delay = 5;

use IO::Socket;
$remote = IO::Socket::INET->new(
    Proto => "tcp", PeerAddr => "localhost", PeerPort => "5000",)
    or die "cannot connect to daytime port at localhost";

$remote->autoflush(1);

@list = <$d/*png>;

$current = 0;
$img0 = 0;
$img1 = 1;

$remote->send ("SET_IMAGE img$img0 $list[$current]\n");
$current++;
sleep $delay;

while (1)
{
    $remote->send ("SET_IMAGE img$img1 $list[$current]\n");
    $remote->send ("FX_TCOLOR img$img0 0.0 500.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0\n");
    $remote->send ("FX_TCOLOR img$img1 200.0 500.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0\n");
    sleep $delay;
    $current ++;
    $current = 0 if ($current > $#list);

    $img1 = $img0;
    $img0 = (($img0 + 1) & 1);
}

Now it is time to put everything together is a complete demo. For that we will use Ubuntu and configure an user account to log in automatically. Then we search for the "Startup programs" configuration tool and add two applications.

First one is just picoFlamingo starting on the right directory and resolution. Second one is our Perl script which will drive picoFlamingo with the images in a given directory.

Now you can get your Velcrobox, connect it to a display, plug the power and enjoy a nice slideshow.

At this point we should include a nice video right here. However showing just a slideshow is not that impressive (even with the cool cross-fading effect we had just added) so it is better to wait and make the thing a little bit more interesting, so you do not get the wrong impression.

Let's add some movement then. Yep, this is a bit more difficult to find in an standard image viewer with slideshow capabilities. Our new Perl script will look like this:

#!/usr/bin/perl -w

$d = $ARGV[0];
$delay = 12;
$delay_ms = $delay * 1000.0;
$move_dir = 0;

use IO::Socket;
$remote = IO::Socket::INET->new(
    Proto => "tcp", PeerAddr => "localhost", PeerPort => "5000",)
    or die "cannot connect to daytime port at localhost";
$remote->autoflush(1);

@list = <$d/*png>;

$current = 0;
$img0 = 0;
$img1 = 1;

$remote->send ("SET_IMAGE img$img0 $list[$current]\n");
$current++;
sleep $delay;

while (1)
{
    $remote->send ("SET_IMAGE img$img1 $list[$current]\n");
    $remote->send ("SET_POS img$img0 0.0 0.0 -5.75\n");
    $remote->send ("SET_POS img$img1 0.0 0.0 -5.75\n");
    $remote->send ("FX_TCOLOR img$img0 0.0 500.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0\n");
    $remote->send ("FX_TCOLOR img$img1 200.0 500.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0\n");
    # Simple animation
    if ($move_dir == 0) {
     $remote->send ("FX_TMOVE_TO img$img1 600.0 $delay_ms -1.0 0.0 -5.75\n");
   }
    if ($move_dir == 1) {
     $remote->send ("FX_TMOVE_TO img$img1 600.0 $delay_ms 1.0 0.0 -5.75\n");
   }

    sleep $delay;
    $current ++;
    $current = 0 if ($current > $#list);

    $img1 = $img0;
    $img0 = (($img0 + 1) & 1);
    $move_dir = (($move_dir + 1) & 1);
}

A bit longer but still pretty straightforward. Now our pictures slowly move in the screen for a while cross-fading then into the next one which will start moving on the opposite direction. Not that bad for some simple Perl lines.

And this is the final result

We are Perl fans, but you do not have to. Be free to use your preferred language (scripting or not). Just open a socket and start sending commands.

So this is he very first pf4b (picoFlamingo 4 business) idea... more exciting examples coming soon... I hope

CU
The picoFlamingo Team