first commit
This commit is contained in:
7
lib/BlinkLed/library.json
Normal file
7
lib/BlinkLed/library.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "BlinkLed",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple LED control library with internal LED helper.",
|
||||
"authors": [{ "name": "TiiJay14" }],
|
||||
"frameworks": "arduino"
|
||||
}
|
||||
16
lib/BlinkLed/src/BlinkInternLed.h
Normal file
16
lib/BlinkLed/src/BlinkInternLed.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef BLINKINTERNLED
|
||||
#define BLINKINTERNLED
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "BlinkLed.h"
|
||||
|
||||
class BlinkInternLed : public BlinkLed
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
public:
|
||||
BlinkInternLed() : BlinkLed(LED_BUILTIN) {}
|
||||
~BlinkInternLed() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
25
lib/BlinkLed/src/BlinkLed.cpp
Normal file
25
lib/BlinkLed/src/BlinkLed.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "BlinkLed.h"
|
||||
|
||||
BlinkLed::BlinkLed(byte pin)
|
||||
{
|
||||
BlinkLed();
|
||||
_pin = pin;
|
||||
pinMode(_pin, OUTPUT);
|
||||
}
|
||||
|
||||
String BlinkLed::ledStatus()
|
||||
{
|
||||
return _ledStatus == HIGH ? "HIGH" : "LOW";
|
||||
}
|
||||
|
||||
void BlinkLed::on()
|
||||
{
|
||||
_ledStatus = HIGH;
|
||||
digitalWrite(_pin, _ledStatus);
|
||||
}
|
||||
|
||||
void BlinkLed::off()
|
||||
{
|
||||
_ledStatus = LOW;
|
||||
digitalWrite(_pin, _ledStatus);
|
||||
}
|
||||
24
lib/BlinkLed/src/BlinkLed.h
Normal file
24
lib/BlinkLed/src/BlinkLed.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef BLINKLED
|
||||
#define BLINKLED
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class BlinkLed
|
||||
{
|
||||
private:
|
||||
PinStatus _ledStatus;
|
||||
byte _pin;
|
||||
/* data */
|
||||
BlinkLed() { _ledStatus = LOW; }
|
||||
|
||||
public:
|
||||
BlinkLed(byte pin);
|
||||
~BlinkLed() {}
|
||||
|
||||
void on();
|
||||
void off();
|
||||
|
||||
String ledStatus();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user