Error in Mode Switch Manager when used in Arduino 1.6.0 IDE

Hi guys,

I just installed the new Arduino IDE 1.6.0 in my pc after uninstalling the older version ,,

then copied again Nick Gammon's SwitchManager Library in the Arduino Library's folder ,,,

I have below the copy of my sketch that uses the SwitchManager Library, I used this in the older version of Arduino before, and it works just fine . however, the following errors appeared after "verifying" this code in the new Arduino IDE .... Can you help me on this ? thanks

#include <._SwitchManager.h>
#include <SwitchManager.h>



const byte ModeSW = 2;//input from the Mode push button switch    

const int ledPin3 = 3;
const int ledPin4 = 4;
const int ledPin5 = 5;
const int ledPin6 = 6;
const int ledPin7 = 7;
const int ledPin8 = 8;
const int playPin = 9;
const int tvPin = 10;
const int curtOp = 11;
const int curtCl = 12;
const int indicator = 13;


void setup ()
{
  modeSW.begin (ModeSW, modeSwitchManager);
  pinMode(ledPin3, OUTPUT);  
  pinMode(ledPin4, OUTPUT);
  pinMode(ledPin5, OUTPUT);
  pinMode(ledPin6, OUTPUT);
  pinMode(ledPin7, OUTPUT);
  pinMode(ledPin8, OUTPUT);
  pinMode(playPin, OUTPUT);
  pinMode(tvPin, OUTPUT);
  pinMode(curtOp, OUTPUT);
  pinMode(curtCl, OUTPUT);  
  pinMode(indicator, OUTPUT);
}

void loop ()
  {
  //check to see what's happening with the Mode switch
  modeSW.check();


  }


//                M O D E   S W I T C H   M A N A G E R
//****************************************************************
// function looks after the Mode switch functions
void modeSwitchManager (const byte newState, const unsigned long interval)
{
  
  
  
if (newState == HIGH)  //in this case ignor a switch release
      {
      digitalWrite(playPin, HIGH);
      delay(500);
      digitalWrite(playPin, LOW);
      
    delay(20800);
      digitalWrite(ledPin3, HIGH);
      delay(1000);
      digitalWrite(ledPin4, HIGH);
      delay(4450);
      digitalWrite(ledPin5, HIGH);
      delay(400);
      digitalWrite(ledPin6, HIGH);    
      delay(400);
      digitalWrite(ledPin7, HIGH);
      delay(400);
      digitalWrite(ledPin8, HIGH);
      delay(1000);
            digitalWrite(ledPin3, LOW);
            delay(500);
            digitalWrite(ledPin4, LOW);
            delay(500);
            digitalWrite(ledPin5, LOW);
            delay(500);
            digitalWrite(ledPin6, LOW);    
            delay(500);
            digitalWrite(ledPin7,LOW);
            delay(500);
            digitalWrite(ledPin8,LOW);
       delay(2500);
       
      digitalWrite(ledPin3, HIGH);
      digitalWrite(ledPin4, HIGH);
      digitalWrite(ledPin5, HIGH);
      digitalWrite(ledPin6, HIGH);    
      digitalWrite(ledPin7, HIGH);
      digitalWrite(ledPin8, HIGH);
 
      digitalWrite(curtOp, HIGH);
      delay(4000);
      digitalWrite(curtOp, LOW);
      delay(500);
      digitalWrite(tvPin, HIGH);
      delay(500);
      digitalWrite(tvPin,LOW);
         return;
    } 
   
      
  //the newSatate must be LOW
  //-----------------------------------
     


if (interval >=1000)


{     

      digitalWrite(tvPin, HIGH);
      delay(500);
      digitalWrite(tvPin, LOW);
      
      digitalWrite(curtCl, HIGH);
      delay(4000);
      digitalWrite(curtCl, LOW);
      digitalWrite(ledPin3, LOW);
      delay(500);
      digitalWrite(ledPin4, LOW);
      delay(500);
      digitalWrite(ledPin5, LOW);
      delay(500);
      digitalWrite(ledPin6, LOW);    
      delay(500);
      digitalWrite(ledPin7,LOW);
      delay(500);
      digitalWrite(ledPin8,LOW);
       
 
      
      return;  
        

}
} //                  END of modeSwitchManager()

It seems odd that there is both a period and an underscore character at the start of your first #include file.

here's another sketch I used and ran smoothly:

