-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled.cpp
46 lines (37 loc) · 821 Bytes
/
led.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* @file led.cpp
*
* @author Pedro Henrique Martins de Santi <[email protected]>
*
* @brief Implementation of Led class
*
* @date 2022-03-29
*
* @copyright Copyright (c) 2022
*
*/
#include <Arduino.h>
#include "led.h"
/*****************************************
* Public Functions
*****************************************/
Led::Led(int GPIO_pin, const char* topic) {
this->GPIO_pin = GPIO_pin;
this->topic = (char*) topic;
// this->topic = topic; // with std::string (must be converted with c_str() afterwards)
}
Led::~Led() {
}
char* Led::get_topic() {
return this->topic;
}
int Led::get_pin() {
return this->GPIO_pin;
}
bool Led::get_state() {
return this->state;
}
void Led::set_state(bool state) {
digitalWrite(this->GPIO_pin, state);
this->state = state;
}