Gadgeteer Mood Cube

I’m working with a few .NETMF folks and have been talking with @ransomhall (http://ransomhall.com) about projects to collaborate on.

Eric created a Mood Cube using a GHI FEZ Rhino and 4 BlinkM Smart RGB LEDs.

I created a Gadgeteer version using a FEZ Hydra, USB ClientDP Module and a MultiColor LED Module.

I printed out a 30mm hollow cube (Sketchup file) (STL file) on my MakerBot Replicator.

I then used a mounting board (more details on those coming soon!) that I cut out of acrylic to mount the Hydra and Modules using some bolts and nuts I sourced on Amazon.

Here’s a demo of the cube working:


Here is the code that I used:

using System;


using System;
using GT = Gadgeteer;

namespace MoodLight_Hydra
{
    public partial class Program
    {
        int i = 0;
        int direction = 1;
        int color = 0;
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            multicolorLed.GreenBlueSwapped = true;
            GT.Timer timer = new GT.Timer(5);

            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            timer.Start();
        }

        void timer_Tick(GT.Timer timer)
        {
           // Debug.Print("i: " + i);

            switch(color)
            {
                case 0:
                    multicolorLed.SetBlueIntensity(i);
                    break;
                case 1:
                    multicolorLed.SetGreenIntensity(i);
                    break;
                case 2:
                    multicolorLed.SetRedIntensity(i);
                    break;
            }

            if (i >= 255)
            {
                direction = -5;
            }
            else if (i <= 0)
            {
                direction = 5;
                if (color==2)                 
                    color = 0;                
                else
                    color+=1;

            }

            i += direction;

        }
    }
}

No Comments

Post Reply