Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lumen 2025 #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/lumen/lumen.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
#include "lumen.hpp"

namespace sensing_and_control_unit {

Lumen::Lumen() {}
Lumen::~Lumen() {}

void Lumen::initialize() {}
void Lumen::initialize()
{
lumen_.attach(kLumenPin);
lumen_.writeMicroseconds(min_pwm);//off
}

// void Lumen::initialize(ros::NodeHandle &nh) {
// lumen_.attach(kLumenPin);
// lumen_.writeMicroseconds(min_pwm);//off
// }

void Lumen::setBrightness(int brightness) {}
void Lumen::setBrightness(int brightness) {
int pwm = map(brightness, 0, 100, min_pwm, max_pwm);
lumen_.writeMicroseconds(pwm);
}

} // namespace sensing_and_control_unit
8 changes: 5 additions & 3 deletions src/lumen/lumen.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#ifndef SENSING_AND_CONTROL_UNIT_SRC_LUMEN_LUMEN_HPP
#define SENSING_AND_CONTROL_UNIT_SRC_LUMEN_LUMEN_HPP
#include <Servo.h>

#include "pins_info.hpp"
#include "Arduino.h"

namespace sensing_and_control_unit {
class Lumen {
private:
Servo lumen_;
static const int min_pwm = 1100;
static const int max_pwm = 1900;

public:
Lumen(/* args */);
Lumen();
~Lumen();
void initialize();
void setBrightness(int brightness);
};
} // namespace sensing_and_control_unit

#endif // SENSING_AND_CONTROL_UNIT_SRC_LUMEN_LUMEN_HPP
#endif // SENSING_AND_CONTROL_UNIT_SRC_LUMEN_LUMEN_HPP