ORBneXt Developer Kit

Overview

ORBneXt Developer Board Celery.jpgORBneXt Development Board LED Celery.jpg

The ORBneXt Developer Kit allows the user to create their own customizable data display device. We are providing the hardware and you the user are providing your own customizable solution through your electric imp developer account.  

Electric Imp will be your goto resource to get your ORBneXt Developer Board up and running.  Here is the link to get started:

 

Getting Started with Electric Imp

We will provide you with some device and agent code and pin settings to get you started (see below).   Use the Electric Imp forums for questions that you might have in using the Electric Imp platform.  

First Steps:

Agent Code

//ORBneXt Developer Sample Agent Code

local response; //global variable to hold response from httprequest

local globalColor; //global variable to hold color

local deviceCode = split(http.agenturl(),"/")

server.log("Agent URL: "+http.agenturl());

server.log("Device Code: "+deviceCode[2]);

function hexToInteger(hex)

{

    local result = 0;

    local shift = hex.len() * 4;

     // For each digit..

    for(local d=0; d<hex.len(); d++)

    {

        local digit;

         // Convert from ASCII Hex to integer

        if(hex[d] >= 0x61)

            digit = hex[d] - 0x57;

        else if(hex[d] >= 0x41)

             digit = hex[d] - 0x37;

        else

             digit = hex[d] - 0x30;

         // Accumulate digit

        shift -= 4;

        result += digit << shift;

    }

    return result;

}

function colorRequest()

{

    local colorRequest = response.color;

    //colorRequest = "#FFFF00"; //Hard Code Red

    local r = hexToInteger(colorRequest.slice(1,3));

    local g = hexToInteger(colorRequest.slice(3,5));

    local b = hexToInteger(colorRequest.slice(5,7));

    local RGB = r+","+g+","+b;

    server.log("RGB = "+RGB);

    send(RGB);

}

function send(color)

{

    globalColor = split(color,",");

    device.send("ColorRequest", globalColor); //send to device

}

http.onrequest(function(request,res)

{

    local reply; //variable to received response from functions

    server.log("Incoming request: "+request.body); //incoming request

   

    //*** format {"color":"#008000","program":"Color"}

   

    response = http.jsondecode(request.body); //decode json request

    local selection = response.program;

   

   switch(selection) //http request

    {

    case "Color":

        server.log("Color Demo Request Received");

        res.header("X-From-Agent", "Yes");

        res.header("Content-Type", "text/html");

        res.send(200, "Color Demo Request Received");

        colorRequest();

    break;

     }

 });

Device Code

//ORBneXt Developer Sample Device Code

//***********IMP 2.0 LED CODE******************

// Pin Assignments

// Pin 1 = PWM for Red

// Pin 2 = PWM for Green

// Pin 5 = PWM for Blue

 

// Configure Hardware

hardware.pin1.configure(PWM_OUT, 1.0/500.0, 1.0); // Red

hardware.pin2.configure(PWM_OUT, 1.0/500.0, 1.0); // Green

hardware.pin5.configure(PWM_OUT, 1.0/500.0, 1.0); // Blue

// RGB LED Class

class RgbLed

{

    // IO Pin assignments

    pinR = null;

    pinG = null;

    pinB = null;

   

    constructor(r, g, b)

    {

        // Save pin assignments

        pinR = r;

        pinG = g;

        pinB = b;

        // Initialise as inactive

        setLevels(0, 0, 0);

    }

       

 

 // Set red, green and blue intensity levels

function setLevels(r, g, b)

    {

        // output pin is configured for PWM, we can set the duty cycle with pin.write()

        // write a floating point number between 0.0 and 1.0, where 1.0 = 100% duty cycle

        //server.log("RgbLed.setLevels");

        this.pinR.write(r/255.0);

        this.pinG.write(g/255.0);

        this.pinB.write(b/255.0);

    }

}

led <- RgbLed(hardware.pin1, hardware.pin2, hardware.pin5);

//}

//************Color Request******************

//{

agent.on("ColorRequest", function(x)

{

    local r = x[0].tointeger();

    local g = x[1].tointeger();

    local b = x[2].tointeger();

    led.setLevels(r,g,b);

});

//}

//}

//}

Pin Layout

ORBneXt Development Board.jpg

ORBneXt Developer LED Board.jpg

Blinkup Sensor & Status LED

ORBneXt Developer Board bottom.jpg