I ran this sketch just now in a newly installed arduino IDE 1.0.5 where it used to work (I copied and paste the switchmanger library folder in the library folder of the arduino in C:) ...
and another error appeared ,, what seems to be the problem ?

#include <SwitchManager.h>
SwitchManager modeSW;  // create the object

const byte ModeSW = 4;             //input from the Mode push button switch     

void setup ()
{
 modeSW.begin (ModeSW, modeSwitchManager);
}
//======================== END OF setup ==========================



void loop ()
{
 //check to see what's happening with the Mode switch
 modeSW.check();

 //other suff

}
//======================== END OF loop ===========================




//                M O D E   S W I T C H   M A N A G E R
//****************************************************************
// function looks after the Mode switch functions
void modeSwitchManager (const byte newState, const unsigned long interval)
{
 if (newState == HIGH)  //in this case ignor a switch release
 {
   return;
 }

 //the newSatate must be LOW

 //-----------------------------------
 if (interval >=3000)
 {
   //do stuff for 3 seconds
   return;  
 }  

 //-----------------------------------
 if (interval >=1000)
 {
   //do stuff for 1 second
   return;
 }

 //-----------------------------------

 if (interval <= 250)  
 {
   //do your stuff for < 1/4 second push
   return;
 }

 return;

}  //                  END of modeSwitchManager()

you need to share library link where tou downloaded. Without library we cant test your code.

share ur library link or share library zip file

here it is :

Here i have attached same code . I have seen code isit give any error . I have attached zip file. place in arduino library region & open .

SwitchManager.zip (2.45 KB)

I revert everything to my previous settings where things were doing just fine (uninstalled 1.0.6 and used 1.0.5. extracted the SwitchManager.rar to C:\Program Files\Arduino\libraries )

then ran my working sketch ... but still the error appears upon verification ..

#include <SwitchManager.h>
SwitchManager modeSW;  // create the object

const byte ModeSW = 4;             //input from the Mode push button switch     

void setup ()
{
 modeSW.begin (ModeSW, modeSwitchManager);
}
//======================== END OF setup ==========================



void loop ()
{
 //check to see what's happening with the Mode switch
 modeSW.check();

 //other suff

}
//======================== END OF loop ===========================




//                M O D E   S W I T C H   M A N A G E R
//****************************************************************
// function looks after the Mode switch functions
void modeSwitchManager (const byte newState, const unsigned long interval)
{
 if (newState == HIGH)  //in this case ignor a switch release
 {
   return;
 }

 //the newSatate must be LOW

 //-----------------------------------
 if (interval >=3000)
 {
   //do stuff for 3 seconds
   return;  
 }  

 //-----------------------------------
 if (interval >=1000)
 {
   //do stuff for 1 second
   return;
 }

 //-----------------------------------

 if (interval <= 250)  
 {
   //do your stuff for < 1/4 second push
   return;
 }

 return;

}  //                  END of modeSwitchManager()

It looks like I inadvertently uploaded a .zip file with ._Switchmanager.h in it, which is an artefact of the way OS/X stores files.

I have uploaded a new version. However if you edit your source and delete this line it should compile OK:

#include <._SwitchManager.h>

Ah, OK, I see what is happening. I "improved" the library recently. Your callback function now needs to take the pin number, eg.

void modeSwitchManager (const byte newState, const unsigned long interval, const byte whichPin)
...

if you add "const byte whichPin" to the arguments for modeSwitchManager it will compile.

@urbanmiles:

You can copy and paste the error messages (as text) you know. You don't need to muck around taking screenshots of it. That just wastes bandwidth.

My example on my web page has the pin number argument:

#include <SwitchManager.h>

// pin assignments
const byte testSwitch = 2;
const byte blueLED = 3;
const byte greenLED = 4;

SwitchManager mySwitch; 
 
// newState will be LOW or HIGH (the is the state the switch is now in)
// interval will be how many mS between the opposite state and this one
// whichPin will be which pin caused this change (so you can share the function amongst multiple switches)
 
void handleSwitchPress (const byte newState, const unsigned long interval, const byte whichPin)

then copied again Nick Gammon's SwitchManager Library in the Arduino Library's folder

extracted the SwitchManager.rar to C:\Program Files\Arduino\libraries

If you put the library folder in the correct libraries folder, the one in your sketches folder, then you would not need to reinstall it after an upgrade to the IDE.

Agreed. That is absolutely not the correct place for it.

Thank you for the information ! It already worked ! sorry for the image over-uploads