Skip to content
Snippets Groups Projects
Commit ca230527 authored by Ricco Müller's avatar Ricco Müller
Browse files

Upload New File

parent 007c0b2f
No related branches found
No related tags found
No related merge requests found
/*
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment