Voila le nouveau Clock.ino, qui contient le code de l'application

#define VERSION "v9"
 
#include <LiquidCrystal.h>
#include "time.h" 
#include "Keypad.h"
LiquidCrystal lcd ( 8,9, 4,5,6,7 );
Keypad keypad(0);
long int shift = 0;

// etc.

et, comme vous voyez, fait référence à deux fichiers inclus, time.h et @Keypad.h@.


Le fichier time.h contient la définition du type time_t

#ifndef TIME_H_INCLUDED
#define TIME_H_INCLUDED

typedef unsigned long time_t;
#endif

Le fichier Keypad.h contient la déclaration de la classe, avec les variables membres et les prototypes des fonction membres

// Keypad.h

#ifndef KEYPAD_H_INCLUDED
#define KEYPAD_H_INCLUDED

#include "time.h"

class Keypad {
public:
  enum Button { 
    RIGHT, UP, DOWN, LEFT, SELECT, NONE, ERROR
  };

protected:
  int m_pin;
  time_t m_bounce_timeout;
  Button m_last_button;
  int m_bounce_delay;

public:  
  Keypad(int pin);
  void setBounceDelay(int delay);
  Button getButton();
};

#endif

Enfin, la définition des fonctions membres se trouvent dans Keypad.ino

// Keypad.ino

#include "Keypad.h"
 
Keypad::Keypad(int pin) 
  : m_pin(pin)
  , m_bounce_timeout (0)
  , m_last_button (NONE)
  , m_bounce_delay (500)
 {}
 void Keypad::setBounceDelay(int delay) 
 {
   m_bounce_delay = delay;
 }
 Button Keypad::getButton() {
  // ....
 }