Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

digitalInput Class library for Arduino
Author:  Fabio Durigon develop@dury.it


Description

English

This is a class for Arduino

With this class You can handle a digital input pin:

  • Check state using '==' operator
  • Test status changing

This library is provide with doxygen documentation (in italian).

Italiano

Classe per Arduino

Permette di gestire più facilmente un input pin:

  • Usare l'operatore '==' per verificare lo stato logico
  • Verificare il cambio di stato

La classe contiene la documentazione in formato doxygen


Download, install and import

Download here: arduino_lib_digitalInput.rar

Inlude doxygen compiled help in html format

Put the library folder in "hardware\libraries\".
In the Arduino IDE, create a new sketch (or open one) and select from the menubar "Sketch->Import Library->digitalInput".
Once the library is imported, an "#include <digitalInput.h>" line will appear at the top of your Sketch.


Usage Example


digitalInput inTest(8,true); // pulsante collegato tra il pin 8 e gnd (attiva anche la resistenza di pull-up)
pinMode(13, OUTPUT); // Led Pin
void setup()
{
        Serial.begin(9600);
}

void loop()
{
        if (inTest == LOW) {
                digitalWrite(13,HIGH); accende il led
        }
        else {
                digitalWrite(13,LOW); spegne il led
        }

        if (inTest.isChanged()) {
                Serial.print("Stato cambiato in ");
                Serial.println(inTest);
        }
}