 */
 }
 
+void setBoardState()
+{
+  for(int i=0; i<TOTAL_NUM_OF_PINS; i++)
+  {
+      if( g_aPins[i].is_input )
+      {
+        pinMode(i, INPUT);
+      }
+      else
+      {
+        pinMode(i, OUTPUT);
+        
+        if( g_aPins[i].is_analog )
+        {
+          analogWrite(i, int(g_aPins[i].value*ANALOG_OUT_MAX_VALUE) );
+        }
+        else
+        {
+          digitalWrite(i, int(g_aPins[i].value) );
+        }
+        
+      }
+  }
+}
 
 /*
 {	"status":<OK,ERROR>,
 	"pins":{	"<0,1,…,13,A0,…,A5>":
 				{	"label":"<label text>",
 					"is_analog":"<true,false>",
-					"is_sensor":"<true,false>",
+					"is_input":"<true,false>",
 					"value":"<0.0,1.0>",
 					"connections":[<array of pins>],
 				},

  //if (serial_stream.available()) {
    // Something real on input, let's take a look.
    //aJsonObject *msg = aJson.parse(&serial_stream);
    //aJsonObject *msg = aJson.parse("{\"status\":OK,\"pins\":{\"13\":{\"label\":\"LED ON 13\",\"is_analog\":\"false\",\"is_sensor\":\"false\",\"value\":\"0.0\",\"connections\":[]}},\"connections\":[]}\"");
    // aJsonObject *msg = aJson.parse(g_acMessage);
    // processMessage(msg);
    // aJson.deleteItem(msg);

#define NUM_OF_ANALOG_PINS 6
#define NUM_OF_DIGITAL_PINS 14

#define ANALOG_OUT_MAX_VALUE 255

typedef struct Pin {
  char label[PIN_LABEL_SIZE];
  boolean is_analog;
  boolean is_input;
  float value;
  boolean connections[TOTAL_NUM_OF_PINS];
} Pin;
