Go Down

Topic: Pb de création et utilisation de "library" (Read 514 times) previous topic - next topic

shiva972

Bonjour,

J'ai  le message d'erreur suivant quand j'utilise ma library :

" error: request for member 'setLed' in 'command', which is of non-class type 'Command ()()' "

Utilisation :

Code: [Select]

#include <Command.h>
Command command();
...
response = command.setLed(val1, val2);
...



Mes fichiers :

Command.h
Code: [Select]

/*
  Command.h
*/
#ifndef Command_h
#define Command_h

#include "Arduino.h"

class Command
{
  public:
    Command();
    boolean setLed(char *pinLed, char *stat);

};

#endif


Command.cpp
Code: [Select]

/*
  Command.cpp
*/

#include "Arduino.h"
#include "Command.h"

Command::Command()
{
}

// Allumer ou éteindre une LED
boolean Command::setLed(char *pinLed, char *stat)
{
  // Convert property to int
  int pin = atoi(pinLed);
  // Convert period to int
  int val = atoi(stat);
 
  if(val>0){
    digitalWrite(pin, HIGH);
  }else{
    digitalWrite(pin, LOW);
  }

  return true;
}

skywodd

Bonjour,

La construction d'un objet sans argument se fait SANS parenthèse lors de la déclaration.
Code: [Select]
Command command;
Des news, des tutos et plein de bonnes choses sur http://skyduino.wordpress.com !


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy