Identifying a pi in a farm using a ledborg

Forums:

Hello,

I am creating a server farm using raspberry pi and would like to be able to physically identify each machine by the naked eye. I am interested in the ledborg but have a few questions.

ideally, i could write a java program that will one run in one pi that will serve as a master. a user will interact with the master on a webpage that will have the listing of all the pis in the farm listed by ip. the user will selet thea speicific pi and then the led would illuminiate on that pi.

I can see ow to do everything, the website, the inter pi communication. the only part i dont know is the last stepo, when the selected pi will turn theled to a specific color.

is it posible to do that, ideally with java?

Finally , do you ship to Australia?

Looking forward to your answers.

thanks

piborg's picture

It is possible to control the LedBorg from Java.

The easiest way will be to use the Pi4J library.
You can find installation instructions here: http://pi4j.com/install.html

Pi4J is a Java version of WiringPi, the pin numbers you need for LedBorg are:
Red uses WiringPi pin number 0
Green uses WiringPi pin number 2
Blue uses WiringPi pin number 3

You can use the software PWM functionality to get the full range of LedBorg colours the same way the Python examples do:
import com.pi4j.wiringpi.SoftPwm;

public class JavaLedBorgExample
{
    public static void SetLedBorg(float red, float green, float blue)
    {
        // Calculate PWM levels from 0.0 to 1.0
        int iRed = (int)(red * 100);
        int iGreen = (int)(green * 100);
        int iBlue = (int)(blue * 100);

        // Set the PWM levels
        SoftPwm.softPwmWrite(0, iRed);      // Red
        SoftPwm.softPwmWrite(2, iGreen);    // Green
        SoftPwm.softPwmWrite(3, iBlue);     // Blue
    }

    public static void main(String[] args) throws InterruptedException
    {
        // Setup WiringPi
        com.pi4j.wiringpi.Gpio.wiringPiSetup();

        // Create the software PWMs, 0 to 100
        SoftPwm.softPwmCreate(0, 0, 100);   // Red
        SoftPwm.softPwmCreate(2, 0, 100);   // Green
        SoftPwm.softPwmCreate(3, 0, 100);   // Blue

        // Loop some colours
        while (true) 
        {
            // Full red
            SetLedBorg(1.0, 0.0, 0.0)
            Thread.sleep(1000);

            // 50% cyan
            SetLedBorg(0.0, 0.5, 0.5)
            Thread.sleep(1000);

            // 10% yellow
            SetLedBorg(0.1, 0.0, 0.1)
            Thread.sleep(1000);

            // 25% grey
            SetLedBorg(0.25, 0.25, 0.25)
            Thread.sleep(1000);

            // Off
            SetLedBorg(0.0, 0.0, 0.0)
            Thread.sleep(1000);
        }
    }
}

We are happy to ship to Australia ^_^
Subscribe to Comments for "Identifying a pi in a farm using a ledborg"