 //------------------------------------------------------------
 void initBoardStateFromFile(char* _sFullFilePath) {
 
+  // Initialize the HW to a known state
+  initBoardState();
+  
+  // Read HW state in from the file  
 //  Serial.println("Init from board file");  
   // Open File
   FILE *fp;

  {
    if( !g_aPins[i].is_input ) // Process output pins
    {
      if( g_aPins[i].is_analog ) // Process analog pins      
        analogWrite(i, getTotalPinValue(i)*ANALOG_OUT_MAX_VALUE );
      else // Process digital pins     
        digitalWrite(i, getTotalPinValue(i) );
    }
  }
  

    {
    case UP:
//      g_iNewCode = 0;      
//      initBoardStateFromFile(BOARD_CONFIG_FILE_FULL_PATH);
       //      g_iWriteToFile=0;
       digitalWrite(13, HIGH );
      break;

    case DOWN:
    
           digitalWrite(13, LOW );
      // Serial.println("Writing board state to file");
//        writeBoardStateToFile(BOARD_CONFIG_FILE_FULL_PATH);
      // g_iWriteToFile=1;
    
//        system("shutdown -r now");
