Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Schwimmwinkelsensor MA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ricco Müller
Schwimmwinkelsensor MA
Commits
ca230527
Commit
ca230527
authored
11 months ago
by
Ricco Müller
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
007c0b2f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Arduino Code/Schwimmwinkel_FINAL/LED_status.cpp
+38
-0
38 additions, 0 deletions
Arduino Code/Schwimmwinkel_FINAL/LED_status.cpp
with
38 additions
and
0 deletions
Arduino Code/Schwimmwinkel_FINAL/LED_status.cpp
0 → 100644
+
38
−
0
View file @
ca230527
/*
LED_status.h file for visuell information with onboard RGB-LED
Written by Ricco Müller
01.02.2024
*/
// Include .h file
#include
"LED_status.h"
// ************************************** functions ************************************** //
void
init_LED
()
{
// set PWM-settings for each channel
ledcSetup
(
LED_CHANNEL_RED
,
PWM_FREQUENCY
,
PWM_RESOLUTION
);
ledcSetup
(
LED_CHANNEL_GREEN
,
PWM_FREQUENCY
,
PWM_RESOLUTION
);
ledcSetup
(
LED_CHANNEL_BLUE
,
PWM_FREQUENCY
,
PWM_RESOLUTION
);
// set PWM-channel for each LED-Pin
ledcAttachPin
(
LED_RED_PIN
,
LED_CHANNEL_RED
);
ledcAttachPin
(
LED_GREEN_PIN
,
LED_CHANNEL_GREEN
);
ledcAttachPin
(
LED_BLUE_PIN
,
LED_CHANNEL_BLUE
);
}
void
setLEDColor
(
int
red
,
int
green
,
int
blue
)
{
// convert color-value (0-255) to PWM-value (255-0) for LOW active LED
red
=
255
-
red
;
green
=
255
-
green
;
blue
=
255
-
blue
;
// set Duty-Cycle for each channel
ledcWrite
(
LED_CHANNEL_RED
,
red
);
ledcWrite
(
LED_CHANNEL_GREEN
,
green
);
ledcWrite
(
LED_CHANNEL_BLUE
,
blue
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment