mirror of
https://gitlab.com/Luci_/arduino-photometrics.git
synced 2026-04-03 03:25:36 +02:00
28 lines
397 B
C++
Executable file
28 lines
397 B
C++
Executable file
#include <Arduino.h>
|
|
#include "led.h"
|
|
|
|
Led::Led(uint8_t pin) : pin(pin), state(false) {
|
|
}
|
|
|
|
void Led::setup() {
|
|
pinMode(pin, OUTPUT);
|
|
state = false;
|
|
}
|
|
|
|
void Led::turnOn() {
|
|
digitalWrite(pin, HIGH);
|
|
state = true;
|
|
}
|
|
|
|
void Led::turnOff() {
|
|
digitalWrite(pin, LOW);
|
|
state = false;
|
|
}
|
|
|
|
void Led::toggle() {
|
|
if (state) {
|
|
turnOff();
|
|
} else {
|
|
turnOn();
|
|
}
|
|
} |