Pages: [1]   Go Down
Author Topic: Pb de création et utilisation de "library"  (Read 369 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#include <Command.h>
Command command();
...
response = command.setLed(val1, val2);
...


Mes fichiers :

Command.h
Code:
/*
  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:
/*
  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;
}
Logged

France
Offline Offline
Faraday Member
**
Karma: 55
Posts: 5347
Arduino Hacker
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Bonjour,

La construction d'un objet sans argument se fait SANS parenthèse lors de la déclaration.
Code:
Command command;
Logged

Des news, des tuto et plein de bonne chose sur http://skyduino.wordpress.com !

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Merci,
Je corrige mon programme
Logged

Pages: [1]   Go Up
Jump to: