00001
00002
00003 #include <ledButton.h>
00004
00005
00006 int ButtonOne = 1;
00007 int ButtonTwo = 2;
00008 int GreenPin = 13;
00009 int RedPin = 12;
00010
00011
00012
00013 void InitLedButton()
00014 {
00015 #ifdef __DEBUG__
00016 Serial.println("Initialisation of leds and buttons...");
00017 #endif
00018
00019 pinMode( GreenPin, OUTPUT);
00020 pinMode( RedPin, OUTPUT);
00021 pinMode(ButtonOne, INPUT);
00022 pinMode(ButtonTwo, INPUT);
00023 }
00024
00025
00026
00027 void LedButtonsState()
00028 {
00029 #ifdef __DEBUG__
00030 Serial.println("Control leds and read buttons state...");
00031 #endif
00032
00033 int ButtonOneState = digitalRead(ButtonOne);
00034 int ButtonTwoState = digitalRead(ButtonTwo);
00035
00036 if (ButtonOneState == HIGH)
00037 {
00038 digitalWrite(GreenPin, HIGH);
00039 }
00040 else
00041 {
00042 digitalWrite(GreenPin, LOW);
00043 }
00044
00045
00046 if (ButtonTwoState == HIGH)
00047 {
00048 digitalWrite(RedPin, HIGH);
00049 }
00050 else
00051 {
00052 digitalWrite(RedPin, LOW);
00053 }
00054 }
00055