Skip to content

Commit

Permalink
Add LEDs
Browse files Browse the repository at this point in the history
  • Loading branch information
solasolo committed May 25, 2022
1 parent 6310749 commit 2551f99
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
30 changes: 25 additions & 5 deletions predict_gesture/LED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

#include <Arduino.h>

LED::LED(int pin)
LED::LED()
{
this->Pin = pin;
pinMode(this->Pin, OUTPUT);

pinMode(LED_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
pinMode(RED_PIN, OUTPUT);

this->Off();
this->Blank();
}

void LED::On()
Expand All @@ -27,4 +29,22 @@ void LED::Toggle()
this->State ? this->Off() : this->On();
}

LED Led(LED_PIN);
void LED::Blue()
{
digitalWrite(RED_PIN, HIGH);
digitalWrite(BLUE_PIN, LOW);
}

void LED::Red()
{
digitalWrite(BLUE_PIN, HIGH);
digitalWrite(RED_PIN, LOW);
}

void LED::Blank()
{
digitalWrite(BLUE_PIN, HIGH);
digitalWrite(RED_PIN, HIGH);
}

LED Led;
9 changes: 7 additions & 2 deletions predict_gesture/LED.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
#define _LED_H_

const int LED_PIN = 10;
const int BLUE_PIN = 6;
const int RED_PIN = 7;

class LED {
public:
LED(int pin);
LED();

void On();
void Off();
void Toggle();

void Blue();
void Red();
void Blank();
private:
int Pin;
bool State;
};

Expand Down

0 comments on commit 2551f99

Please sign in to comment.